Skip to content

Commit 890d6b0

Browse files
committed
Fix the crash error while running the unit-test
Signed-off-by: Lo,Chin-Ran <chin-ran.lo@nxp.com>
1 parent 9a51a1d commit 890d6b0

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/wifipaf/tests/TestWiFiPAFLayer.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class TestWiFiPAFLayer : public WiFiPAFLayer, private WiFiPAFLayerDelegate, publ
6363
void TearDown() override
6464
{
6565
mWiFiPAFTransport = nullptr;
66-
Shutdown(nullptr);
66+
Shutdown([](uint32_t id, WiFiPAF::WiFiPafRole role) {});
6767
}
6868

6969
CHIP_ERROR WiFiPAFMessageReceived(WiFiPAFSession & RxInfo, System::PacketBufferHandle && msg) override { return CHIP_NO_ERROR; }
@@ -115,7 +115,11 @@ TEST_F(TestWiFiPAFLayer, CheckWiFiPAFTransportCapabilitiesResponseMessage)
115115
TEST_F(TestWiFiPAFLayer, CheckPafSession)
116116
{
117117
// Add a session by giving node_id, discriminator
118-
WiFiPAF::WiFiPAFSession sessionInfo = { .nodeId = 0x1, .discriminator = 0xF00 };
118+
WiFiPAF::WiFiPAFSession sessionInfo = {
119+
.role = WiFiPAF::WiFiPafRole::kWiFiPafRole_Subscriber,
120+
.nodeId = 0x1,
121+
.discriminator = 0xF00 };
122+
119123
EXPECT_EQ(AddPafSession(PafInfoAccess::kAccNodeInfo, sessionInfo), CHIP_NO_ERROR);
120124

121125
// Get the session info by giving node_id
@@ -135,10 +139,16 @@ TEST_F(TestWiFiPAFLayer, CheckPafSession)
135139

136140
// Add a new session, but no space
137141
sessionInfo.id = 0x2;
142+
EXPECT_EQ(AddPafSession(PafInfoAccess::kAccSessionId, sessionInfo), CHIP_NO_ERROR);
143+
144+
// Add a new session, but no space
145+
sessionInfo.id = 0x3;
138146
EXPECT_EQ(AddPafSession(PafInfoAccess::kAccSessionId, sessionInfo), CHIP_ERROR_PROVIDER_LIST_EXHAUSTED);
139147

140148
sessionInfo.id = 0x1;
141149
EXPECT_EQ(RmPafSession(PafInfoAccess::kAccSessionId, sessionInfo), CHIP_NO_ERROR);
150+
sessionInfo.id = 0x2;
151+
EXPECT_EQ(RmPafSession(PafInfoAccess::kAccSessionId, sessionInfo), CHIP_NO_ERROR);
142152
}
143153

144154
TEST_F(TestWiFiPAFLayer, CheckNewEndpoint)

0 commit comments

Comments
 (0)