@@ -103,19 +103,18 @@ class TestContext : public chip::Test::AppContext
103
103
{
104
104
public:
105
105
// Performs shared setup for all tests in the test suite
106
- void SetUpTestSuite () override
106
+ static void SetUpTestSuite ()
107
107
{
108
108
chip::Test::AppContext::SetUpTestSuite ();
109
109
DeviceLayer::SetSystemLayerForTesting (&GetSystemLayer ());
110
- mRealClock = &chip::System::SystemClock ();
111
- System::Clock::Internal::SetSystemClockForTesting (&mMockClock );
112
- return CHIP_NO_ERROR;
110
+ sRealClock = &chip::System::SystemClock ();
111
+ System::Clock::Internal::SetSystemClockForTesting (&sMockClock );
113
112
}
114
113
115
114
// Performs shared teardown for all tests in the test suite
116
- void TearDownTestSuite () override
115
+ static void TearDownTestSuite ()
117
116
{
118
- System::Clock::Internal::SetSystemClockForTesting (mRealClock );
117
+ System::Clock::Internal::SetSystemClockForTesting (sRealClock );
119
118
DeviceLayer::SetSystemLayerForTesting (nullptr );
120
119
chip::Test::AppContext::TearDownTestSuite ();
121
120
}
@@ -135,17 +134,21 @@ class TestContext : public chip::Test::AppContext
135
134
chip::Test::AppContext::TearDown ();
136
135
}
137
136
138
- System::Clock::Internal::MockClock mMockClock ;
137
+ static System::Clock::Internal::MockClock sMockClock ;
138
+
139
139
TestSessionKeystoreImpl mKeystore ;
140
140
app::ICDManager mICDManager ;
141
141
TestSubscriptionsInfoProvider mSubInfoProvider ;
142
142
TestPersistentStorageDelegate testStorage;
143
143
TestICDStateObserver mICDStateObserver ;
144
144
145
145
private:
146
- System::Clock::ClockBase * mRealClock ;
146
+ static System::Clock::ClockBase * sRealClock ;
147
147
};
148
148
149
+ System::Clock::Internal::MockClock TestContext::sMockClock ;
150
+ System::Clock::ClockBase * TestContext::sRealClock ;
151
+
149
152
} // namespace
150
153
151
154
namespace chip {
@@ -162,7 +165,7 @@ class TestICDManager
162
165
*/
163
166
static void AdvanceClockAndRunEventLoop (TestContext * ctx, Milliseconds64 time)
164
167
{
165
- ctx-> mMockClock .AdvanceMonotonic (time );
168
+ TestContext:: sMockClock .AdvanceMonotonic (time );
166
169
ctx->GetIOContext ().DriveIO ();
167
170
}
168
171
@@ -744,10 +747,10 @@ static const nlTest sTests[] = {
744
747
nlTestSuite cmSuite = {
745
748
" TestICDManager" ,
746
749
&sTests [0 ],
747
- TestContext::nlTestSetUpTestSuite ,
748
- TestContext::nlTestTearDownTestSuite ,
749
- TestContext::nlTestSetUp ,
750
- TestContext::nlTestTearDown ,
750
+ NL_TEST_WRAP_FUNCTION ( TestContext::SetUpTestSuite) ,
751
+ NL_TEST_WRAP_FUNCTION ( TestContext::TearDownTestSuite) ,
752
+ NL_TEST_WRAP_METHOD ( TestContext, SetUp) ,
753
+ NL_TEST_WRAP_METHOD ( TestContext, TearDown) ,
751
754
};
752
755
} // namespace
753
756
0 commit comments