@@ -75,6 +75,9 @@ static void WaitForCommissionee(XCTestExpectation * expectation)
75
75
#ifdef DEBUG
76
76
@interface MTRBaseDevice (Test)
77
77
- (void )failSubscribers : (dispatch_queue_t )queue completion : (void (^)(void ))completion ;
78
+
79
+ // Test function for whitebox testing
80
+ + (id )CHIPEncodeAndDecodeNSObject : (id )object ;
78
81
@end
79
82
#endif
80
83
@@ -1558,9 +1561,14 @@ - (void)test017_TestMTRDeviceBasics
1558
1561
delegate.onNotReachable = ^() {
1559
1562
[subscriptionDroppedExpectation fulfill ];
1560
1563
};
1561
- XCTestExpectation * resubscriptionExpectation = [self expectationWithDescription: @" Resubscription has happened" ];
1564
+ XCTestExpectation * resubscriptionReachableExpectation =
1565
+ [self expectationWithDescription: @" Resubscription has become reachable" ];
1562
1566
delegate.onReachable = ^() {
1563
- [resubscriptionExpectation fulfill ];
1567
+ [resubscriptionReachableExpectation fulfill ];
1568
+ };
1569
+ XCTestExpectation * resubscriptionGotReportsExpectation = [self expectationWithDescription: @" Resubscription got reports" ];
1570
+ delegate.onReportEnd = ^() {
1571
+ [resubscriptionGotReportsExpectation fulfill ];
1564
1572
};
1565
1573
1566
1574
// reset the onAttributeDataReceived to validate the following resubscribe test
@@ -1598,7 +1606,7 @@ - (void)test017_TestMTRDeviceBasics
1598
1606
// Check that device resets start time on subscription drop
1599
1607
XCTAssertNil (device.estimatedStartTime );
1600
1608
1601
- [self waitForExpectations: @[ resubscriptionExpectation ] timeout: 60 ];
1609
+ [self waitForExpectations: @[ resubscriptionReachableExpectation, resubscriptionGotReportsExpectation ] timeout: 60 ];
1602
1610
1603
1611
// Now make sure we ignore later tests. Ideally we would just unsubscribe
1604
1612
// or remove the delegate, but there's no good way to do that.
@@ -2585,11 +2593,6 @@ - (void)test999_TearDown
2585
2593
2586
2594
@end
2587
2595
2588
- @interface MTRBaseDevice (Test)
2589
- // Test function for whitebox testing
2590
- + (id )CHIPEncodeAndDecodeNSObject : (id )object ;
2591
- @end
2592
-
2593
2596
@interface MTRDeviceEncoderTests : XCTestCase
2594
2597
@end
2595
2598
0 commit comments