Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Darwin] MTRDeviceTests test017 - fix resubscription expectation #29458

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/InteractionModelEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ CHIP_ERROR ReadSingleClusterData(const Access::SubjectDescriptor & aSubjectDescr
/**
* Check whether concrete attribute path is an "existent attribute path" in spec terms.
* @param[in] aPath The concrete path of the data being read.
* @retval boolean
* @retval boolean true if the concrete attribute path indicates an attribute that exists on the node.
*/
bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath);

Expand Down
19 changes: 11 additions & 8 deletions src/darwin/Framework/CHIPTests/MTRDeviceTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ static void WaitForCommissionee(XCTestExpectation * expectation)
#ifdef DEBUG
@interface MTRBaseDevice (Test)
- (void)failSubscribers:(dispatch_queue_t)queue completion:(void (^)(void))completion;

// Test function for whitebox testing
+ (id)CHIPEncodeAndDecodeNSObject:(id)object;
@end
#endif

Expand Down Expand Up @@ -1558,9 +1561,14 @@ - (void)test017_TestMTRDeviceBasics
delegate.onNotReachable = ^() {
[subscriptionDroppedExpectation fulfill];
};
XCTestExpectation * resubscriptionExpectation = [self expectationWithDescription:@"Resubscription has happened"];
XCTestExpectation * resubscriptionReachableExpectation =
[self expectationWithDescription:@"Resubscription has become reachable"];
delegate.onReachable = ^() {
[resubscriptionExpectation fulfill];
[resubscriptionReachableExpectation fulfill];
};
XCTestExpectation * resubscriptionGotReportsExpectation = [self expectationWithDescription:@"Resubscription got reports"];
delegate.onReportEnd = ^() {
[resubscriptionGotReportsExpectation fulfill];
};

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

[self waitForExpectations:@[ resubscriptionExpectation ] timeout:60];
[self waitForExpectations:@[ resubscriptionReachableExpectation, resubscriptionGotReportsExpectation ] timeout:60];

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

@end

@interface MTRBaseDevice (Test)
// Test function for whitebox testing
+ (id)CHIPEncodeAndDecodeNSObject:(id)object;
@end

@interface MTRDeviceEncoderTests : XCTestCase
@end

Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIPTests/TestHelpers/MTRTestKeys.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ - (instancetype)init
CFErrorRef error = NULL;
const NSDictionary * keygenParams = @{
(__bridge NSString *) kSecAttrKeyClass : (__bridge NSString *) kSecAttrKeyClassPrivate,
(__bridge NSString *) kSecAttrKeyType : (__bridge NSNumber *) kSecAttrKeyTypeECSECPrimeRandom,
(__bridge NSString *) kSecAttrKeyType : (__bridge NSString *) kSecAttrKeyTypeECSECPrimeRandom,
jtung-apple marked this conversation as resolved.
Show resolved Hide resolved
(__bridge NSString *) kSecAttrKeySizeInBits : @(keySizeInBits),
(__bridge NSString *) kSecAttrIsPermanent : @(NO)
};
Expand Down
Loading