Skip to content

Commit 1e03c08

Browse files
[Darwin] MTRDeviceTests test017 - fix resubscription expectation (project-chip#29458)
* [Darwin] MTRDeviceTests test017 - fix resubscription expectation * Update src/app/InteractionModelEngine.h Co-authored-by: Boris Zbarsky <bzbarsky@apple.com> --------- Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 7c216f8 commit 1e03c08

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

src/app/InteractionModelEngine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescr
679679
/**
680680
* Check whether concrete attribute path is an "existent attribute path" in spec terms.
681681
* @param[in] aPath The concrete path of the data being read.
682-
* @retval boolean
682+
* @retval boolean true if the concrete attribute path indicates an attribute that exists on the node.
683683
*/
684684
bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath);
685685

src/darwin/Framework/CHIPTests/MTRDeviceTests.m

+11-8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ static void WaitForCommissionee(XCTestExpectation * expectation)
7575
#ifdef DEBUG
7676
@interface MTRBaseDevice (Test)
7777
- (void)failSubscribers:(dispatch_queue_t)queue completion:(void (^)(void))completion;
78+
79+
// Test function for whitebox testing
80+
+ (id)CHIPEncodeAndDecodeNSObject:(id)object;
7881
@end
7982
#endif
8083

@@ -1558,9 +1561,14 @@ - (void)test017_TestMTRDeviceBasics
15581561
delegate.onNotReachable = ^() {
15591562
[subscriptionDroppedExpectation fulfill];
15601563
};
1561-
XCTestExpectation * resubscriptionExpectation = [self expectationWithDescription:@"Resubscription has happened"];
1564+
XCTestExpectation * resubscriptionReachableExpectation =
1565+
[self expectationWithDescription:@"Resubscription has become reachable"];
15621566
delegate.onReachable = ^() {
1563-
[resubscriptionExpectation fulfill];
1567+
[resubscriptionReachableExpectation fulfill];
1568+
};
1569+
XCTestExpectation * resubscriptionGotReportsExpectation = [self expectationWithDescription:@"Resubscription got reports"];
1570+
delegate.onReportEnd = ^() {
1571+
[resubscriptionGotReportsExpectation fulfill];
15641572
};
15651573

15661574
// reset the onAttributeDataReceived to validate the following resubscribe test
@@ -1598,7 +1606,7 @@ - (void)test017_TestMTRDeviceBasics
15981606
// Check that device resets start time on subscription drop
15991607
XCTAssertNil(device.estimatedStartTime);
16001608

1601-
[self waitForExpectations:@[ resubscriptionExpectation ] timeout:60];
1609+
[self waitForExpectations:@[ resubscriptionReachableExpectation, resubscriptionGotReportsExpectation ] timeout:60];
16021610

16031611
// Now make sure we ignore later tests. Ideally we would just unsubscribe
16041612
// or remove the delegate, but there's no good way to do that.
@@ -2585,11 +2593,6 @@ - (void)test999_TearDown
25852593

25862594
@end
25872595

2588-
@interface MTRBaseDevice (Test)
2589-
// Test function for whitebox testing
2590-
+ (id)CHIPEncodeAndDecodeNSObject:(id)object;
2591-
@end
2592-
25932596
@interface MTRDeviceEncoderTests : XCTestCase
25942597
@end
25952598

src/darwin/Framework/CHIPTests/TestHelpers/MTRTestKeys.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ - (instancetype)init
5757
CFErrorRef error = NULL;
5858
const NSDictionary * keygenParams = @{
5959
(__bridge NSString *) kSecAttrKeyClass : (__bridge NSString *) kSecAttrKeyClassPrivate,
60-
(__bridge NSString *) kSecAttrKeyType : (__bridge NSNumber *) kSecAttrKeyTypeECSECPrimeRandom,
60+
(__bridge NSString *) kSecAttrKeyType : (__bridge NSString *) kSecAttrKeyTypeECSECPrimeRandom,
6161
(__bridge NSString *) kSecAttrKeySizeInBits : @(keySizeInBits),
6262
(__bridge NSString *) kSecAttrIsPermanent : @(NO)
6363
};

0 commit comments

Comments
 (0)