Skip to content

Commit 69cdf7f

Browse files
committed
Rename test context base classes
They are now called AppTestFixture, MessagingTestFixture, UDPMessagingTestFixture and LoopbackMessagingTestFixture.
1 parent 99823f9 commit 69cdf7f

39 files changed

+158
-157
lines changed

src/app/tests/AppTestContext.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,25 @@ chip::Access::AccessControl gPermissiveAccessControl;
3838
namespace chip {
3939
namespace Test {
4040

41-
void AppContext::SetUpTestSuite()
41+
void AppTestFixture::SetUpTestSuite()
4242
{
4343
CHIP_ERROR err = CHIP_NO_ERROR;
44-
LoopbackMessagingContext::SetUpTestSuite();
44+
LoopbackMessagingTestFixture::SetUpTestSuite();
4545
// TODO: use ASSERT_EQ, once transition to pw_unit_test is complete
4646
VerifyOrDieWithMsg((err = chip::DeviceLayer::PlatformMgr().InitChipStack()) == CHIP_NO_ERROR, AppServer,
4747
"Init CHIP stack failed: %" CHIP_ERROR_FORMAT, err.Format());
4848
}
4949

50-
void AppContext::TearDownTestSuite()
50+
void AppTestFixture::TearDownTestSuite()
5151
{
5252
chip::DeviceLayer::PlatformMgr().Shutdown();
53-
LoopbackMessagingContext::TearDownTestSuite();
53+
LoopbackMessagingTestFixture::TearDownTestSuite();
5454
}
5555

56-
void AppContext::SetUp()
56+
void AppTestFixture::SetUp()
5757
{
5858
CHIP_ERROR err = CHIP_NO_ERROR;
59-
LoopbackMessagingContext::SetUp();
59+
LoopbackMessagingTestFixture::SetUp();
6060
// TODO: use ASSERT_EQ, once transition to pw_unit_test is complete
6161
VerifyOrDieWithMsg((err = app::InteractionModelEngine::GetInstance()->Init(&GetExchangeManager(), &GetFabricTable(),
6262
app::reporting::GetDefaultReportScheduler())) ==
@@ -68,12 +68,12 @@ void AppContext::SetUp()
6868
AppServer, "Init AccessControl failed: %" CHIP_ERROR_FORMAT, err.Format());
6969
}
7070

71-
void AppContext::TearDown()
71+
void AppTestFixture::TearDown()
7272
{
7373
Access::GetAccessControl().Finish();
7474
Access::ResetAccessControlToDefault();
7575
chip::app::InteractionModelEngine::GetInstance()->Shutdown();
76-
LoopbackMessagingContext::TearDown();
76+
LoopbackMessagingTestFixture::TearDown();
7777
}
7878

7979
} // namespace Test

src/app/tests/AppTestContext.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Test {
2424
* @brief The context of test cases for messaging layer. It wil initialize network layer and system layer, and create
2525
* two secure sessions, connected with each other. Exchanges can be created for each secure session.
2626
*/
27-
class AppContext : public LoopbackMessagingContext
27+
class AppTestFixture : public LoopbackMessagingTestFixture
2828
{
2929
public:
3030
// Performs shared setup for all tests in the test suite

src/app/tests/TestAclAttribute.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ class TestDeviceTypeResolver : public AccessControl::DeviceTypeResolver
7777
bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) override { return false; }
7878
} gDeviceTypeResolver;
7979

80-
class TestAccessContext : public chip::Test::AppContext
80+
class TestAccessContext : public chip::Test::AppTestFixture
8181
{
8282
public:
8383
// Performs setup for each individual test in the test suite
8484
void SetUp() override
8585
{
86-
chip::Test::AppContext::SetUp();
86+
chip::Test::AppTestFixture::SetUp();
8787
Access::GetAccessControl().Finish();
8888
Access::GetAccessControl().Init(GetTestAccessControlDelegate(), gDeviceTypeResolver);
8989
}

src/app/tests/TestAclEvent.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class TestDeviceTypeResolver : public AccessControl::DeviceTypeResolver
8282
bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) override { return false; }
8383
} gDeviceTypeResolver;
8484

85-
class TestContext : public chip::Test::AppContext
85+
class TestContext : public chip::Test::AppTestFixture
8686
{
8787
public:
8888
// Performs setup for each individual test in the test suite
@@ -94,7 +94,7 @@ class TestContext : public chip::Test::AppContext
9494
{ &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical },
9595
};
9696

97-
chip::Test::AppContext::SetUp();
97+
chip::Test::AppTestFixture::SetUp();
9898

9999
CHIP_ERROR err = CHIP_NO_ERROR;
100100
// TODO: use ASSERT_EQ, once transition to pw_unit_test is complete
@@ -111,7 +111,7 @@ class TestContext : public chip::Test::AppContext
111111
void TearDown() override
112112
{
113113
chip::app::EventManagement::DestroyEventManagement();
114-
chip::Test::AppContext::TearDown();
114+
chip::Test::AppTestFixture::TearDown();
115115
}
116116

117117
private:

src/app/tests/TestBufferedReadCallback.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <nlunit-test.h>
3232
#include <vector>
3333

34-
using TestContext = chip::Test::AppContext;
34+
using TestContext = chip::Test::AppTestFixture;
3535
using namespace chip::app;
3636
using namespace chip;
3737

src/app/tests/TestClusterStateCache.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <string.h>
3737
#include <vector>
3838

39-
using TestContext = chip::Test::AppContext;
39+
using TestContext = chip::Test::AppTestFixture;
4040
using namespace chip::app;
4141
using namespace chip;
4242

src/app/tests/TestCommandInteraction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
#include <nlunit-test.h>
4949

50-
using TestContext = chip::Test::AppContext;
50+
using TestContext = chip::Test::AppTestFixture;
5151
using namespace chip::Protocols;
5252

5353
namespace {

src/app/tests/TestEventLogging.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static uint8_t gInfoEventBuffer[120];
6060
static uint8_t gCritEventBuffer[120];
6161
static chip::app::CircularEventBuffer gCircularEventBuffer[3];
6262

63-
class TestContext : public chip::Test::AppContext
63+
class TestContext : public chip::Test::AppTestFixture
6464
{
6565
public:
6666
// Performs setup for each individual test in the test suite
@@ -72,7 +72,7 @@ class TestContext : public chip::Test::AppContext
7272
{ &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical },
7373
};
7474

75-
chip::Test::AppContext::SetUp();
75+
chip::Test::AppTestFixture::SetUp();
7676

7777
CHIP_ERROR err = CHIP_NO_ERROR;
7878
// TODO: use ASSERT_EQ, once transition to pw_unit_test is complete
@@ -86,7 +86,7 @@ class TestContext : public chip::Test::AppContext
8686
void TearDown() override
8787
{
8888
chip::app::EventManagement::DestroyEventManagement();
89-
chip::Test::AppContext::TearDown();
89+
chip::Test::AppTestFixture::TearDown();
9090
}
9191

9292
private:

src/app/tests/TestEventLoggingNoUTCTime.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,21 @@ class MockClock : public chip::System::Clock::ClockBase
8080
chip::System::Clock::ClockBase & mRealClock;
8181
};
8282

83-
class TestContext : public chip::Test::AppContext
83+
class TestContext : public chip::Test::AppTestFixture
8484
{
8585
public:
8686
// Performs shared setup for all tests in the test suite
8787
static void SetUpTestSuite()
8888
{
89-
chip::Test::AppContext::SetUpTestSuite();
89+
chip::Test::AppTestFixture::SetUpTestSuite();
9090
sClock.Emplace(chip::System::SystemClock());
9191
}
9292

9393
// Performs shared teardown for all tests in the test suite
9494
static void TearDownTestSuite()
9595
{
9696
sClock.ClearValue();
97-
chip::Test::AppContext::TearDownTestSuite();
97+
chip::Test::AppTestFixture::TearDownTestSuite();
9898
}
9999

100100
// Performs setup for each individual test in the test suite
@@ -106,7 +106,7 @@ class TestContext : public chip::Test::AppContext
106106
{ &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical },
107107
};
108108

109-
chip::Test::AppContext::SetUp();
109+
chip::Test::AppTestFixture::SetUp();
110110

111111
CHIP_ERROR err = CHIP_NO_ERROR;
112112
// TODO: use ASSERT_EQ, once transition to pw_unit_test is complete
@@ -120,7 +120,7 @@ class TestContext : public chip::Test::AppContext
120120
void TearDown() override
121121
{
122122
chip::app::EventManagement::DestroyEventManagement();
123-
chip::Test::AppContext::TearDown();
123+
chip::Test::AppTestFixture::TearDown();
124124
}
125125

126126
private:

src/app/tests/TestEventOverflow.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static uint8_t gInfoEventBuffer[2048];
5252
static uint8_t gCritEventBuffer[2048];
5353
static chip::app::CircularEventBuffer gCircularEventBuffer[3];
5454

55-
class TestContext : public chip::Test::AppContext
55+
class TestContext : public chip::Test::AppTestFixture
5656
{
5757
public:
5858
// Performs setup for each individual test in the test suite
@@ -64,7 +64,7 @@ class TestContext : public chip::Test::AppContext
6464
{ &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical },
6565
};
6666

67-
chip::Test::AppContext::SetUp();
67+
chip::Test::AppTestFixture::SetUp();
6868

6969
CHIP_ERROR err = CHIP_NO_ERROR;
7070
// TODO: use ASSERT_EQ, once transition to pw_unit_test is complete
@@ -78,7 +78,7 @@ class TestContext : public chip::Test::AppContext
7878
void TearDown() override
7979
{
8080
chip::app::EventManagement::DestroyEventManagement();
81-
chip::Test::AppContext::TearDown();
81+
chip::Test::AppTestFixture::TearDown();
8282
}
8383

8484
private:

src/app/tests/TestFabricScopedEventLogging.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static uint8_t gInfoEventBuffer[128];
6060
static uint8_t gCritEventBuffer[128];
6161
static chip::app::CircularEventBuffer gCircularEventBuffer[3];
6262

63-
class TestContext : public chip::Test::AppContext
63+
class TestContext : public chip::Test::AppTestFixture
6464
{
6565
public:
6666
// Performs setup for each individual test in the test suite
@@ -72,7 +72,7 @@ class TestContext : public chip::Test::AppContext
7272
{ &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical },
7373
};
7474

75-
chip::Test::AppContext::SetUp();
75+
chip::Test::AppTestFixture::SetUp();
7676

7777
CHIP_ERROR err = CHIP_NO_ERROR;
7878
// TODO: use ASSERT_EQ, once transition to pw_unit_test is complete
@@ -86,7 +86,7 @@ class TestContext : public chip::Test::AppContext
8686
void TearDown() override
8787
{
8888
chip::app::EventManagement::DestroyEventManagement();
89-
chip::Test::AppContext::TearDown();
89+
chip::Test::AppTestFixture::TearDown();
9090
}
9191

9292
private:

src/app/tests/TestICDManager.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ class TestSubscriptionsInfoProvider : public SubscriptionsInfoProvider
9999
bool mHasPersistedSubscription = false;
100100
};
101101

102-
class TestContext : public chip::Test::AppContext
102+
class TestContext : public chip::Test::AppTestFixture
103103
{
104104
public:
105105
// Performs shared setup for all tests in the test suite
106106
static void SetUpTestSuite()
107107
{
108-
chip::Test::AppContext::SetUpTestSuite();
108+
chip::Test::AppTestFixture::SetUpTestSuite();
109109
DeviceLayer::SetSystemLayerForTesting(&GetSystemLayer());
110110
sRealClock = &chip::System::SystemClock();
111111
System::Clock::Internal::SetSystemClockForTesting(&sMockClock);
@@ -116,13 +116,13 @@ class TestContext : public chip::Test::AppContext
116116
{
117117
System::Clock::Internal::SetSystemClockForTesting(sRealClock);
118118
DeviceLayer::SetSystemLayerForTesting(nullptr);
119-
chip::Test::AppContext::TearDownTestSuite();
119+
chip::Test::AppTestFixture::TearDownTestSuite();
120120
}
121121

122122
// Performs setup for each individual test in the test suite
123123
void SetUp() override
124124
{
125-
chip::Test::AppContext::SetUp();
125+
chip::Test::AppTestFixture::SetUp();
126126
mICDManager.Init(&testStorage, &GetFabricTable(), &mKeystore, &GetExchangeManager(), &mSubInfoProvider);
127127
mICDManager.RegisterObserver(&mICDStateObserver);
128128
}
@@ -131,7 +131,7 @@ class TestContext : public chip::Test::AppContext
131131
void TearDown() override
132132
{
133133
mICDManager.Shutdown();
134-
chip::Test::AppContext::TearDown();
134+
chip::Test::AppTestFixture::TearDown();
135135
}
136136

137137
static System::Clock::Internal::MockClock sMockClock;

src/app/tests/TestInteractionModelEngine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
namespace {
5252

53-
using TestContext = chip::Test::AppContext;
53+
using TestContext = chip::Test::AppTestFixture;
5454

5555
class NullReadHandlerCallback : public chip::app::ReadHandler::ManagementCallback
5656
{

src/app/tests/TestReadInteraction.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ static chip::System::Clock::ClockBase * gRealClock;
7575
static chip::app::reporting::ReportSchedulerImpl * gReportScheduler;
7676
static bool sUsingSubSync = false;
7777

78-
class TestContext : public chip::Test::AppContext
78+
class TestContext : public chip::Test::AppTestFixture
7979
{
8080
public:
8181
// Performs shared setup for all tests in the test suite
8282
static void SetUpTestSuite()
8383
{
84-
chip::Test::AppContext::SetUpTestSuite();
84+
chip::Test::AppTestFixture::SetUpTestSuite();
8585
gRealClock = &chip::System::SystemClock();
8686
chip::System::Clock::Internal::SetSystemClockForTesting(&gMockClock);
8787

@@ -100,7 +100,7 @@ class TestContext : public chip::Test::AppContext
100100
static void TearDownTestSuite()
101101
{
102102
chip::System::Clock::Internal::SetSystemClockForTesting(gRealClock);
103-
chip::Test::AppContext::TearDownTestSuite();
103+
chip::Test::AppTestFixture::TearDownTestSuite();
104104
}
105105

106106
// Performs setup for each individual test in the test suite
@@ -112,7 +112,7 @@ class TestContext : public chip::Test::AppContext
112112
{ &gCritEventBuffer[0], sizeof(gCritEventBuffer), chip::app::PriorityLevel::Critical },
113113
};
114114

115-
chip::Test::AppContext::SetUp();
115+
chip::Test::AppTestFixture::SetUp();
116116

117117
// TODO: change to ASSERT_EQ, once transition to pw_unit_test is complete
118118
VerifyOrDie(mEventCounter.Init(0) == CHIP_NO_ERROR);
@@ -124,7 +124,7 @@ class TestContext : public chip::Test::AppContext
124124
void TearDown() override
125125
{
126126
chip::app::EventManagement::DestroyEventManagement();
127-
chip::Test::AppContext::TearDown();
127+
chip::Test::AppTestFixture::TearDown();
128128
}
129129

130130
protected:

src/app/tests/TestReportScheduler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
namespace {
2929

30-
using TestContext = chip::Test::AppContext;
30+
using TestContext = chip::Test::AppTestFixture;
3131

3232
class NullReadHandlerCallback : public chip::app::ReadHandler::ManagementCallback
3333
{

src/app/tests/TestReportingEngine.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include <cinttypes>
4141
#include <nlunit-test.h>
4242

43-
using TestContext = chip::Test::AppContext;
43+
using TestContext = chip::Test::AppTestFixture;
4444

4545
namespace chip {
4646

src/app/tests/TestTimedHandler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#include <nlunit-test.h>
3333

34-
using TestContext = chip::Test::AppContext;
34+
using TestContext = chip::Test::AppTestFixture;
3535

3636
namespace chip {
3737
namespace app {

src/app/tests/TestWriteInteraction.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ chip::TestPersistentStorageDelegate gTestStorage;
5151
chip::Crypto::DefaultSessionKeystore gSessionKeystore;
5252
chip::Credentials::GroupDataProviderImpl gGroupsProvider(kMaxGroupsPerFabric, kMaxGroupKeysPerFabric);
5353

54-
class TestContext : public chip::Test::AppContext
54+
class TestContext : public chip::Test::AppTestFixture
5555
{
5656
public:
5757
// Performs setup for each individual test in the test suite
5858
void SetUp() override
5959
{
60-
chip::Test::AppContext::SetUp();
60+
chip::Test::AppTestFixture::SetUp();
6161

6262
gTestStorage.ClearStorage();
6363
gGroupsProvider.SetStorageDelegate(&gTestStorage);
@@ -78,7 +78,7 @@ class TestContext : public chip::Test::AppContext
7878
chip::Credentials::GroupDataProvider * provider = chip::Credentials::GetGroupDataProvider();
7979
if (provider != nullptr)
8080
provider->Finish();
81-
chip::Test::AppContext::TearDown();
81+
chip::Test::AppTestFixture::TearDown();
8282
}
8383
};
8484

0 commit comments

Comments
 (0)