@@ -116,8 +116,6 @@ @interface MTRXPCProtocolTests<NSXPCListenerDelegate, CHIPRemoteDeviceProtocol>
116
116
@property (readwrite, strong) void (^handleReadClusterStateCache)
117
117
(id controller, NSNumber * nodeId, NSNumber * _Nullable endpointId, NSNumber * _Nullable clusterId,
118
118
NSNumber * _Nullable attributeId, void (^completion)(id _Nullable values, NSError * _Nullable error));
119
- @property (readwrite, strong) void (^handleDownloadLog)(id controller, NSNumber * nodeId, MTRDiagnosticLogType type, NSTimeInterval timeout,
120
- void (^completion)(NSString * _Nullable url, NSError * _Nullable error));
121
119
122
120
@end
123
121
@@ -276,18 +274,6 @@ - (void)readAttributeCacheWithController:(id _Nullable)controller
276
274
});
277
275
}
278
276
279
- - (void)downloadLogWithController:(id)controller
280
- nodeId:(uint64_t)nodeId
281
- type:(MTRDiagnosticLogType)type
282
- timeout:(NSTimeInterval)timeout
283
- completion:(void (^)(NSString * _Nullable url, NSError * _Nullable error))completion
284
- {
285
- dispatch_async(dispatch_get_main_queue(), ^{
286
- XCTAssertNotNil(self.handleDownloadLog);
287
- self.handleDownloadLog(controller, @(nodeId), type, timeout, completion);
288
- });
289
- }
290
-
291
277
- (void)setUp
292
278
{
293
279
[self setContinueAfterFailure:NO];
@@ -314,44 +300,6 @@ - (void)tearDown
314
300
_xpcDisconnectExpectation = nil;
315
301
}
316
302
317
- - (void)testDownloadLogSuccess
318
- {
319
- uint64_t myNodeId = 9876543210;
320
- NSString * myBdxURL = @"bdx://foo";
321
- NSTimeInterval myTimeout = 10;
322
-
323
- XCTestExpectation * callExpectation = [self expectationWithDescription:@"XPC call received"];
324
- XCTestExpectation * responseExpectation = [self expectationWithDescription:@"XPC response received"];
325
-
326
- __auto_type uuid = self.controllerUUID;
327
- _handleDownloadLog = ^(id controller, NSNumber * nodeId, MTRDiagnosticLogType type, NSTimeInterval timeout,
328
- void (^completion)(NSString * _Nullable url, NSError * _Nullable error)) {
329
- XCTAssertTrue([controller isEqualToString:uuid]);
330
- XCTAssertEqual([nodeId unsignedLongLongValue], myNodeId);
331
- [callExpectation fulfill];
332
- completion(myBdxURL, nil);
333
- };
334
-
335
- __auto_type * device = [MTRBaseDevice deviceWithNodeID:@(myNodeId) controller:_remoteDeviceController];
336
- NSLog(@"Device acquired. Downloading...");
337
- [device downloadLogOfType:MTRDiagnosticLogTypeEndUserSupport
338
- timeout:myTimeout
339
- queue:dispatch_get_main_queue()
340
- completion:^(NSURL * _Nullable url, NSError * _Nullable error) {
341
- NSLog(@"Read url: %@", url);
342
- XCTAssertNotNil(url);
343
- XCTAssertNil(error);
344
- [responseExpectation fulfill];
345
- self.xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"];
346
- }];
347
-
348
- [self waitForExpectations:[NSArray arrayWithObjects:callExpectation, responseExpectation, nil] timeout:kTimeoutInSeconds];
349
-
350
- // When download is done, connection should have been released
351
- [self waitForExpectations:[NSArray arrayWithObject:_xpcDisconnectExpectation] timeout:kTimeoutInSeconds];
352
- XCTAssertNil(_xpcConnection);
353
- }
354
-
355
303
- (void)testReadAttributeSuccess
356
304
{
357
305
uint64_t myNodeId = 9876543210;
0 commit comments