Skip to content

Commit

Permalink
Add debug messages to the delegate callbacks for test033_TestMTRDevic…
Browse files Browse the repository at this point in the history
…eDeviceConfigurationChanged (project-chip#35906)
  • Loading branch information
nivi-apple authored Oct 4, 2024
1 parent a3b5eaa commit 965a377
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/darwin/Framework/CHIPTests/MTRDeviceTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -3283,6 +3283,7 @@ - (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)att

// Check if the received attribute report matches the injected attribute report.
delegate.onAttributeDataReceived = ^(NSArray<NSDictionary<NSString *, id> *> * attributeReport) {
NSLog(@"checkAttributeReportTriggersConfigurationChanged: onAttributeDataReceived called");
attributeReportsReceived += attributeReport.count;
XCTAssert(attributeReportsReceived > 0, @"%@", description);
for (NSDictionary<NSString *, id> * attributeDict in attributeReport) {
Expand All @@ -3309,12 +3310,14 @@ - (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)att
};

delegate.onReportEnd = ^() {
NSLog(@"checkAttributeReportTriggersConfigurationChanged: onReportEnd called");
[gotAttributeReportEndExpectation fulfill];
};

__block BOOL wasOnDeviceConfigurationChangedCallbackCalled = NO;

delegate.onDeviceConfigurationChanged = ^() {
NSLog(@"checkAttributeReportTriggersConfigurationChanged: onDeviceConfigurationChanged called");
[deviceConfigurationChangedExpectation fulfill];
wasOnDeviceConfigurationChangedCallbackCalled = YES;
};
Expand Down Expand Up @@ -3365,6 +3368,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged
__block NSNumber * endpointForPowerSourceConfigurationSources;

delegate.onAttributeDataReceived = ^(NSArray<NSDictionary<NSString *, id> *> * attributeReport) {
NSLog(@"test033_TestMTRDeviceDeviceConfigurationChanged: onAttributeDataReceived called");
attributeReportsReceived += attributeReport.count;
XCTAssert(attributeReportsReceived > 0);

Expand Down Expand Up @@ -3423,6 +3427,7 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged
};

delegate.onReportEnd = ^() {
NSLog(@"test033_TestMTRDeviceDeviceConfigurationChanged: onReportEnd called");
XCTAssertNotNil(dataVersionForDescriptor);
XCTAssertNotNil(dataVersionForOvenCavityOperationalState);
XCTAssertNotNil(dataVersionForIdentify);
Expand Down Expand Up @@ -3660,16 +3665,19 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged
XCTestExpectation * gotAttributeReportWithMultipleAttributesEndExpectation = [self expectationWithDescription:@"Attribute report with multiple attributes has ended"];
XCTestExpectation * deviceConfigurationChangedExpectationForAttributeReportWithMultipleAttributes = [self expectationWithDescription:@"Device configuration changed was receieved due to an attribute report with multiple attributes "];
delegate.onAttributeDataReceived = ^(NSArray<NSDictionary<NSString *, id> *> * attributeReport) {
NSLog(@"test033_TestMTRDeviceDeviceConfigurationChanged: onAttributeDataReceived called with multiple attributes");
attributeReportsReceived += attributeReport.count;
XCTAssert(attributeReportsReceived > 0);
[gotAttributeReportWithMultipleAttributesExpectation fulfill];
};

delegate.onReportEnd = ^() {
NSLog(@"test033_TestMTRDeviceDeviceConfigurationChanged: onReportEnd called with multiple attributes");
[gotAttributeReportWithMultipleAttributesEndExpectation fulfill];
};

delegate.onDeviceConfigurationChanged = ^() {
NSLog(@"test033_TestMTRDeviceDeviceConfigurationChanged: onDeviceConfigurationChanged called for testing with multiple attributes");
[deviceConfigurationChangedExpectationForAttributeReportWithMultipleAttributes fulfill];
};

Expand Down

0 comments on commit 965a377

Please sign in to comment.