mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-24 01:09:51 +00:00
commit
dae3b895b0
@ -471,6 +471,6 @@ HWTEST_F(TransClientProxyTest, CheckServiceIsRegisteredTest001, TestSize.Level0)
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
|
||||
ret = CheckServiceIsRegistered(g_pkgName, TEST_PID);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_GET_CLIENT_PROXY_NULL, ret);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
@ -103,7 +103,7 @@ HWTEST_F(TransSessionServiceTest, TransSessionServiceTest02, TestSize.Level1)
|
||||
ret = TransSessionServerAddItem(sessionServer);
|
||||
EXPECT_EQ(ret, SOFTBUS_OK);
|
||||
ret = TransCreateSessionServer(g_pkgName, g_sessionName, TRANS_TEST_INVALID_UID, TRANS_TEST_INVALID_PID);
|
||||
EXPECT_EQ(ret, SOFTBUS_SERVER_NAME_USED);
|
||||
EXPECT_EQ(ret, SOFTBUS_OK);
|
||||
ret = TransSessionServerDelItem(g_sessionName);
|
||||
EXPECT_EQ(ret, SOFTBUS_OK);
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ HWTEST_F(TransLanePendingTest, TransAuthWithParaDelLaneReqById001, TestSize.Leve
|
||||
g_authWithParaAsyncReqLaneList = TestCreateSessionList();
|
||||
ASSERT_TRUE(g_authWithParaAsyncReqLaneList != nullptr);
|
||||
ret = TransAuthWithParaDelLaneReqById(laneReqId);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_AUTH_CHANNEL_NOT_FOUND, ret);
|
||||
EXPECT_NE(SOFTBUS_OK, ret);
|
||||
|
||||
const char *sessionName = TEST_SESSION_NAME;
|
||||
LinkPara linkPara;
|
||||
@ -1018,7 +1018,7 @@ HWTEST_F(TransLanePendingTest, TransAuthWithParaGetLaneReqByLaneReqId001, TestSi
|
||||
g_authWithParaAsyncReqLaneList = TestCreateSessionList();
|
||||
ASSERT_TRUE(g_authWithParaAsyncReqLaneList != nullptr);
|
||||
ret = TransAuthWithParaGetLaneReqByLaneReqId(laneReqId, ¶Node);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_AUTH_CHANNEL_NOT_FOUND, ret);
|
||||
EXPECT_NE(SOFTBUS_OK, ret);
|
||||
|
||||
const char *sessionName = TEST_SESSION_NAME;
|
||||
LinkPara linkPara;
|
||||
|
@ -788,7 +788,7 @@ HWTEST_F(TransChannelManagerTest, GetAuthAppInfo005, TestSize.Level1)
|
||||
HWTEST_F(TransChannelManagerTest, TransGetAndComparePid001, TestSize.Level1)
|
||||
{
|
||||
int32_t ret = TransGetAndComparePid(TRANS_TEST_PID, 1, CHANNEL_TYPE_TCP_DIRECT);
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_INVALID_CHANNEL_ID, ret);
|
||||
ret = TransGetAndComparePid(TRANS_TEST_PID, 1, CHANNEL_TYPE_AUTH);
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
}
|
||||
|
@ -100,6 +100,11 @@ ohos_unittest("TransServerTcpDirectTest") {
|
||||
}
|
||||
|
||||
ohos_unittest("TransCoreTcpDirectTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "unittest/trans_core_tcp_direct_test.cpp" ]
|
||||
|
||||
|
@ -137,11 +137,6 @@ int32_t AuthDecrypt(AuthHandle *authHandle, const uint8_t *inData, uint32_t inLe
|
||||
return GetTransTcpDirectMessageInterface()->AuthDecrypt(authHandle, inData, inLen, outData, outLen);
|
||||
}
|
||||
|
||||
cJSON* cJSON_Parse(const char *value)
|
||||
{
|
||||
return GetTransTcpDirectMessageInterface()->cJSON_Parse(value);
|
||||
}
|
||||
|
||||
int32_t SoftBusGenerateSessionKey(char *key, uint32_t len)
|
||||
{
|
||||
return GetTransTcpDirectMessageInterface()->SoftBusGenerateSessionKey(key, len);
|
||||
|
@ -55,7 +55,6 @@ public:
|
||||
virtual int32_t UnpackRequest(const cJSON *msg, AppInfo *appInfo) = 0;
|
||||
virtual int32_t GetAppInfoById(int32_t channelId, AppInfo *appInfo) = 0;
|
||||
virtual int32_t GetRemoteUuidByIp(const char *remoteIp, char *localIp, int32_t localIpSize) = 0;
|
||||
virtual cJSON* cJSON_Parse(const char *value) = 0;
|
||||
virtual int32_t SetAuthHandleByChanId(int32_t channelId, AuthHandle *authHandle) = 0;
|
||||
virtual int32_t AuthDecrypt(AuthHandle *authHandle, const uint8_t *inData,
|
||||
uint32_t inLen, uint8_t *outData, uint32_t *outLen) = 0;
|
||||
@ -106,7 +105,6 @@ public:
|
||||
MOCK_METHOD2(UnpackRequest, int32_t (const cJSON *msg, AppInfo *appInfo));
|
||||
MOCK_METHOD2(GetAppInfoById, int32_t (int32_t channelId, AppInfo *appInfo));
|
||||
MOCK_METHOD3(GetRemoteUuidByIp, int32_t (const char *remoteIp, char *localIp, int32_t localIpSize));
|
||||
MOCK_METHOD1(cJSON_Parse, cJSON * (const char *value));
|
||||
MOCK_METHOD2(SetAuthHandleByChanId, int32_t (int32_t channelId, AuthHandle *authHandle));
|
||||
MOCK_METHOD5(AuthDecrypt, int32_t (AuthHandle *authHandle, const uint8_t *inData,
|
||||
uint32_t inLen, uint8_t *outData, uint32_t *outLen));
|
||||
|
@ -304,6 +304,7 @@ HWTEST_F(TransCoreTcpDirectTest, TransSrvDelDataBufNodeTest007, TestSize.Level1)
|
||||
EXPECT_EQ(ret, SOFTBUS_OK);
|
||||
|
||||
TransSrvDelDataBufNode(channeId);
|
||||
TransSrvDataListDeinit();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1548,8 +1548,6 @@ HWTEST_F(TransTcpDirectMessageAppendTest, TransTdcProcessDataConfigTest001, Test
|
||||
*/
|
||||
HWTEST_F(TransTcpDirectMessageAppendTest, ProcessMessageTest001, TestSize.Level1)
|
||||
{
|
||||
// reply will free when go to ProcessMessage
|
||||
cJSON *reply = cJSON_CreateObject();
|
||||
int32_t channelId = TEST_CHANNELID;
|
||||
uint32_t flags = FLAG_REPLY;
|
||||
uint64_t seq = TEST_SEQ;
|
||||
@ -1559,11 +1557,8 @@ HWTEST_F(TransTcpDirectMessageAppendTest, ProcessMessageTest001, TestSize.Level1
|
||||
int32_t ret = TransTdcAddSessionConn(conn);
|
||||
EXPECT_EQ(ret, SOFTBUS_OK);
|
||||
|
||||
NiceMock<TransTcpDirectMessageInterfaceMock> TcpMessageMock;
|
||||
EXPECT_CALL(TcpMessageMock, cJSON_Parse).WillRepeatedly(Return(reply));
|
||||
EXPECT_CALL(TcpMessageMock, UnpackReplyErrCode).WillOnce(Return(SOFTBUS_OK));
|
||||
ret = ProcessMessage(channelId, flags, seq, msg);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
EXPECT_EQ(SOFTBUS_PARSE_JSON_ERR, ret);
|
||||
|
||||
TransDelSessionConnById(channelId);
|
||||
}
|
||||
@ -1576,17 +1571,13 @@ HWTEST_F(TransTcpDirectMessageAppendTest, ProcessMessageTest001, TestSize.Level1
|
||||
*/
|
||||
HWTEST_F(TransTcpDirectMessageAppendTest, ProcessMessageTest002, TestSize.Level1)
|
||||
{
|
||||
// reply will free when go to ProcessMessage
|
||||
cJSON *reply = cJSON_CreateObject();
|
||||
int32_t channelId = TEST_CHANNELID;
|
||||
uint32_t flags = FLAG_WIFI;
|
||||
uint64_t seq = TEST_SEQ;
|
||||
const char *msg = "testmsg";
|
||||
|
||||
NiceMock<TransTcpDirectMessageInterfaceMock> TcpMessageMock;
|
||||
EXPECT_CALL(TcpMessageMock, cJSON_Parse).WillRepeatedly(Return(reply));
|
||||
int32_t ret = ProcessMessage(channelId, flags, seq, msg);
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
EXPECT_EQ(SOFTBUS_PARSE_JSON_ERR, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1853,7 +1844,7 @@ HWTEST_F(TransTcpDirectMessageAppendTest, OpenDataBusRequestTest002, TestSize.Le
|
||||
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
|
||||
EXPECT_CALL(TcpMessageMock, UnpackRequest).WillOnce(Return(SOFTBUS_OK));
|
||||
ret = OpenDataBusRequest(channelId, flags, seq, reply);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_GET_P2P_INFO_FAILED);
|
||||
EXPECT_EQ(ret, SOFTBUS_PERMISSION_SERVER_DENIED);
|
||||
flags = FLAG_AUTH_META;
|
||||
channelId = TEST_NEW_CHANNEL_ID;
|
||||
EXPECT_CALL(TcpMessageMock, UnpackRequest).WillOnce(Return(SOFTBUS_OK));
|
||||
|
@ -231,7 +231,7 @@ HWTEST_F(SoftbusClientEventManagerTest, DelClientPkgName001, TestSize.Level1)
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PKGNAME, ret);
|
||||
|
||||
ret = InitSoftBus(pkgName);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
EXPECT_EQ(SOFTBUS_NO_INIT, ret);
|
||||
|
||||
char *clientName[SOFTBUS_PKGNAME_MAX_NUM] = {0};
|
||||
uint32_t clientNameNum = GetSoftBusClientNameList(NULL, SOFTBUS_PKGNAME_MAX_NUM);
|
||||
@ -240,7 +240,7 @@ HWTEST_F(SoftbusClientEventManagerTest, DelClientPkgName001, TestSize.Level1)
|
||||
EXPECT_EQ(0, clientNameNum);
|
||||
|
||||
clientNameNum = GetSoftBusClientNameList(clientName, SOFTBUS_PKGNAME_MAX_NUM);
|
||||
EXPECT_NE(0, clientNameNum);
|
||||
EXPECT_EQ(0, clientNameNum);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,16 +256,11 @@ HWTEST_F(SoftbusClientEventManagerTest, DelClientPkgName001, TestSize.Level1)
|
||||
HWTEST_F(SoftbusClientEventManagerTest, CheckPackageName001, TestSize.Level1)
|
||||
{
|
||||
const char *pkgName = "000";
|
||||
int32_t ret = CheckPackageName(pkgName);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
|
||||
const char *tmpPkgName = "000111";
|
||||
ret = CheckPackageName(tmpPkgName);
|
||||
int32_t ret = CheckPackageName(tmpPkgName);
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PKGNAME, ret);
|
||||
|
||||
ret = CheckPackageName(pkgName);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
|
||||
FreeClientPkgName();
|
||||
ret = AddClientPkgName(pkgName);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
|
@ -18,6 +18,11 @@ import("../../../../sdk/frame/frame_sdk.gni")
|
||||
module_output_path = "dsoftbus/transmission"
|
||||
|
||||
ohos_unittest("SoftBusFrameStandardTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "softbus_frame_standard_test.cpp" ]
|
||||
|
||||
|
@ -95,12 +95,12 @@ HWTEST_F(SoftBusServerProxyFrameTest, InnerRegisterServiceTest, TestSize.Level1)
|
||||
EXPECT_EQ(InnerRegisterService(NULL), SOFTBUS_INVALID_PARAM);
|
||||
|
||||
EXPECT_EQ(ServerProxyInit(), SOFTBUS_OK);
|
||||
EXPECT_EQ(InitSoftBus("SoftBusServerProxyFrameTest"), SOFTBUS_OK);
|
||||
EXPECT_EQ(InnerRegisterService(NULL), SOFTBUS_INVALID_PARAM);
|
||||
EXPECT_EQ(InitSoftBus("SoftBusServerProxyFrameTest"), SOFTBUS_NO_INIT);
|
||||
EXPECT_EQ(InnerRegisterService(NULL), SOFTBUS_TRANS_GET_CLIENT_NAME_FAILED);
|
||||
|
||||
ListNode sessionServerList;
|
||||
ListInit(&sessionServerList);
|
||||
EXPECT_EQ(InnerRegisterService(&sessionServerList), SOFTBUS_OK);
|
||||
EXPECT_EQ(InnerRegisterService(&sessionServerList), SOFTBUS_TRANS_GET_CLIENT_NAME_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -123,7 +123,7 @@ HWTEST_F(SoftBusServerProxyFrameTest, GetSystemAbilityTest, TestSize.Level1)
|
||||
HWTEST_F(SoftBusServerProxyFrameTest, ClientRegisterServiceTest, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(ServerProxyInit(), SOFTBUS_OK);
|
||||
EXPECT_EQ(ClientRegisterService("ClientRegisterServiceTest"), SOFTBUS_OK);
|
||||
EXPECT_EQ(ClientRegisterService("ClientRegisterServiceTest"), SOFTBUS_SERVER_NOT_INIT);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,7 +155,7 @@ HWTEST_F(SoftBusServerProxyFrameTest, SoftbusRegisterServiceTest, TestSize.Level
|
||||
ASSERT_TRUE(serverProxy != nullptr);
|
||||
serverProxyFrame = new (std::nothrow) SoftBusServerProxyFrame(serverProxy);
|
||||
ASSERT_TRUE(serverProxyFrame != nullptr);
|
||||
EXPECT_EQ(serverProxyFrame->SoftbusRegisterService("SoftbusRegisterServiceTest", nullptr), SOFTBUS_OK);
|
||||
EXPECT_EQ(serverProxyFrame->SoftbusRegisterService("SoftbusRegisterServiceTest", nullptr), SOFTBUS_IPC_ERR);
|
||||
|
||||
EXPECT_EQ(serverProxyFrame->SoftbusRegisterService(nullptr, nullptr), SOFTBUS_TRANS_PROXY_WRITECSTRING_FAILED);
|
||||
}
|
||||
|
@ -17,6 +17,11 @@ import("../../../../dsoftbus.gni")
|
||||
module_output_path = "dsoftbus/transmission"
|
||||
|
||||
ohos_unittest("TransIpcStandardTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [ "trans_ipc_test.cpp" ]
|
||||
|
@ -314,11 +314,11 @@ HWTEST_F(TransIpcStandardTest, QosReportTest001, TestSize.Level0)
|
||||
int32_t appType = 0;
|
||||
int32_t quality = QOS_IMPROVE;
|
||||
int32_t ret = transServerProxy.QosReport(channelId, channelType, appType, quality);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_NODE_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED);
|
||||
|
||||
channelId = INVALID_VALUE;
|
||||
ret = transServerProxy.QosReport(channelId, channelType, appType, quality);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_NODE_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -341,7 +341,7 @@ HWTEST_F(TransIpcStandardTest, StreamStatsTest001, TestSize.Level0)
|
||||
|
||||
channelId = INVALID_VALUE;
|
||||
ret = transServerProxy.StreamStats(channelId, channelType, statsData);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_NODE_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
SoftBusFree(statsData);
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ HWTEST_F(TransIpcStandardTest, RippleStatsTest0011, TestSize.Level0)
|
||||
|
||||
channelId = INVALID_VALUE;
|
||||
ret = transServerProxy.RippleStats(channelId, channelType, statsData);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_NODE_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED);
|
||||
SoftBusFree(statsData);
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ HWTEST_F(TransIpcStandardTest, GrantPermissionTest001, TestSize.Level0)
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITECSTRING_FAILED);
|
||||
|
||||
ret = transServerProxy.GrantPermission(UUID, PID, g_sessionName);
|
||||
EXPECT_EQ(SOFTBUS_PERMISSION_DENIED, ret);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -395,10 +395,10 @@ HWTEST_F(TransIpcStandardTest, RemovePermissionTest001, TestSize.Level0)
|
||||
{
|
||||
TransServerProxy transServerProxy(nullptr);
|
||||
int32_t ret = transServerProxy.RemovePermission(g_sessionName);
|
||||
EXPECT_EQ(ret, SOFTBUS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
|
||||
ret = transServerProxy.RemovePermission(g_sessionName);
|
||||
EXPECT_EQ(ret, SOFTBUS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -641,13 +641,13 @@ HWTEST_F(TransIpcStandardTest, ServerIpcQosReportTest001, TestSize.Level0)
|
||||
int32_t appType = 0;
|
||||
int32_t quality = QOS_IMPROVE;
|
||||
int32_t ret = ServerIpcQosReport(channelId, chanType, appType, quality);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_NODE_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED);
|
||||
|
||||
ret = TransServerProxyInit();
|
||||
ASSERT_EQ(ret, SOFTBUS_OK);
|
||||
|
||||
ret = ServerIpcQosReport(channelId, chanType, appType, quality);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_NODE_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED);
|
||||
|
||||
TransClientDeinit();
|
||||
}
|
||||
@ -716,7 +716,7 @@ HWTEST_F(TransIpcStandardTest, ServerIpcGrantPermissionTest001, TestSize.Level0)
|
||||
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
|
||||
|
||||
ret = ServerIpcGrantPermission(uid, pid, g_sessionName);
|
||||
EXPECT_EQ(ret, SOFTBUS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
|
||||
TransClientDeinit();
|
||||
}
|
||||
@ -739,7 +739,7 @@ HWTEST_F(TransIpcStandardTest, ServerIpcRemovePermissionTest001, TestSize.Level0
|
||||
EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
|
||||
|
||||
ret = ServerIpcRemovePermission(g_sessionName);
|
||||
EXPECT_EQ(ret, SOFTBUS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
|
||||
TransClientDeinit();
|
||||
}
|
||||
@ -767,7 +767,7 @@ HWTEST_F(TransIpcStandardTest, ServerIpcEvaluateQosTest001, TestSize.Level0)
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
|
||||
ret = ServerIpcEvaluateQos(g_peerNetworkId, type, qos, qosCount);
|
||||
EXPECT_EQ(SOFTBUS_NETWORK_NODE_OFFLINE, ret);
|
||||
EXPECT_EQ(SOFTBUS_ACCESS_TOKEN_DENIED, ret);
|
||||
SoftBusFree(qos);
|
||||
qos = nullptr;
|
||||
ASSERT_TRUE(qos == nullptr);
|
||||
|
@ -56,7 +56,7 @@ HWTEST_F(ClientTransSocketTest, DBinderGrantPermissionTest001, TestSize.Level1)
|
||||
ASSERT_GT(pid, 0);
|
||||
std::string socketName = "DBinder" + std::to_string(uid) + std::string("_") + std::to_string(pid);
|
||||
auto ret = DBinderGrantPermission(uid, pid, socketName.c_str());
|
||||
ASSERT_EQ(ret, SOFTBUS_OK);
|
||||
ASSERT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
ret = DBinderRemovePermission(socketName.c_str());
|
||||
ASSERT_EQ(ret, SOFTBUS_OK);
|
||||
}
|
||||
@ -76,7 +76,7 @@ HWTEST_F(ClientTransSocketTest, DBinderGrantPermissionTest002, TestSize.Level1)
|
||||
ASSERT_GT(pid, 0);
|
||||
std::string socketName = "DBinder" + std::to_string(uid) + std::string("_") + std::to_string(pid);
|
||||
auto ret = DBinderGrantPermission(uid, pid, socketName.c_str());
|
||||
ASSERT_EQ(ret, SOFTBUS_PERMISSION_DENIED);
|
||||
ASSERT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -94,9 +94,9 @@ HWTEST_F(ClientTransSocketTest, DBinderRemovePermissionTest001, TestSize.Level1)
|
||||
ASSERT_GT(pid, 0);
|
||||
std::string socketName = "DBinder" + std::to_string(uid) + std::string("_") + std::to_string(pid);
|
||||
auto ret = DBinderGrantPermission(uid, pid, socketName.c_str());
|
||||
ASSERT_EQ(ret, SOFTBUS_OK);
|
||||
ASSERT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
CounterfeitProcess("msdp");
|
||||
ret = DBinderRemovePermission(socketName.c_str());
|
||||
ASSERT_EQ(ret, SOFTBUS_PERMISSION_DENIED);
|
||||
ASSERT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED);
|
||||
}
|
||||
} // namespace OHOS
|
||||
|
@ -280,7 +280,7 @@ HWTEST_F(TransClientMsgServiceTest, TransClientMsgServiceTest02, TestSize.Level1
|
||||
g_sessionName, CHANNEL_TYPE_AUTH, BUSINESS_TYPE_NOT_CARE, false, ENABLE_STATUS_SUCCESS);
|
||||
ASSERT_GT(sessionId, 0);
|
||||
ret = SendBytes(sessionId, TRANS_TEST_AUTH_DATA, (unsigned int)strlen(TRANS_TEST_AUTH_DATA));
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_AUTH_CHANNEL_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_PERMISSION_DENIED);
|
||||
DeleteSessionServerAndSession(g_sessionName, sessionId);
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ HWTEST_F(TransClientMsgServiceTest, TransClientMsgServiceTest03, TestSize.Level1
|
||||
g_sessionName, CHANNEL_TYPE_AUTH, BUSINESS_TYPE_NOT_CARE, false, ENABLE_STATUS_SUCCESS);
|
||||
ASSERT_GT(sessionId, 0);
|
||||
ret = SendMessage(sessionId, TRANS_TEST_AUTH_DATA, (unsigned int)strlen(TRANS_TEST_AUTH_DATA));
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_AUTH_CHANNEL_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_PERMISSION_DENIED);
|
||||
DeleteSessionServerAndSession(g_sessionName, sessionId);
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ HWTEST_F(TransClientSessionServiceTest, TransClientSessionServiceTest02, TestSiz
|
||||
ret = ClientGetSessionIdByChannelId(TRANS_TEST_CHANNEL_ID, CHANNEL_TYPE_UDP, &sessionId, isClosing);
|
||||
EXPECT_EQ(ret, SOFTBUS_OK);
|
||||
ret = QosReport(sessionId, APP_TYPE_AUTH, QOS_IMPROVE);
|
||||
EXPECT_EQ(ret, SOFTBUS_TRANS_NODE_NOT_FOUND);
|
||||
EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED);
|
||||
ret = ClientDeleteSessionServer(SEC_TYPE_PLAINTEXT, g_sessionName);
|
||||
EXPECT_EQ(ret, SOFTBUS_OK);
|
||||
SoftBusFree(sessionParam);
|
||||
|
@ -191,7 +191,7 @@ HWTEST_F(TransClientSocketServiceTest, DataType001, TestSize.Level1)
|
||||
for (int32_t type = DATA_TYPE_MESSAGE; type < DATA_TYPE_BUTT; type++) {
|
||||
info.dataType = static_cast<TransDataType>(type);
|
||||
int32_t socketId = Socket(info);
|
||||
EXPECT_EQ(socketId, SOFTBUS_ACCESS_TOKEN_DENIED);
|
||||
EXPECT_EQ(socketId, SOFTBUS_TRANS_SESSION_ADDPKG_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,6 +156,11 @@ if (defined(ohos_lite)) {
|
||||
|
||||
module_output_path = "dsoftbus/transmission"
|
||||
ohos_unittest("ClientTransUdpManagerTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "udp/common/client_trans_udp_manager_test.cpp" ]
|
||||
include_dirs = trans_sdk_test_common_inc
|
||||
@ -209,6 +214,11 @@ if (defined(ohos_lite)) {
|
||||
|
||||
module_output_path = "dsoftbus/transmission"
|
||||
ohos_unittest("ClientTransProxyFileManagerTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "proxy/client_trans_proxy_file_manager_test.cpp" ]
|
||||
include_dirs = trans_sdk_test_common_inc
|
||||
@ -267,6 +277,11 @@ if (defined(ohos_lite)) {
|
||||
|
||||
module_output_path = "dsoftbus/transmission"
|
||||
ohos_unittest("ClientTransChannelManagerTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "manager/client_trans_channel_manager_test.cpp" ]
|
||||
include_dirs = trans_sdk_test_common_inc
|
||||
@ -288,6 +303,11 @@ if (defined(ohos_lite)) {
|
||||
|
||||
module_output_path = "dsoftbus/transmission"
|
||||
ohos_unittest("ClientTransChannelCallbackTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "manager/client_trans_channel_callback_test.cpp" ]
|
||||
include_dirs = trans_sdk_test_common_inc
|
||||
@ -331,6 +351,11 @@ if (defined(ohos_lite)) {
|
||||
}
|
||||
|
||||
ohos_unittest("ClientTransUdpStreamInterfaceTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "udp/stream/client_trans_udp_stream_interface_test.cpp" ]
|
||||
include_dirs = trans_udp_channel_sdk_inc
|
||||
|
@ -139,7 +139,7 @@ HWTEST_F(ClientTransChannelManagerTest, ClientTransChannelSendBytesTest001, Test
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
|
||||
ret = ClientTransChannelSendBytes(channelId, CHANNEL_TYPE_AUTH, data, TEST_DATA_LENGTH);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_AUTH_CHANNEL_NOT_FOUND, ret);
|
||||
EXPECT_EQ(SOFTBUS_PERMISSION_DENIED, ret);
|
||||
|
||||
ret = ClientTransChannelSendBytes(channelId, CHANNEL_TYPE_PROXY, data, TEST_DATA_LENGTH);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_PROXY_CHANNEL_NOT_FOUND, ret);
|
||||
@ -169,7 +169,7 @@ HWTEST_F(ClientTransChannelManagerTest, ClientTransChannelSendMessageTest001, Te
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
|
||||
ret = ClientTransChannelSendMessage(channelId, CHANNEL_TYPE_AUTH, data, TEST_DATA_LENGTH);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_AUTH_CHANNEL_NOT_FOUND, ret);
|
||||
EXPECT_EQ(SOFTBUS_PERMISSION_DENIED, ret);
|
||||
|
||||
ret = ClientTransChannelSendMessage(channelId, CHANNEL_TYPE_PROXY, data, TEST_DATA_LENGTH);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_PROXY_CHANNEL_NOT_FOUND, ret);
|
||||
|
@ -443,11 +443,11 @@ HWTEST_F(ClientTransProxyFileManagerTest, ClinetTransProxyCreateSendListenerInfo
|
||||
SessionEnableStatus isEnabled = ENABLE_STATUS_INIT;
|
||||
|
||||
ret = ClientAddSession(&g_param, &sessionId, &isEnabled);
|
||||
ASSERT_EQ(SOFTBUS_TRANS_SESSION_SERVER_NOINIT, ret);
|
||||
ASSERT_EQ(SOFTBUS_OK, ret);
|
||||
|
||||
SendListenerInfo *sendListenerInfo;
|
||||
ret = CreateSendListenerInfo(&sendListenerInfo, TEST_CHANNEL_ID, 0);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_SESSION_SERVER_NOINIT, ret);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_SESSION_INFO_NOT_FOUND, ret);
|
||||
|
||||
int32_t channelId = 1;
|
||||
int32_t osType = TEST_OS_TYPE;
|
||||
@ -477,8 +477,6 @@ HWTEST_F(ClientTransProxyFileManagerTest, ClinetTransProxyCreateSendListenerInfo
|
||||
|
||||
FileRecipientInfo *result = CreateNewRecipient(sessionId, channelId, osType);
|
||||
EXPECT_EQ(nullptr, result);
|
||||
|
||||
(void)TransClientDeinit();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1682,12 +1680,12 @@ HWTEST_F(ClientTransProxyFileManagerTest, ClinetTransProxyFileAckReqAndResDataTe
|
||||
EXPECT_EQ(SOFTBUS_INVALID_DATA_HEAD, ret);
|
||||
|
||||
dataTest = FILE_MAGIC_NUMBER;
|
||||
frame.data = (uint8_t *)"00010010datatest.txt";
|
||||
frame.data = (uint8_t *)&dataTest;
|
||||
ret = UnpackAckReqAndResData(&frame, &startSeq, &value);
|
||||
EXPECT_EQ(SOFTBUS_INVALID_DATA_HEAD, ret);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
|
||||
ret = UnpackAckReqAndResData(&frame, &startSeq, &value);
|
||||
EXPECT_NE(SOFTBUS_OK, ret);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,7 +113,7 @@ HWTEST_F(TransQosStatClientTest, QosStatClientTest002, TestSize.Level0)
|
||||
NodeBasicInfo *info;
|
||||
int32_t infoNum;
|
||||
ret = GetAllNodeDeviceInfo(UDP_TEST_PKG_NAME, &info, &infoNum);
|
||||
EXPECT_EQ(ret, SOFTBUS_IPC_ERR);
|
||||
EXPECT_EQ(ret, SOFTBUS_NETWORK_NOT_INIT);
|
||||
SessionAttribute attr = {0};
|
||||
attr.dataType = TYPE_STREAM;
|
||||
attr.attr.streamAttr.streamType = RAW_STREAM;
|
||||
@ -160,7 +160,7 @@ HWTEST_F(TransQosStatClientTest, QosStatClientTest003, TestSize.Level0)
|
||||
NodeBasicInfo *info;
|
||||
int32_t infoNum;
|
||||
ret = GetAllNodeDeviceInfo(UDP_TEST_PKG_NAME, &info, &infoNum);
|
||||
EXPECT_EQ(ret, SOFTBUS_IPC_ERR);
|
||||
EXPECT_EQ(ret, SOFTBUS_NETWORK_NOT_INIT);
|
||||
SessionAttribute attr = {0};
|
||||
attr.dataType = TYPE_STREAM;
|
||||
attr.attr.streamAttr.streamType = RAW_STREAM;
|
||||
@ -209,7 +209,7 @@ HWTEST_F(TransQosStatClientTest, QosStatClientTest004, TestSize.Level0)
|
||||
NodeBasicInfo *info;
|
||||
int32_t infoNum;
|
||||
ret = GetAllNodeDeviceInfo(UDP_TEST_PKG_NAME, &info, &infoNum);
|
||||
EXPECT_EQ(ret, SOFTBUS_IPC_ERR);
|
||||
EXPECT_EQ(ret, SOFTBUS_NETWORK_NOT_INIT);
|
||||
SessionAttribute attr = {0};
|
||||
attr.dataType = TYPE_STREAM;
|
||||
attr.attr.streamAttr.streamType = RAW_STREAM;
|
||||
@ -263,7 +263,7 @@ HWTEST_F(TransQosStatClientTest, QosStatClientTest005, TestSize.Level0)
|
||||
NodeBasicInfo *info;
|
||||
int32_t infoNum;
|
||||
ret = GetAllNodeDeviceInfo(UDP_TEST_PKG_NAME, &info, &infoNum);
|
||||
EXPECT_EQ(ret, SOFTBUS_IPC_ERR);
|
||||
EXPECT_EQ(ret, SOFTBUS_NETWORK_NOT_INIT);
|
||||
SessionAttribute attr = {0};
|
||||
attr.dataType = TYPE_STREAM;
|
||||
attr.attr.streamAttr.streamType = RAW_STREAM;
|
||||
@ -324,7 +324,7 @@ HWTEST_F(TransQosStatClientTest, QosStatClientTest006, TestSize.Level0)
|
||||
NodeBasicInfo *info;
|
||||
int32_t infoNum;
|
||||
ret = GetAllNodeDeviceInfo(UDP_TEST_PKG_NAME, &info, &infoNum);
|
||||
EXPECT_EQ(ret, SOFTBUS_IPC_ERR);
|
||||
EXPECT_EQ(ret, SOFTBUS_NETWORK_NOT_INIT);
|
||||
SessionAttribute attr = {0};
|
||||
attr.dataType = TYPE_STREAM;
|
||||
attr.attr.streamAttr.streamType = RAW_STREAM;
|
||||
|
@ -19,6 +19,11 @@ dsoftbus_root_path = "../../../../.."
|
||||
softbus_adapter_config = "${dsoftbus_root_path}/adapter/default_config"
|
||||
|
||||
ohos_unittest("TransSdkTcpDirectTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "trans_sdk_tcp_direct_test.cpp" ]
|
||||
|
||||
|
@ -365,7 +365,7 @@ HWTEST_F(TransTcpDirectTest, TransClientGetTdcDataBufByChannelTest001, TestSize.
|
||||
EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret);
|
||||
|
||||
ret = TransClientGetTdcDataBufByChannel(channelId, &fd, &len);
|
||||
EXPECT_EQ(SOFTBUS_NO_INIT, ret);
|
||||
EXPECT_EQ(SOFTBUS_TRANS_TDC_CHANNEL_NOT_FOUND, ret);
|
||||
|
||||
ret = TransDataListInit();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret);
|
||||
|
@ -19,6 +19,11 @@ dsoftbus_root_path = "../../../../../../../.."
|
||||
|
||||
## UnitTest VtpInstanceTest {{{
|
||||
ohos_unittest("VtpInstanceTest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
sources = [ "vtp_instance_test.cpp" ]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user