mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-27 02:40:40 +00:00
修复OpenHarmony-4.1-Release分支代码告警
Signed-off-by: 马昌友 <machangyou@huawei.com>
This commit is contained in:
parent
0eb51a8447
commit
a84a5c1bb2
@ -39,7 +39,7 @@ namespace EventFwk {
|
||||
class WifiServiceMonitor : public CommonEventSubscriber {
|
||||
public:
|
||||
explicit WifiServiceMonitor(const CommonEventSubscribeInfo &subscriberInfo);
|
||||
virtual ~WifiServiceMonitor(){}
|
||||
virtual ~WifiServiceMonitor() {}
|
||||
virtual void OnReceiveEvent(const CommonEventData &data);
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int32_t LnnIpcInit (void);
|
||||
int32_t LnnIpcInit(void);
|
||||
int32_t LnnIpcServerJoin(const char *pkgName, int32_t callingPid, void *addr, uint32_t addrTypeLen);
|
||||
int32_t LnnIpcServerLeave(const char *pkgName, int32_t callingPid, const char *networkId);
|
||||
int32_t LnnIpcGetAllOnlineNodeInfo(const char *pkgName, void **info, uint32_t infoTypeLen, int *infoNum);
|
||||
|
@ -51,7 +51,7 @@ typedef struct {
|
||||
|
||||
static LNNRequestInfo g_lnnRequestInfo;
|
||||
|
||||
int32_t LnnIpcInit (void)
|
||||
int32_t LnnIpcInit(void)
|
||||
{
|
||||
g_lnnRequestInfo.joinLNNRequestInfo = NULL;
|
||||
g_lnnRequestInfo.leaveLNNRequestInfo = NULL;
|
||||
|
@ -477,7 +477,6 @@ static void HbDifferentAccountEventHandler(const LnnEventBasicInfo *info)
|
||||
}
|
||||
const LnnMonitorHbStateChangedEvent *event = (const LnnMonitorHbStateChangedEvent *)info;
|
||||
SoftBusDifferentAccountState difAccountState = (SoftBusDifferentAccountState)event->status;
|
||||
// g_hbConditionState.accountState == difAccountState;
|
||||
if (difAccountState == LNN_EVENT_DIF_ACCOUNT_DEV_CHANGED) {
|
||||
HbConditionChanged(false);
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ static int32_t GetSameLaneDetectInfo(LaneDetectInfo *infoItem)
|
||||
case LANE_WLAN_2P4G:
|
||||
case LANE_WLAN_5G:
|
||||
if ((strncmp(infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.addr,
|
||||
item->linkInfo.wlanDetect.wlanInfo.connInfo.addr, MAX_SOCKET_ADDR_LEN) == 0) &&
|
||||
(infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.port ==
|
||||
item->linkInfo.wlanDetect.wlanInfo.connInfo.port)) {
|
||||
item->linkInfo.wlanDetect.wlanInfo.connInfo.addr, MAX_SOCKET_ADDR_LEN) == 0) &&
|
||||
(infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.port ==
|
||||
item->linkInfo.wlanDetect.wlanInfo.connInfo.port)) {
|
||||
infoItem->linkInfo.wlanDetect.wlanFd = item->linkInfo.wlanDetect.wlanFd;
|
||||
infoItem->laneDetectId = item->laneDetectId;
|
||||
ListTailInsert(&g_laneDetectList.list, &infoItem->node);
|
||||
@ -78,7 +78,7 @@ static int32_t GetSameLaneDetectInfo(LaneDetectInfo *infoItem)
|
||||
break;
|
||||
case LANE_BR:
|
||||
if ((strncmp(infoItem->linkInfo.brDetect.brInfo.brMac,
|
||||
item->linkInfo.brDetect.brInfo.brMac, BT_MAC_LEN) == 0)) {
|
||||
item->linkInfo.brDetect.brInfo.brMac, BT_MAC_LEN) == 0)) {
|
||||
infoItem->linkInfo.brDetect.brReqId = item->linkInfo.brDetect.brReqId;
|
||||
infoItem->laneDetectId = item->laneDetectId;
|
||||
ListTailInsert(&g_laneDetectList.list, &infoItem->node);
|
||||
@ -106,7 +106,7 @@ static int32_t ClientConnectTcp(LaneDetectInfo *infoItem)
|
||||
}
|
||||
};
|
||||
if (strncpy_s(option.socketOption.addr, MAX_SOCKET_ADDR_LEN,
|
||||
infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.addr, MAX_SOCKET_ADDR_LEN) != EOK) {
|
||||
infoItem->linkInfo.wlanDetect.wlanInfo.connInfo.addr, MAX_SOCKET_ADDR_LEN) != EOK) {
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
int32_t fd = ConnOpenClientSocket(&option, BIND_ADDR_ALL, true);
|
||||
@ -142,7 +142,7 @@ static int32_t GetLaneDetectInfoByWlanFd(uint32_t fd, LaneDetectInfo *infoItem)
|
||||
LIST_FOR_EACH_ENTRY_SAFE(item, next, &g_laneDetectList.list, LaneDetectInfo, node) {
|
||||
if (item->linkInfo.wlanDetect.wlanFd == fd) {
|
||||
if (memcpy_s(infoItem, sizeof(LaneDetectInfo), item,
|
||||
sizeof(LaneDetectInfo)) != EOK) {
|
||||
sizeof(LaneDetectInfo)) != EOK) {
|
||||
SoftBusMutexUnlock(&g_laneDetectList.lock);
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
@ -191,7 +191,7 @@ static int32_t WlanDetectReliability(uint32_t lnnReqId, const LaneLinkInfo *lane
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
if (memcpy_s(&(infoItem->linkInfo.wlanDetect.wlanInfo), sizeof(WlanLinkInfo),
|
||||
&(laneInfo->linkInfo.wlan), sizeof(WlanLinkInfo)) != EOK) {
|
||||
&(laneInfo->linkInfo.wlan), sizeof(WlanLinkInfo)) != EOK) {
|
||||
SoftBusFree(infoItem);
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
@ -279,7 +279,7 @@ static int32_t NotifyWlanDetectResult(LaneDetectInfo *requestItem, bool isSendSu
|
||||
(void)memset_s(&laneInfo, sizeof(LaneLinkInfo), 0, sizeof(LaneLinkInfo));
|
||||
laneInfo.type = item->type;
|
||||
if (memcpy_s(&(laneInfo.linkInfo.wlan), sizeof(WlanLinkInfo),
|
||||
&(item->linkInfo.wlanDetect.wlanInfo), sizeof(WlanLinkInfo)) != EOK) {
|
||||
&(item->linkInfo.wlanDetect.wlanInfo), sizeof(WlanLinkInfo)) != EOK) {
|
||||
LNN_LOGE(LNN_LANE, "memcpy linkinfo failed, lnnReqId=%{public}u", item->lnnReqId);
|
||||
ListDelete(&item->node);
|
||||
SoftBusFree(item);
|
||||
|
@ -321,7 +321,7 @@ static int32_t AllocLane(uint32_t laneId, const LaneRequestOption *request, cons
|
||||
}
|
||||
recommendLinkList->linkTypeNum = 0;
|
||||
if (SelectExpectLanesByQos((const char *)transRequest->networkId, &selectParam,
|
||||
recommendLinkList) != SOFTBUS_OK) {
|
||||
recommendLinkList) != SOFTBUS_OK) {
|
||||
SoftBusFree(recommendLinkList);
|
||||
LNN_LOGE(LNN_LANE, "selectExpectLanesByQos fail, laneId=%{public}u", laneId);
|
||||
return SOFTBUS_ERR;
|
||||
|
@ -53,7 +53,7 @@ static uint32_t ConvertMsgToCapability(uint32_t *capability, const uint8_t *msg,
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
for (uint32_t i = 0; i < BITLEN; i++) {
|
||||
*capability = *capability | (*(msg + i) << BITS*i);
|
||||
*capability = *capability | (*(msg + i) << (BITS * i));
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -285,18 +285,18 @@ int32_t LnnEncryptDataByHuks(const struct HksBlob *keyAlias, const struct HksBlo
|
||||
struct HksBlob cipherText = {inData->size, cipher};
|
||||
if (UpdateLoopFinishByHuks(&handleEncrypt, g_encryptParamSet, inData, &cipherText) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_LEDGER, "huks encrypt data update and finish fail");
|
||||
(void)memset_s(cipher, sizeof(cipher), 0x0, sizeof(cipher));
|
||||
(void)memset_s(cipher, inData->size, 0x0, inData->size);
|
||||
SoftBusFree(cipher);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
outData->size = cipherText.size;
|
||||
if (memcpy_s(outData->data, cipherText.size, cipherText.data, cipherText.size) != EOK) {
|
||||
LNN_LOGE(LNN_LEDGER, "huks memcpy_s encrypt data fail");
|
||||
(void)memset_s(cipher, sizeof(cipher), 0x0, sizeof(cipher));
|
||||
(void)memset_s(cipher, inData->size, 0x0, inData->size);
|
||||
SoftBusFree(cipher);
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
(void)memset_s(cipher, sizeof(cipher), 0x0, sizeof(cipher));
|
||||
(void)memset_s(cipher, inData->size, 0x0, inData->size);
|
||||
SoftBusFree(cipher);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
@ -323,18 +323,18 @@ int32_t LnnDecryptDataByHuks(const struct HksBlob *keyAlias, const struct HksBlo
|
||||
struct HksBlob plainText = {inData->size, plain};
|
||||
if (UpdateLoopFinishByHuks(&handleDecrypt, g_decryptParamSet, inData, &plainText) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_LEDGER, "huks decrypt data update and finish fail");
|
||||
(void)memset_s(plain, sizeof(plain), 0x0, sizeof(plain));
|
||||
(void)memset_s(plain, inData->size, 0x0, inData->size);
|
||||
SoftBusFree(plain);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
outData->size = plainText.size;
|
||||
if (memcpy_s(outData->data, plainText.size, plainText.data, plainText.size) != EOK) {
|
||||
LNN_LOGE(LNN_LEDGER, "huks memcpy_s decrypt data fail");
|
||||
(void)memset_s(plain, sizeof(plain), 0x0, sizeof(plain));
|
||||
(void)memset_s(plain, inData->size, 0x0, inData->size);
|
||||
SoftBusFree(plain);
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
(void)memset_s(plain, sizeof(plain), 0x0, sizeof(plain));
|
||||
(void)memset_s(plain, inData->size, 0x0, inData->size);
|
||||
SoftBusFree(plain);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
@ -1321,7 +1321,7 @@ static void MergeLnnInfo(const NodeInfo *oldInfo, NodeInfo *info)
|
||||
}
|
||||
if (oldInfo->authChannelId[i][AUTH_AS_CLIENT_SIDE] != 0 ||
|
||||
oldInfo->authChannelId[i][AUTH_AS_SERVER_SIDE] != 0 || info->authChannelId[i][AUTH_AS_CLIENT_SIDE] != 0 ||
|
||||
info->authChannelId[i][AUTH_AS_SERVER_SIDE] != 0 ) {
|
||||
info->authChannelId[i][AUTH_AS_SERVER_SIDE] != 0) {
|
||||
LNN_LOGD(LNN_LEDGER,
|
||||
"Merge authChannelId. authChannelId:%{public}d|%{public}d->%{public}d|%{public}d, addrType=%{public}d",
|
||||
oldInfo->authChannelId[i][AUTH_AS_CLIENT_SIDE], oldInfo->authChannelId[i][AUTH_AS_SERVER_SIDE],
|
||||
@ -1618,7 +1618,7 @@ static void BleDirectlyOnlineProc(NodeInfo *info)
|
||||
LNN_LOGE(LNN_LEDGER, "strcpy_s networkId fail");
|
||||
return;
|
||||
}
|
||||
if(LnnSaveRemoteDeviceInfo(&deviceInfo) != SOFTBUS_OK) {
|
||||
if (LnnSaveRemoteDeviceInfo(&deviceInfo) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_LEDGER, "save remote devInfo fail");
|
||||
return;
|
||||
}
|
||||
|
@ -835,7 +835,7 @@ HWTEST_F(AuthOtherTest, FSM_MSG_TYPE_TO_STR_TEST_001, TestSize.Level1)
|
||||
EXPECT_EQ(ret, str);
|
||||
type = FSM_MSG_RECV_DEVICE_ID;
|
||||
ret = FsmMsgTypeToStr(type);
|
||||
const char *str1= "RECV_DEVICE_ID";
|
||||
const char *str1 = "RECV_DEVICE_ID";
|
||||
EXPECT_EQ(ret, str1);
|
||||
}
|
||||
|
||||
@ -915,7 +915,7 @@ HWTEST_F(AuthOtherTest, AUTH_DEVICE_GET_PREFER_CONN_INFO_TEST_001, TestSize.Leve
|
||||
ret = AuthDeviceGetPreferConnInfo(NULL, connInfo);
|
||||
connInfo->type = AUTH_LINK_TYPE_BLE;
|
||||
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
|
||||
SoftBusFree(connInfo);
|
||||
SoftBusFree(connInfo);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -105,28 +105,6 @@ HWTEST_F(LNNTransLaneMockTest, LNN_TRANS_LANE_002, TestSize.Level1)
|
||||
EXPECT_CALL(laneMock, SelectLane).WillOnce(Return(SOFTBUS_OK));
|
||||
int32_t ret = transObj->AllocLane(laneId, (const LaneRequestOption *)&request, nullptr);
|
||||
EXPECT_TRUE(ret != SOFTBUS_OK);
|
||||
/*
|
||||
auto laneSelect = [](LaneLinkType **list, uint32_t *num) {
|
||||
uint32_t laneNum = 2; // means two phy-channels are available
|
||||
*list = (LaneLinkType *)SoftBusMalloc(sizeof(LaneLinkType) * laneNum);
|
||||
EXPECT_TRUE(*list != nullptr);
|
||||
(*list)[0] = LANE_P2P;
|
||||
(*list)[1] = LANE_WLAN_5G;
|
||||
*num = laneNum;
|
||||
};
|
||||
auto linkFail = [](const LaneLinkCb *cb) { cb->OnLaneLinkFail(1, SOFTBUS_ERR); };
|
||||
EXPECT_CALL(laneMock, SelectLane)
|
||||
.WillOnce(DoAll(WithArgs<2, 3>(laneSelect), Return(SOFTBUS_OK)));
|
||||
EXPECT_CALL(laneMock, BuildLink)
|
||||
.WillRepeatedly(DoAll(WithArg<2>(linkFail), Return(SOFTBUS_OK)));
|
||||
ILaneListener listener = {
|
||||
.OnLaneRequestSuccess = LaneRequestSuccess,
|
||||
.OnLaneRequestFail = LaneRequestFail,
|
||||
.OnLaneStateChange = LaneStateChange,
|
||||
};
|
||||
ret = transObj->AllocLane(laneId, (const LaneRequestOption *)&request, &listener);
|
||||
EXPECT_EQ(ret, SOFTBUS_OK);
|
||||
*/
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200)); // delay 200ms for looper completion.
|
||||
transObj->Deinit();
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ HWTEST_F(LNNLaneLinkTest, LNN_LANE_LINK_002, TestSize.Level1)
|
||||
uint64_t remote = 1 << 14;
|
||||
LinkRequest *request = (LinkRequest *)SoftBusCalloc(sizeof(LinkRequest));
|
||||
if (request == NULL) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
request->pid = 1024;
|
||||
@ -203,7 +203,7 @@ HWTEST_F(LNNLaneLinkTest, LNN_LANE_LINK_003, TestSize.Level1)
|
||||
uint32_t laneLinkReqId = 1;
|
||||
LinkRequest *request = (LinkRequest *)SoftBusCalloc(sizeof(LinkRequest));
|
||||
if (request == NULL) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
request->pid = 1024;
|
||||
request->networkDelegate = false;
|
||||
@ -246,7 +246,7 @@ HWTEST_F(LNNLaneLinkTest, LNN_LANE_LINK_004, TestSize.Level1)
|
||||
{
|
||||
LinkRequest *request = (LinkRequest *)SoftBusCalloc(sizeof(LinkRequest));
|
||||
if (request == NULL) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
request->pid = 1024;
|
||||
@ -314,7 +314,7 @@ HWTEST_F(LNNLaneLinkTest, LNN_LANE_LINK_006, TestSize.Level1)
|
||||
};
|
||||
LinkRequest *request = (LinkRequest *)SoftBusCalloc(sizeof(LinkRequest));
|
||||
if (request == NULL) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
request->pid = 1024;
|
||||
|
@ -265,7 +265,8 @@ public:
|
||||
MOCK_METHOD1(LnnSendJoinRequestToConnFsm, int32_t (LnnConnectionFsm *));
|
||||
MOCK_METHOD3(LnnNotifyJoinResult, void (ConnectionAddr *, const char *, int32_t));
|
||||
MOCK_METHOD1(LnnDestroyConnectionFsm, void (LnnConnectionFsm *));
|
||||
MOCK_METHOD3(LnnCreateConnectionFsm, LnnConnectionFsm * (const ConnectionAddr *target, const char *pkgName, bool isNeedConnect));
|
||||
MOCK_METHOD3(LnnCreateConnectionFsm, LnnConnectionFsm * (const ConnectionAddr *target,
|
||||
const char *pkgName, bool isNeedConnect));
|
||||
MOCK_METHOD1(LnnStartConnectionFsm, int32_t (LnnConnectionFsm *));
|
||||
MOCK_METHOD3(LnnNotifyMasterNodeChanged, void (bool, const char*, int32_t));
|
||||
MOCK_METHOD0(LnnInitFastOffline, int32_t ());
|
||||
|
@ -288,15 +288,9 @@ HWTEST_F(LNNNetBuilderMockTest, GET_CURRENT_CONNECT_TYPE_TEST_001, TestSize.Leve
|
||||
*/
|
||||
HWTEST_F(LNNNetBuilderMockTest, PROCESS_LEAVE_SPECIFIC_TEST_001, TestSize.Level1)
|
||||
{
|
||||
// EXPECT_TRUE(LnnInitBusCenterEvent() == SOFTBUS_OK);
|
||||
// EXPECT_TRUE(LnnInitNetBuilder() == SOFTBUS_OK);
|
||||
// void *para = reinterpret_cast<void *>(SoftBusMalloc(sizeof(SpecificLeaveMsgPara)));
|
||||
NiceMock<NetBuilderDepsInterfaceMock> NetBuilderMock;
|
||||
EXPECT_CALL(NetBuilderMock, LnnSendLeaveRequestToConnFsm(_)).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_TRUE(ProcessLeaveSpecific(nullptr) == SOFTBUS_INVALID_PARAM);
|
||||
// EXPECT_TRUE(ProcessLeaveSpecific(para) == SOFTBUS_OK);
|
||||
// LnnDeinitNetBuilder();
|
||||
// LnnDeinitBusCenterEvent();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -355,7 +349,6 @@ HWTEST_F(LNNNetBuilderMockTest, PROCESS_NODE_STATE_CHANGED_TEST_001, TestSize.Le
|
||||
NiceMock<NetBuilderDepsInterfaceMock> NetBuilderMock;
|
||||
EXPECT_CALL(NetBuilderMock, SoftbusGetConfig(_, _, _)).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_TRUE(ProcessNodeStateChanged(nullptr) == SOFTBUS_INVALID_PARAM);
|
||||
// EXPECT_TRUE(LnnInitNetBuilder() == SOFTBUS_OK);
|
||||
EXPECT_TRUE(ProcessNodeStateChanged(para) == SOFTBUS_ERR);
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@ namespace OHOS {
|
||||
const int32_t GRUOP_NUM1 = 10;
|
||||
const int32_t GRUOP_NUM2 = 12;
|
||||
const int32_t GRUOP_NUM3 = 100;
|
||||
const int32_t GROUP_TYPE_POINT_TO_POINT = 256;
|
||||
const int32_t GROUP_VISIBILITY_INVALID = 26;
|
||||
char jsonChar = 'A';
|
||||
bool flage = false;
|
||||
bool is_return_device_num = false;
|
||||
@ -183,8 +185,8 @@ int32_t LnnHichainInterfaceMock::getRelatedGroups1(
|
||||
if (!JSON_AddStringToObject(obj, "groupName", "mygroup<256>E469") ||
|
||||
!JSON_AddStringToObject(obj, "groupId", "1D77EBFF0349B27EED57014DD7B2449A") ||
|
||||
!JSON_AddStringToObject(obj, "groupOwner", "com.hhhs.secueity") ||
|
||||
!JSON_AddInt32ToObject(obj, "groupType", 256) ||
|
||||
!JSON_AddInt32ToObject(obj, "groupVisibility", 26)) {
|
||||
!JSON_AddInt32ToObject(obj, "groupType", GROUP_TYPE_POINT_TO_POINT) ||
|
||||
!JSON_AddInt32ToObject(obj, "groupVisibility", GROUP_VISIBILITY_INVALID)) {
|
||||
JSON_Delete(obj);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
@ -196,7 +198,7 @@ int32_t LnnHichainInterfaceMock::getRelatedGroups1(
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
int32_t LnnHichainInterfaceMock::getTrustedDevices(
|
||||
int32_t osAccountId, const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum)
|
||||
int32_t osAccountId, const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum)
|
||||
{
|
||||
(void)osAccountId;
|
||||
(void)appId;
|
||||
@ -223,7 +225,7 @@ int32_t LnnHichainInterfaceMock::getTrustedDevices(
|
||||
}
|
||||
|
||||
int32_t LnnHichainInterfaceMock::getTrustedDevices1(
|
||||
int32_t osAccountId, const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum)
|
||||
int32_t osAccountId, const char *appId, const char *groupId, char **returnDevInfoVec, uint32_t *deviceNum)
|
||||
{
|
||||
(void)osAccountId;
|
||||
(void)appId;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "bus_center_decision_center.h"
|
||||
#include "message_handler.h"
|
||||
#include "softbus_conn_interface.h"
|
||||
#include <stdbool.h>
|
||||
#include "bus_center_manager.h"
|
||||
#include "lnn_distributed_net_ledger.h"
|
||||
#include "lnn_net_builder.h"
|
||||
@ -66,9 +65,9 @@ HWTEST_F(BusCenterDecisionTest, BusCenterDecisionTest001, TestSize.Level0)
|
||||
ConnectOption option;
|
||||
memset_s(&option, sizeof(ConnectOption), 0, sizeof(ConnectOption));
|
||||
option.type = CONNECT_BR;
|
||||
LnnDCReportConnectException(&option,1);
|
||||
LnnDCReportConnectException(&option, 1);
|
||||
option.type = CONNECT_P2P;
|
||||
LnnDCReportConnectException(&option,1);
|
||||
LnnDCReportConnectException(&option, 1);
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +394,9 @@ HWTEST_F(HeartBeatFSMTest, ProcessLostHeartbeatTest_01, TestSize.Level1)
|
||||
int32_t ret = ProcessLostHeartbeat(nullptr, CONNECTION_ADDR_BLE, false);
|
||||
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
|
||||
EXPECT_CALL(distriLedgerMock, LnnGetOnlineStateById).WillOnce(Return(false)).WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(lnnNetLedgerMock, LnnGetRemoteNodeInfoById).WillOnce(Return(SOFTBUS_ERR)).WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(lnnNetLedgerMock, LnnGetRemoteNodeInfoById)
|
||||
.WillOnce(Return(SOFTBUS_ERR))
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
ret = ProcessLostHeartbeat(TEST_NETWORK_ID, CONNECTION_ADDR_BLE, false);
|
||||
EXPECT_TRUE(ret == SOFTBUS_OK);
|
||||
ret = ProcessLostHeartbeat(TEST_NETWORK_ID, CONNECTION_ADDR_BR, false);
|
||||
@ -538,8 +540,6 @@ HWTEST_F(HeartBeatFSMTest, LnnPostNextSendOnceMsgToHbFsmTest_01, TestSize.Level1
|
||||
EXPECT_TRUE(ret == SOFTBUS_ERR);
|
||||
ret = LnnPostSendEndMsgToHbFsm(nullptr, custData, TEST_TIME1);
|
||||
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
|
||||
// ret = LnnPostSendEndMsgToHbFsm(hbFsm, custData, TEST_TIME1);
|
||||
// EXPECT_TRUE(ret == SOFTBUS_OK);
|
||||
ret = LnnPostStartMsgToHbFsm(nullptr, TEST_TIME1);
|
||||
EXPECT_TRUE(ret == SOFTBUS_INVALID_PARAM);
|
||||
ret = LnnPostStopMsgToHbFsm(nullptr, HEARTBEAT_TYPE_BLE_V1);
|
||||
|
@ -216,10 +216,6 @@ HWTEST_F(HeartBeatMediumTest, GetOnlineNodeByRecvInfoTest_01, TestSize.Level1)
|
||||
EXPECT_CALL(ledgerMock, LnnHasDiscoveryType).WillRepeatedly(Return(SOFTBUS_ERR));
|
||||
ret = HbGetOnlineNodeByRecvInfo(udidHash, CONNECTION_ADDR_BR, &nodeInfo, &hbResp);
|
||||
EXPECT_TRUE(ret == SOFTBUS_ERR);
|
||||
// ret = HbGetOnlineNodeByRecvInfo(TEST_UDID_HASH, CONNECTION_ADDR_BR, &nodeInfo, &hbResp);
|
||||
// EXPECT_TRUE(ret == SOFTBUS_OK);
|
||||
// ret = HbGetOnlineNodeByRecvInfo(TEST_UDID_HASH, CONNECTION_ADDR_WLAN, &nodeInfo, &hbResp);
|
||||
// EXPECT_TRUE(ret == SOFTBUS_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -82,7 +82,6 @@ static IRefreshCallback g_refreshCB = {
|
||||
.OnDiscoverResult = OnDiscoverResultTest
|
||||
};
|
||||
|
||||
// Device A:
|
||||
int main(void)
|
||||
{
|
||||
const char *pkgNameA = "pkgNameA.demo";
|
||||
@ -113,7 +112,6 @@ int main(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Device B:
|
||||
int main(void)
|
||||
{
|
||||
const char *pkgNameB = "pkgNameB.demo";
|
||||
|
@ -83,6 +83,7 @@ namespace OHOS {
|
||||
ShiftLNNGear(TEST_PKG_NAME1, callerId, networkId, &g_mode);
|
||||
if (callerId != nullptr) {
|
||||
free(callerId);
|
||||
callerId = nullptr;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user