Skip to content

Commit 38806bd

Browse files
committed
Made context a non-pointer which is created/destroyed implicitly when each test case is run.
1 parent 6bcbcb5 commit 38806bd

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/transport/tests/TestSessionManager.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,12 @@ class TestSessMgrCallback : public SessionMessageDelegate
119119

120120
class TestSessionManager : public ::testing::Test
121121
{
122-
public:
123-
static void SetUpTestSuite() { ASSERT_EQ(mContext.Init(), CHIP_NO_ERROR); }
124-
static void TearDownTestSuite() { mContext.Shutdown(); }
125-
126122
protected:
127-
static TestContext mContext;
123+
void SetUp() { ASSERT_EQ(mContext.Init(), CHIP_NO_ERROR); }
124+
void TearDown() { mContext.Shutdown(); }
125+
126+
TestContext mContext;
128127
};
129-
TestContext TestSessionManager::mContext;
130128

131129
TEST_F(TestSessionManager, CheckSimpleInitTest)
132130
{

src/transport/tests/TestSessionManagerDispatch.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -549,14 +549,12 @@ CHIP_ERROR InjectGroupSessionWithTestKey(SessionHolder & sessionHolder, MessageT
549549

550550
class TestSessionManagerDispatch : public ::testing::Test
551551
{
552-
public:
553-
static void SetUpTestSuite() { ASSERT_EQ(mContext.Init(), CHIP_NO_ERROR); }
554-
static void TearDownTestSuite() { mContext.Shutdown(); }
555-
556552
protected:
557-
static TestContext mContext;
553+
void SetUp() { ASSERT_EQ(mContext.Init(), CHIP_NO_ERROR); }
554+
void TearDown() { mContext.Shutdown(); }
555+
556+
TestContext mContext;
558557
};
559-
TestContext TestSessionManagerDispatch::mContext;
560558

561559
TEST_F(TestSessionManagerDispatch, TestSessionManagerDispatch)
562560
{

0 commit comments

Comments
 (0)