Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
  • Loading branch information
nivi-apple and bzbarsky-apple authored May 2, 2024
1 parent e98778c commit 6428c58
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/darwin/Framework/CHIPTests/MTRDeviceTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -3011,7 +3011,7 @@ - (void)test031_MTRDeviceAttributeCacheLocalTestStorage
// We need to remove the device here since the MTRDevice retains its reachable state. So if the next test needs to start with a clean state,
// it can't do that since the MTRDevice becomes reachable in the previous test. Since there are no changes detected in reachability,
// the onReachable callback to the delegate is not called.
// TODO: #33205 Ensure we have a clean slate w.r.t MTRDevice bfeore running each test.
// TODO: #33205 Ensure we have a clean slate w.r.t MTRDevice before running each test.
[sController removeDevice:device];
}

Expand Down Expand Up @@ -3111,7 +3111,7 @@ + (void)checkAttributeReportTriggersConfigurationChanged:(MTRAttributeIDType)att
XCTAssertNotNil(data);
XCTAssertEqualObjects(data[MTRDataVersionKey], dataVersion);

NSArray<NSNumber *> * dataValue = data[MTRValueKey];
id dataValue = data[MTRValueKey];
XCTAssertNotNil(dataValue);
XCTAssertNotNil(testDataValue);
XCTAssertEqualObjects(dataValue, testDataValue);
Expand Down Expand Up @@ -3320,9 +3320,9 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged
}
} ];

// Test attribute path - endpointId = 0, clusterId = descriptor, attributeId = server list.
[MTRDeviceTests checkAttributeReportTriggersConfigurationChanged:MTRAttributeIDTypeClusterDescriptorAttributeDeviceTypeListID clusterId:MTRClusterIDTypeDescriptorID endpointId:@(0) device:device delegate:delegate dataVersion:dataVersionForDeviceTypesList attributeReport:attributeReport testcase:self expectConfigurationChanged:YES];

// Test attribute path - endpointId = 0, clusterId = descriptor, attributeId = server list.
dataVersionForServerList = [NSNumber numberWithUnsignedLongLong:(dataVersionForServerList.unsignedLongLongValue + 1)];
attributeReport = @[ @{
MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(MTRClusterIDTypeDescriptorID) attributeID:@(MTRAttributeIDTypeClusterDescriptorAttributeServerListID)],
Expand Down Expand Up @@ -3466,10 +3466,9 @@ - (void)test033_TestMTRDeviceDeviceConfigurationChanged
[device unitTestInjectAttributeReport:attributeReport];
[self waitForExpectations:@[ gotAttributeReportWithMultipleAttributesExpectation, gotAttributeReportWithMultipleAttributesEndExpectation, deviceConfigurationChangedExpectationForAttributeReportWithMultipleAttributes ] timeout:kTimeoutInSeconds];

// We need to remove the device here since the MTRDevice retains its reachable state. So if the next test needs to start with a clean state,
// it can't do that since the MTRDevice becomes reachable in the previous test. Since there are no changes detected in reachability,
// the onReachable callback to the delegate is not called.
// TODO: #33205 Ensure we have a clean slate w.r.t MTRDevice bfeore running each test.
// We need to remove the device here, because we injected data into its attribute cache
// that does not match the actual server.
// TODO: #33205 Ensure we have a clean slate w.r.t MTRDevice before running each test.
[sController removeDevice:device];
}

Expand Down

0 comments on commit 6428c58

Please sign in to comment.