19
19
#import < Matter/Matter.h>
20
20
21
21
#import " MTRErrorTestUtils.h"
22
+ #import " MTRTestCase+ServerAppRunner.h"
23
+ #import " MTRTestCase.h"
22
24
#import " MTRTestKeys.h"
23
- #import " MTRTestResetCommissioneeHelper.h"
24
25
#import " MTRTestStorage.h"
25
26
26
27
#import < math.h> // For INFINITY
27
28
28
- // system dependencies
29
- #import < XCTest/XCTest.h>
30
-
31
- // Fixture: chip-all-clusters-app --KVS "$(mktemp -t chip-test-kvs)" --interface-id -1
32
-
33
29
static const uint16_t kPairingTimeoutInSeconds = 30 ;
34
30
static const uint16_t kCASESetupTimeoutInSeconds = 30 ;
35
- static const uint16_t kTimeoutInSeconds = 3 ;
36
31
static const uint64_t kDeviceId = 0x12344321 ;
37
32
static NSString * kOnboardingPayload = @" MT:-24J0AFN00KA0648G00" ;
38
33
static const uint16_t kLocalPort = 5541 ;
39
34
static const uint16_t kTestVendorId = 0xFFF1u ;
40
35
41
- // This test suite reuses a device object to speed up the test process for CI.
42
- // The following global variable holds the reference to the device object.
43
- static MTRBaseDevice * sConnectedDevice ;
44
-
45
36
// Singleton controller we use.
46
37
static MTRDeviceController * sController = nil ;
47
38
48
39
// Keys we can use to restart the controller.
49
40
static MTRTestKeys * sTestKeys = nil ;
50
41
51
- static MTRBaseDevice * GetConnectedDevice (void )
52
- {
53
- XCTAssertNotNil (sConnectedDevice );
54
- return sConnectedDevice ;
55
- }
56
-
57
42
@interface MTRBackwardsCompatTestPairingDelegate : NSObject <MTRDevicePairingDelegate>
58
43
@property (nonatomic , strong ) XCTestExpectation * expectation;
59
44
@end
@@ -88,7 +73,7 @@ - (void)onCommissioningComplete:(NSError *)error
88
73
89
74
@end
90
75
91
- @interface MTRBackwardsCompatTests : XCTestCase
76
+ @interface MTRBackwardsCompatTests : MTRTestCase
92
77
@end
93
78
94
79
@implementation MTRBackwardsCompatTests
@@ -97,6 +82,11 @@ + (void)setUp
97
82
{
98
83
[super setUp ];
99
84
85
+ BOOL started = [self startAppWithName: @" all-clusters"
86
+ arguments: @[]
87
+ payload: kOnboardingPayload ];
88
+ XCTAssertTrue (started);
89
+
100
90
XCTestExpectation * expectation = [[XCTestExpectation alloc ] initWithDescription: @" Pairing Complete" ];
101
91
102
92
__auto_type * factory = [MTRControllerFactory sharedInstance ];
@@ -140,16 +130,13 @@ + (void)setUp
140
130
completionHandler: ^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) {
141
131
XCTAssertEqual (error.code , 0 );
142
132
[connectionExpectation fulfill ];
143
- sConnectedDevice = device;
144
133
connectionExpectation = nil ;
145
134
}];
146
135
XCTAssertEqual ([XCTWaiter waitForExpectations: @[ connectionExpectation ] timeout: kCASESetupTimeoutInSeconds ], XCTWaiterResultCompleted);
147
136
}
148
137
149
138
+ (void )tearDown
150
139
{
151
- ResetCommissionee (GetConnectedDevice (), dispatch_get_main_queue (), nil , kTimeoutInSeconds );
152
-
153
140
[sController shutdown ];
154
141
XCTAssertFalse ([sController isRunning ]);
155
142
[[MTRControllerFactory sharedInstance ] shutdown ];
0 commit comments