mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-27 10:50:41 +00:00
fix key clear diff
Signed-off-by: wanghaoxu <wanghaoxu1@huawei.com>
This commit is contained in:
parent
16646b0180
commit
aab8fbdd0d
@ -1264,6 +1264,23 @@ static void DumpRpaCipherKey(char *cipherKey, char *cipherIv, const char *peerIr
|
||||
AnonymizeFree(anonyIrk);
|
||||
}
|
||||
|
||||
static int32_t UpdateBroadcastCipherKey(const NodeInfo *info)
|
||||
{
|
||||
BroadcastCipherKey broadcastKey;
|
||||
(void)memset_s(&broadcastKey, sizeof(BroadcastCipherKey), 0, sizeof(BroadcastCipherKey));
|
||||
if (FillBroadcastCipherKey(&broadcastKey, info) != SOFTBUS_OK) {
|
||||
(void)memset_s(&broadcastKey, sizeof(BroadcastCipherKey), 0, sizeof(BroadcastCipherKey));
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
if (LnnUpdateLocalBroadcastCipherKey(&broadcastKey) != SOFTBUS_OK) {
|
||||
AUTH_LOGE(AUTH_FSM, "update local broadcast key failed");
|
||||
(void)memset_s(&broadcastKey, sizeof(BroadcastCipherKey), 0, sizeof(BroadcastCipherKey));
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
(void)memset_s(&broadcastKey, sizeof(BroadcastCipherKey), 0, sizeof(BroadcastCipherKey));
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static int32_t PackCipherRpaInfo(JsonObj *json, const NodeInfo *info)
|
||||
{
|
||||
char cipherKey[SESSION_KEY_STR_LEN] = {0};
|
||||
@ -1302,19 +1319,10 @@ static int32_t PackCipherRpaInfo(JsonObj *json, const NodeInfo *info)
|
||||
DumpRpaCipherKey(cipherKey, cipherIv, peerIrk, "pack broadcast cipher key");
|
||||
(void)memset_s(cipherKey, SESSION_KEY_STR_LEN, 0, SESSION_KEY_STR_LEN);
|
||||
(void)memset_s(peerIrk, LFINDER_IRK_STR_LEN, 0, LFINDER_IRK_STR_LEN);
|
||||
|
||||
BroadcastCipherKey broadcastKey;
|
||||
(void)memset_s(&broadcastKey, sizeof(BroadcastCipherKey), 0, sizeof(BroadcastCipherKey));
|
||||
if (FillBroadcastCipherKey(&broadcastKey, info) != SOFTBUS_OK) {
|
||||
(void)memset_s(&broadcastKey, sizeof(BroadcastCipherKey), 0, sizeof(BroadcastCipherKey));
|
||||
return SOFTBUS_ERR;
|
||||
int32_t ret = UpdateBroadcastCipherKey(info);
|
||||
if (ret != SOFTBUS_OK) {
|
||||
return ret;
|
||||
}
|
||||
if (LnnUpdateLocalBroadcastCipherKey(&broadcastKey) != SOFTBUS_OK) {
|
||||
AUTH_LOGE(AUTH_FSM, "update local broadcast key failed");
|
||||
(void)memset_s(&broadcastKey, sizeof(BroadcastCipherKey), 0, sizeof(BroadcastCipherKey));
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
(void)memset_s(&broadcastKey, sizeof(BroadcastCipherKey), 0, sizeof(BroadcastCipherKey));
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -633,7 +633,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfSync_006, TestSize.Level1)
|
||||
int32_t value = 3;
|
||||
uint64_t local = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint64_t remote = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint32_t localBle = 1 << BIT_BLE;
|
||||
uint32_t requestId = 1;
|
||||
|
||||
NiceMock<LaneDepsInterfaceMock> linkMock;
|
||||
@ -644,9 +643,8 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfSync_006, TestSize.Level1)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(local), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteNumU64Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM3>(remote), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, LnnGetLocalNumU32Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(localBle), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillOnce(Return(SOFTBUS_OK))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthDeviceCheckConnInfo).WillOnce(Return(false)).WillOnce(Return(false))
|
||||
.WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(linkMock, AuthGetPreferConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
@ -683,7 +681,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfSync_007, TestSize.Level1)
|
||||
int32_t value = 3;
|
||||
uint64_t local = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint64_t remote = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint32_t localBle = 1 << BIT_BLE;
|
||||
uint32_t requestId = 1;
|
||||
|
||||
NiceMock<LaneDepsInterfaceMock> linkMock;
|
||||
@ -694,9 +691,8 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfSync_007, TestSize.Level1)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(local), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteNumU64Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM3>(remote), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, LnnGetLocalNumU32Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(localBle), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillOnce(Return(SOFTBUS_OK))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthDeviceCheckConnInfo).WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(linkMock, AuthGetPreferConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(laneLinkMock, GetTransReqInfoByLaneReqId).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
@ -732,7 +728,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfSync_008, TestSize.Level1)
|
||||
int32_t value = 3;
|
||||
uint64_t local = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint64_t remote = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint32_t localBle = 1 << BIT_BLE;
|
||||
uint32_t requestId = 1;
|
||||
|
||||
NiceMock<LaneDepsInterfaceMock> linkMock;
|
||||
@ -743,9 +738,8 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfSync_008, TestSize.Level1)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(local), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteNumU64Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM3>(remote), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, LnnGetLocalNumU32Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(localBle), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillOnce(Return(SOFTBUS_OK))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthDeviceCheckConnInfo).WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(linkMock, AuthGetPreferConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(laneLinkMock, GetTransReqInfoByLaneReqId).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
@ -780,7 +774,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfSync_009, TestSize.Level1)
|
||||
int32_t value = 3;
|
||||
uint64_t local = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint64_t remote = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint32_t localBle = 1 << BIT_BLE;
|
||||
|
||||
NiceMock<LaneDepsInterfaceMock> linkMock;
|
||||
NiceMock<LaneLinkDepsInterfaceMock> laneLinkMock;
|
||||
@ -792,8 +785,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfSync_009, TestSize.Level1)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM3>(remote), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillOnce(Return(SOFTBUS_NOT_FIND))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, LnnGetLocalNumU32Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(localBle), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, AuthGetPreferConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(laneLinkMock, GetTransReqInfoByLaneReqId).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, GetWifiDirectManager).WillRepeatedly(Return(&g_manager));
|
||||
@ -888,6 +879,7 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_002, TestSize.Level1)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM3>(remote), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND))
|
||||
.WillOnce(Return(SOFTBUS_NOT_FIND)).WillOnce(Return(SOFTBUS_NOT_FIND))
|
||||
.WillOnce(Return(SOFTBUS_OK))
|
||||
.WillOnce(DoAll(SetArrayArgument<LANE_MOCK_PARAM3>(BRMAC, BRMAC + BT_MAC_LEN), Return(SOFTBUS_OK)))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, CheckActiveConnection).WillRepeatedly(Return(true));
|
||||
@ -901,7 +893,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_002, TestSize.Level1)
|
||||
EXPECT_CALL(laneLinkMock, TransProxyPipelineOpenChannel(requestId, _, _, NotNull()))
|
||||
.WillRepeatedly(laneLinkMock.ActionOfChannelOpenFailed);
|
||||
EXPECT_CALL(linkMock, GetWifiDirectManager).WillRepeatedly(Return(&g_manager));
|
||||
EXPECT_CALL(linkMock, AuthGetHmlConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthCloseConn).WillRepeatedly(Return());
|
||||
EXPECT_CALL(linkMock, AuthGetP2pConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
|
||||
@ -955,7 +946,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_003, TestSize.Level1)
|
||||
EXPECT_CALL(laneLinkMock, TransProxyPipelineOpenChannel(requestId, _, _, NotNull()))
|
||||
.WillRepeatedly(laneLinkMock.ActionOfChannelOpened);
|
||||
EXPECT_CALL(linkMock, GetWifiDirectManager).WillRepeatedly(Return(&g_manager));
|
||||
EXPECT_CALL(linkMock, AuthGetHmlConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(laneLinkMock, TransProxyPipelineCloseChannelDelay).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthGetP2pConnInfo).WillRepeatedly(Return(SOFTBUS_LANE_BUILD_LINK_FAIL));
|
||||
|
||||
@ -1010,7 +1000,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_004, TestSize.Level1)
|
||||
EXPECT_CALL(laneLinkMock, TransProxyPipelineOpenChannel(requestId, _, _, NotNull()))
|
||||
.WillRepeatedly(laneLinkMock.ActionOfChannelOpenFailed);
|
||||
EXPECT_CALL(linkMock, GetWifiDirectManager).WillRepeatedly(Return(&g_manager));
|
||||
EXPECT_CALL(linkMock, AuthGetHmlConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthCloseConn).WillRepeatedly(Return());
|
||||
EXPECT_CALL(linkMock, AuthGetP2pConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
|
||||
@ -1043,7 +1032,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_005, TestSize.Level1)
|
||||
int32_t value = 3;
|
||||
uint64_t local = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint64_t remote = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint32_t localBle = 1 << BIT_BLE;
|
||||
uint32_t requestId = 1;
|
||||
|
||||
NiceMock<LaneDepsInterfaceMock> linkMock;
|
||||
@ -1054,9 +1042,8 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_005, TestSize.Level1)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(local), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteNumU64Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM3>(remote), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, LnnGetLocalNumU32Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(localBle), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillOnce(Return(SOFTBUS_OK))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthDeviceCheckConnInfo).WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(linkMock, AuthGetPreferConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(laneLinkMock, GetTransReqInfoByLaneReqId).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
@ -1093,7 +1080,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_006, TestSize.Level1)
|
||||
int32_t value = 3;
|
||||
uint64_t local = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint64_t remote = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint32_t localBle = 1 << BIT_BLE;
|
||||
uint32_t requestId = 1;
|
||||
|
||||
NiceMock<LaneDepsInterfaceMock> linkMock;
|
||||
@ -1106,8 +1092,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_006, TestSize.Level1)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM3>(remote), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillOnce(Return(SOFTBUS_NOT_FIND))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, LnnGetLocalNumU32Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(localBle), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, AuthDeviceCheckConnInfo).WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(linkMock, AuthGetPreferConnInfo)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(connInfo), Return(SOFTBUS_OK)));
|
||||
@ -1145,7 +1129,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_007, TestSize.Level1)
|
||||
int32_t value = 3;
|
||||
uint64_t local = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint64_t remote = 1 << BIT_BLE_TRIGGER_CONNECTION;
|
||||
uint32_t localBle = 1 << BIT_BLE;
|
||||
uint32_t requestId = 1;
|
||||
|
||||
NiceMock<LaneDepsInterfaceMock> linkMock;
|
||||
@ -1156,9 +1139,8 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_007, TestSize.Level1)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(local), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteNumU64Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM3>(remote), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, LnnGetLocalNumU32Info)
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(localBle), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(linkMock, LnnGetRemoteStrInfo).WillOnce(Return(SOFTBUS_NOT_FIND)).WillOnce(Return(SOFTBUS_OK))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthDeviceCheckConnInfo).WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(linkMock, AuthGetPreferConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(laneLinkMock, GetTransReqInfoByLaneReqId).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
@ -1167,7 +1149,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetryOfAsync_007, TestSize.Level1)
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
g_manager.isNegotiateChannelNeeded = IsNegotiateChannelNeededTrue;
|
||||
EXPECT_CALL(linkMock, GetWifiDirectManager).WillRepeatedly(Return(&g_manager));
|
||||
EXPECT_CALL(linkMock, AuthGetHmlConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthGetP2pConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
|
||||
ret = LnnConnectP2p(&request, laneReqId, &g_linkCb);
|
||||
@ -1381,7 +1362,6 @@ HWTEST_F(LNNLaneLinkTest, GuideChannelRetry_004, TestSize.Level1)
|
||||
EXPECT_CALL(laneLinkMock, TransProxyPipelineGenRequestId).WillRepeatedly(Return(requestId));
|
||||
EXPECT_CALL(laneLinkMock, TransProxyPipelineOpenChannel).WillRepeatedly(Return(SOFTBUS_LANE_BUILD_LINK_FAIL));
|
||||
EXPECT_CALL(linkMock, GetWifiDirectManager).WillRepeatedly(Return(&g_manager));
|
||||
EXPECT_CALL(linkMock, AuthGetHmlConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(linkMock, AuthCloseConn).WillRepeatedly(Return());
|
||||
EXPECT_CALL(linkMock, AuthGetP2pConnInfo).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
|
||||
@ -1708,6 +1688,8 @@ HWTEST_F(LNNLaneLinkTest, GET_MAC_INFO_BY_LANE_ID_MOCK_TEST_002, TestSize.Level1
|
||||
{
|
||||
NiceMock<LaneDepsInterfaceMock> laneMock;
|
||||
NiceMock<LaneLinkDepsInterfaceMock> laneDepMock;
|
||||
int32_t ret = InitLaneLink();
|
||||
EXPECT_TRUE(ret == SOFTBUS_OK);
|
||||
LnnMacInfo macInfo;
|
||||
LaneResource resource = {
|
||||
.laneId = USEABLE_LANE_ID,
|
||||
@ -1715,12 +1697,11 @@ HWTEST_F(LNNLaneLinkTest, GET_MAC_INFO_BY_LANE_ID_MOCK_TEST_002, TestSize.Level1
|
||||
};
|
||||
EXPECT_EQ(strcpy_s(resource.link.linkInfo.wlan.connInfo.addr, MAX_SOCKET_ADDR_LEN, USEABLE_IP), EOK);
|
||||
memset_s(&macInfo, sizeof(LnnMacInfo), 0, sizeof(LnnMacInfo));
|
||||
EXPECT_CALL(laneDepMock, InitLaneLink).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(laneMock, GetWifiDirectManager).WillOnce(Return(NULL)).WillRepeatedly(Return(&manager));
|
||||
EXPECT_CALL(laneDepMock, FindLaneResourceByLaneId).WillOnce(Return(SOFTBUS_LANE_RESOURCE_NOT_FOUND))
|
||||
.WillRepeatedly(DoAll(SetArgPointee<LANE_MOCK_PARAM2>(resource), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(laneDepMock, DelLaneResourceByLaneId).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
int32_t ret = GetMacInfoByLaneId(USEABLE_LANE_ID, &macInfo);
|
||||
ret = GetMacInfoByLaneId(USEABLE_LANE_ID, &macInfo);
|
||||
EXPECT_EQ(ret, SOFTBUS_LANE_RESOURCE_NOT_FOUND);
|
||||
ret = GetMacInfoByLaneId(USEABLE_LANE_ID, &macInfo);
|
||||
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
|
||||
|
Loading…
Reference in New Issue
Block a user