mirror of
https://gitee.com/openharmony/xts_dcts
synced 2024-11-27 09:50:32 +00:00
commit
5f458fba31
@ -15,6 +15,8 @@
|
||||
|
||||
#include "net_trans_common.h"
|
||||
|
||||
static int ONE_SECOND = 1;
|
||||
|
||||
static int32_t g_currentSessionId4Data = -1;
|
||||
static int32_t g_currentSessionId4Ctl = -1;
|
||||
|
||||
@ -57,6 +59,8 @@ static int* g_sId4Task3;
|
||||
static char g_fillContentChar = 'd';
|
||||
static unsigned int g_expectDataSize = 0;
|
||||
static char* g_expectDataContent = NULL;
|
||||
static char* g_expectMessageContent = NULL;
|
||||
|
||||
static pthread_barrier_t* g_barrier = NULL;
|
||||
|
||||
static int32_t g_recvMsgStat4Control[MAX_SESSION_NUM] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
@ -69,6 +73,12 @@ static uint64_t g_transTimeEnd;
|
||||
/* discovery */
|
||||
static IDiscoveryCallback g_defDiscCallback;
|
||||
|
||||
void sleepn(int n)
|
||||
{
|
||||
for(int i = 0; i < n; i++) {
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
int Wait(int timeout)
|
||||
{
|
||||
LOG("start wait,timeout:%d", timeout);
|
||||
@ -554,6 +564,16 @@ void ResetWaitFlag4Ctl(void)
|
||||
g_waitFlag4Ctl = WAIT_DEF_VALUE;
|
||||
}
|
||||
|
||||
void ResetwaitCount4Online(void)
|
||||
{
|
||||
g_nodeOnlineCount = 0;
|
||||
}
|
||||
|
||||
void ResetwaitCount4Offline(void)
|
||||
{
|
||||
g_nodeOfflineCount = 0;
|
||||
}
|
||||
|
||||
int RegisterDeviceStateDefCallback(void)
|
||||
{
|
||||
return RegNodeDeviceStateCb(DEF_PKG_NAME, &g_defNodeStateCallback);
|
||||
@ -679,6 +699,42 @@ int SendData4Data(DataType type, int size)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int SendData4Message(DataType type, int size)
|
||||
{
|
||||
int ret;
|
||||
if (size > 0) {
|
||||
g_expectMessageContent = (char*)calloc(1, size);
|
||||
if (g_expectMessageContent == NULL) {
|
||||
LOG("[send data]calloc fail");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
(void)memset_s(g_expectMessageContent, size, g_fillContentChar, size);
|
||||
} else {
|
||||
LOG("[send data]invalid param[size>=1]");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
|
||||
g_expectDataSize = size;
|
||||
ResetWaitFlag();
|
||||
if (type == DATA_TYPE_MSG) {
|
||||
ret = SendMessage(g_currentSessionId4Ctl, g_expectMessageContent, size);
|
||||
} else if (type == DATA_TYPE_BYTE) {
|
||||
ret = SendBytes(g_currentSessionId4Ctl, g_expectMessageContent, size);
|
||||
} else {
|
||||
LOG("[send data]invalid param[DataType]");
|
||||
free(g_expectMessageContent);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
if (ret != SOFTBUS_OK) {
|
||||
LOG("[send data]call SendX fail, ret:%d", ret);
|
||||
free(g_expectMessageContent);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
free(g_expectMessageContent);
|
||||
g_expectMessageContent = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int CloseSessionAndRemoveSs4Data(void)
|
||||
{
|
||||
int ret4Close;
|
||||
@ -800,6 +856,54 @@ int CloseSessionBatch4Ctl(int* sessionId, int count)
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int WaitNodeCount(int timeout, WaitNodeStateType state, int expectCount)
|
||||
{
|
||||
LOG("Wait4Node,timeout:%d, type:%d, exp count:%d", timeout, state, expectCount);
|
||||
int hitFlag = -1;
|
||||
while (timeout > 0) {
|
||||
sleep(ONE_SECOND);
|
||||
switch (state) {
|
||||
case STATE_ONLINE:
|
||||
if (g_nodeOnlineCount == expectCount) {
|
||||
LOG("Wait4Node[online] succ,timeout:%d", timeout);
|
||||
hitFlag = 1;
|
||||
}
|
||||
break;
|
||||
case STATE_OFFLINE:
|
||||
if (g_nodeOfflineCount == expectCount) {
|
||||
LOG("Wait4Node[offline] succ,timeout:%d", timeout);
|
||||
hitFlag = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOG("Wait4Node state error");
|
||||
hitFlag = 1;
|
||||
break;
|
||||
}
|
||||
if (hitFlag != -1) {
|
||||
break;
|
||||
}
|
||||
timeout--;
|
||||
}
|
||||
switch (state) {
|
||||
case STATE_ONLINE:
|
||||
if (g_nodeOnlineCount != expectCount) {
|
||||
LOG("Wait4Node[online] fail[exp:%d, real:%d]", expectCount, g_nodeOnlineCount);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
break;
|
||||
case STATE_OFFLINE:
|
||||
if (g_nodeOfflineCount != expectCount) {
|
||||
LOG("Wait4Node[offline] fail[exp:%d, real:%d]", expectCount, g_nodeOfflineCount);
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
// set/get function
|
||||
void ResetClosedSessionCount4Data(void)
|
||||
{
|
||||
@ -963,7 +1067,7 @@ void TestSetUp(void)
|
||||
}
|
||||
if (g_sessionAttr4Ctl == NULL) {
|
||||
g_sessionAttr4Ctl = (SessionAttribute*)calloc(1, sizeof(SessionAttribute));
|
||||
g_sessionAttr4Ctl->dataType = TYPE_BYTES;
|
||||
g_sessionAttr4Ctl->dataType = TYPE_MESSAGE;
|
||||
}
|
||||
if (g_sessionAttr4Pass == NULL) {
|
||||
g_sessionAttr4Pass = (SessionAttribute*)calloc(1, sizeof(SessionAttribute));
|
||||
|
@ -180,9 +180,10 @@ typedef enum {
|
||||
|
||||
int Wait(int timeout);
|
||||
int Wait4Session(int timeout, WaitSessionType type);
|
||||
int WaitNodeCount(int timeout, WaitNodeStateType state, int expectCount);
|
||||
|
||||
void AddPermission (void);
|
||||
|
||||
void sleepn(int n);
|
||||
void TestSetUp(void);
|
||||
void TestTearDown(void);
|
||||
|
||||
@ -195,8 +196,11 @@ uint64_t GetCurrentTimeOfMs(void);
|
||||
void ResetWaitFlag(void);
|
||||
void ResetWaitFlag4Data(void);
|
||||
void ResetWaitFlag4Ctl(void);
|
||||
void ResetwaitCount4Online(void);
|
||||
void ResetwaitCount4Offline(void);
|
||||
|
||||
int SendData4Data(DataType type, int size);
|
||||
int SendData4Message(DataType type, int size);
|
||||
|
||||
int CreateSsAndOpenSession4Data(void);
|
||||
int CreateSsAndOpenSession4Ctl(void);
|
||||
|
@ -68,9 +68,7 @@ static ISessionListener g_fileSessionListener = {
|
||||
.OnBytesReceived = FileBytesReceived,
|
||||
.OnMessageReceived = FileMessageReceived,
|
||||
};
|
||||
static const char* g_fileOne[] = {
|
||||
"/data/SoftBusNetTest_BindSelf_1.xml",
|
||||
};
|
||||
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
@ -85,7 +83,13 @@ public:
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void TransFileFuncTest::SetUp() {}
|
||||
void TransFileFuncTest::SetUp() {
|
||||
// set listener
|
||||
int ret = SetFileSendListener(DEF_PKG_NAME, SESSION_NAME_FILE, GetSendFileListener());
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SetFileSendListener fail";
|
||||
ret = SetFileReceiveListener(DEF_PKG_NAME, SESSION_NAME_FILE, GetRecvFileListener(), RECV_FILE_PATH);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SetFileSendListener fail";
|
||||
}
|
||||
|
||||
void TransFileFuncTest::TearDown() {}
|
||||
|
||||
@ -103,13 +107,15 @@ void TransFileFuncTest::SetUpTestCase()
|
||||
ret = CheckRemoteDeviceIsNull(BOOL_TRUE);
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "get node fail,please check network";
|
||||
|
||||
// set listener
|
||||
ret = SetFileSendListener(DEF_PKG_NAME, SESSION_NAME_FILE, GetSendFileListener());
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SetFileSendListener fail";
|
||||
ret = SetFileReceiveListener(DEF_PKG_NAME, SESSION_NAME_FILE, GetRecvFileListener(), RECV_FILE_PATH);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SetFileSendListener fail";
|
||||
system(" truncate -s 0M /data/A.tar");
|
||||
system(" truncate -s 8M /data/8M.tar");
|
||||
system(" truncate -s 8M /data/8M_DNull.tar");
|
||||
system(" truncate -s 400M /data/big.tar");
|
||||
sleepn(5);
|
||||
system(" truncate -s 8M /data/richu.jpg");
|
||||
system(" truncate -s 3M /data/richu-002.jpg");
|
||||
system(" truncate -s 10M /data/richu-003.jpg");
|
||||
|
||||
system(" truncate -s 3M /data/SoftBusNetTest_BindSelf_1.xml");
|
||||
LOG("SetUp end");
|
||||
}
|
||||
|
||||
@ -143,13 +149,13 @@ static int WaitFile(int timeout)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendFile_Func_0100
|
||||
* @tc.name : test SendFile
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0100
|
||||
* @tc.name : test SendFile 8M
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_SendFile_Func_0100, TestSize.Level2)
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0100, TestSize.Level2)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE, &g_fileSessionListener);
|
||||
@ -163,8 +169,16 @@ HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_SendFile_Func_0100, TestSize.Level
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait opensession fail[file]";
|
||||
}
|
||||
|
||||
static const char* g_fileOne[] = {
|
||||
"/data/8M.tar",
|
||||
};
|
||||
|
||||
static const char *dfileList[] = {
|
||||
"/data/8M.tar",
|
||||
};
|
||||
|
||||
ResetWaitFlag();
|
||||
ret = SendFile(sid, g_fileOne, NULL, 1);
|
||||
ret = SendFile(sid, g_fileOne, dfileList, 1);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SendFile fail";
|
||||
ret = Wait(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait send fail rst fail";
|
||||
@ -173,3 +187,284 @@ HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_SendFile_Func_0100, TestSize.Level
|
||||
ret = RemoveSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "RemoveSS[proxy] fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0200
|
||||
* @tc.name : test SendFile 0M
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0200, TestSize.Level2)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE, &g_fileSessionListener);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "CreateSS[file] fail";
|
||||
|
||||
g_waitFlag = WAIT_DEF_VALUE;
|
||||
int sid = OpenSession(SESSION_NAME_FILE, SESSION_NAME_FILE, GetNetworkId(), DEF_GROUP_ID, &g_fileSessionAttr);
|
||||
EXPECT_TRUE(sid >= SESSION_ID_MIN) << "call OpenSession[file] fail, sid=" << sid;
|
||||
if (sid >= SESSION_ID_MIN) {
|
||||
ret = WaitFile(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait opensession fail[file]";
|
||||
}
|
||||
|
||||
static const char* g_fileOne[] = {
|
||||
"/data/A.tar",
|
||||
};
|
||||
|
||||
static const char *dfileList[] = {
|
||||
"/data/A_recv.tar",
|
||||
};
|
||||
|
||||
ResetWaitFlag();
|
||||
ret = SendFile(sid, g_fileOne, dfileList, 1);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SendFile fail";
|
||||
ret = Wait(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait send fail rst fail";
|
||||
|
||||
CloseSession(sid);
|
||||
ret = RemoveSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "RemoveSS[proxy] fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0300
|
||||
* @tc.name : SendFile the sender address is empty ,send failed
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0300, TestSize.Level2)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE, &g_fileSessionListener);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "CreateSS[file] fail";
|
||||
|
||||
g_waitFlag = WAIT_DEF_VALUE;
|
||||
int sid = OpenSession(SESSION_NAME_FILE, SESSION_NAME_FILE, GetNetworkId(), DEF_GROUP_ID, &g_fileSessionAttr);
|
||||
EXPECT_TRUE(sid >= SESSION_ID_MIN) << "call OpenSession[file] fail, sid=" << sid;
|
||||
if (sid >= SESSION_ID_MIN) {
|
||||
ret = WaitFile(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait opensession fail[file]";
|
||||
}
|
||||
|
||||
static const char *dfileList[] = {
|
||||
"/data/SNULL.tar",
|
||||
};
|
||||
|
||||
ResetWaitFlag();
|
||||
ret = SendFile(sid, NULL, dfileList, 1);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "call SendFile successful";
|
||||
|
||||
CloseSession(sid);
|
||||
ret = RemoveSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "RemoveSS[proxy] fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0400
|
||||
* @tc.name : SendFile the sender address is invalid ,send failed
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0400, TestSize.Level2)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE, &g_fileSessionListener);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "CreateSS[file] fail";
|
||||
|
||||
g_waitFlag = WAIT_DEF_VALUE;
|
||||
int sid = OpenSession(SESSION_NAME_FILE, SESSION_NAME_FILE, GetNetworkId(), DEF_GROUP_ID, &g_fileSessionAttr);
|
||||
EXPECT_TRUE(sid >= SESSION_ID_MIN) << "call OpenSession[file] fail, sid=" << sid;
|
||||
if (sid >= SESSION_ID_MIN) {
|
||||
ret = WaitFile(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait opensession fail[file]";
|
||||
}
|
||||
|
||||
static const char *g_fileOne[] = {
|
||||
"/data/sendfile/8M.tar",
|
||||
};
|
||||
|
||||
static const char *dfileList[] = {
|
||||
"/data/8M_invalid.tar",
|
||||
};
|
||||
|
||||
ResetWaitFlag();
|
||||
ret = SendFile(sid, g_fileOne, dfileList, 1);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "call SendFile successful";
|
||||
|
||||
CloseSession(sid);
|
||||
ret = RemoveSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "RemoveSS[proxy] fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0500
|
||||
* @tc.name : SendFile the receiving address is null ,send successful
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0500, TestSize.Level2)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE, &g_fileSessionListener);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "CreateSS[file] fail";
|
||||
|
||||
g_waitFlag = WAIT_DEF_VALUE;
|
||||
int sid = OpenSession(SESSION_NAME_FILE, SESSION_NAME_FILE, GetNetworkId(), DEF_GROUP_ID, &g_fileSessionAttr);
|
||||
EXPECT_TRUE(sid >= SESSION_ID_MIN) << "call OpenSession[file] fail, sid=" << sid;
|
||||
if (sid >= SESSION_ID_MIN) {
|
||||
ret = WaitFile(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait opensession fail[file]";
|
||||
}
|
||||
|
||||
static const char* g_fileOne[] = {
|
||||
"/data/8M_DNull.tar",
|
||||
};
|
||||
|
||||
ResetWaitFlag();
|
||||
ret = SendFile(sid, g_fileOne, NULL, 1);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SendFile fail";
|
||||
ret = Wait(15);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait send fail rst fail";
|
||||
|
||||
CloseSession(sid);
|
||||
ret = RemoveSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "RemoveSS[proxy] fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0600
|
||||
* @tc.name : SendFile the receiving address is invalid ,send successful
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0600, TestSize.Level2)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE, &g_fileSessionListener);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "CreateSS[file] fail";
|
||||
|
||||
g_waitFlag = WAIT_DEF_VALUE;
|
||||
int sid = OpenSession(SESSION_NAME_FILE, SESSION_NAME_FILE, GetNetworkId(), DEF_GROUP_ID, &g_fileSessionAttr);
|
||||
EXPECT_TRUE(sid >= SESSION_ID_MIN) << "call OpenSession[file] fail, sid=" << sid;
|
||||
if (sid >= SESSION_ID_MIN) {
|
||||
ret = WaitFile(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait opensession fail[file]";
|
||||
}
|
||||
|
||||
static const char* g_fileOne[] = {
|
||||
"/data/8M.tar",
|
||||
};
|
||||
|
||||
static const char *dfileList[] = {
|
||||
"/sendfile/8M_invalid.tar",
|
||||
};
|
||||
|
||||
ResetWaitFlag();
|
||||
ret = SendFile(sid, g_fileOne, dfileList, 1);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SendFile fail";
|
||||
ret = Wait(15);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait send fail rst fail";
|
||||
|
||||
CloseSession(sid);
|
||||
ret = RemoveSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "RemoveSS[proxy] fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0700
|
||||
* @tc.name : SendFile close session ,send failed
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0700, TestSize.Level2)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE, &g_fileSessionListener);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "CreateSS[file] fail";
|
||||
|
||||
g_waitFlag = WAIT_DEF_VALUE;
|
||||
int sid = OpenSession(SESSION_NAME_FILE, SESSION_NAME_FILE, GetNetworkId(), DEF_GROUP_ID, &g_fileSessionAttr);
|
||||
EXPECT_TRUE(sid >= SESSION_ID_MIN) << "call OpenSession[file] fail, sid=" << sid;
|
||||
if (sid >= SESSION_ID_MIN) {
|
||||
ret = WaitFile(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait opensession fail[file]";
|
||||
}
|
||||
|
||||
static const char* g_fileOne[] = {
|
||||
"/data/big.tar",
|
||||
};
|
||||
|
||||
static const char *dfileList[] = {
|
||||
"/sendfile/big.tar",
|
||||
};
|
||||
|
||||
ResetWaitFlag();
|
||||
ret = SendFile(sid, g_fileOne, dfileList, 1);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SendFile fail";
|
||||
|
||||
CloseSession(sid);
|
||||
ret = Wait(15);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "wait send success ,expect fail";
|
||||
|
||||
ret = RemoveSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "RemoveSS[proxy] fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0800
|
||||
* @tc.name : SendFile set recev listening address to be null or invalid
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0800, TestSize.Level2)
|
||||
{
|
||||
int ret = SetFileReceiveListener(DEF_PKG_NAME, SESSION_NAME_FILE, GetRecvFileListener(), NULL);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "call SetFileSendListener fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendFile_Fun_0900
|
||||
* @tc.name : Send 4 files once
|
||||
* @tc.desc : Test send file function
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFileFuncTest, SUB_Softbus_Trans_Comp_SendFile_Fun_0900, TestSize.Level2)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE, &g_fileSessionListener);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "CreateSS[file] fail";
|
||||
|
||||
g_waitFlag = WAIT_DEF_VALUE;
|
||||
int sid = OpenSession(SESSION_NAME_FILE, SESSION_NAME_FILE, GetNetworkId(), DEF_GROUP_ID, &g_fileSessionAttr);
|
||||
EXPECT_TRUE(sid >= SESSION_ID_MIN) << "call OpenSession[file] fail, sid=" << sid;
|
||||
if (sid >= SESSION_ID_MIN) {
|
||||
ret = WaitFile(10);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait opensession fail[file]";
|
||||
}
|
||||
|
||||
static const char* g_fileOne[] = {
|
||||
"/data/big.tar",
|
||||
"/data/richu.jpg",
|
||||
"/data/richu-002.jpg",
|
||||
"/data/richu-003.jpg",
|
||||
};
|
||||
|
||||
ResetWaitFlag();
|
||||
ret = SendFile(sid, g_fileOne, NULL, 4);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "call SendFile fail";
|
||||
ret = Wait(350);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "wait send fail rst fail";
|
||||
|
||||
CloseSession(sid);
|
||||
ret = RemoveSessionServer(DEF_PKG_NAME, SESSION_NAME_FILE);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "RemoveSS[proxy] fail";
|
||||
}
|
@ -61,13 +61,13 @@ void TransFuncTest::TearDownTestCase()
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendByte_Func_0100
|
||||
* @tc.name : SendByte Packet size 1B, send and receive successful
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0100
|
||||
* @tc.name : SendByte Packet size 1B, send and receive successful
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendByte_Func_0100, TestSize.Level3)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0100, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -82,13 +82,13 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendByte_Func_0100, TestSize.Level3)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendByte_Func_0200
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0200
|
||||
* @tc.name : SendByte Packet size 2K, send and receive successful
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendByte_Func_0200, TestSize.Level1)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0200, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -103,13 +103,13 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendByte_Func_0200, TestSize.Level1)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendByte_Func_0300
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0300
|
||||
* @tc.name : SendByte Packet size Max, send and receive successful
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendByte_Func_0300, TestSize.Level2)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0300, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -124,13 +124,13 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendByte_Func_0300, TestSize.Level2)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendByte_Func_0400
|
||||
* @tc.name : SendByte Packet size 0, send and receive successful
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0400
|
||||
* @tc.name : SendByte Packet size 0, send and receive failed
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendByte_Func_0400, TestSize.Level3)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0400, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -147,13 +147,141 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendByte_Func_0400, TestSize.Level3)
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendMessage_Func_0100
|
||||
* @tc.name : SendMessage Packet size 1B, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0500
|
||||
* @tc.name : SendByte Packet size Max + 1, send and receive failed
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0100, TestSize.Level3)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0500, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = TRANS_BYTES_LENGTH_MAX + 1;
|
||||
ret = SendData4Data(DATA_TYPE_BYTE, size);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "call sendbytes(empty) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Data();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0600
|
||||
* @tc.name : SendByte Packet size 1B ,Proxy channel, send and receive successful
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0600, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = 1;
|
||||
ret = SendData4Message(DATA_TYPE_BYTE, size);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "SendData4Data(byte, 1B) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0700
|
||||
* @tc.name : SendByte Packet size 2K, Proxy channel, send and receive successful
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0700, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = 2 * 1024;
|
||||
ret = SendData4Message(DATA_TYPE_BYTE, size);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "SendData4Data(byte,2M) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0800
|
||||
* @tc.name : SendByte Packet size 4k ,Proxy channel, send and receive successful
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0800, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = 4 * 1024;
|
||||
ret = SendData4Message(DATA_TYPE_BYTE, size);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "SendData4Data(byte,Max) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_0900
|
||||
* @tc.name : SendByte Packet size 0, Proxy channel, send and receive failed
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_0900, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = 0;
|
||||
string emptyStr = "";
|
||||
int sessionId = GetCurrentSessionId4Ctl();
|
||||
ret = SendBytes(sessionId, emptyStr.c_str(), size);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "call sendbytes(empty) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendBytes_Fun_1000
|
||||
* @tc.name : SendByte Packet size 4k + 1, Proxy channel, send and receive failed
|
||||
* @tc.desc : Test the SendByte specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendBytes_Fun_1000, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = 4 * 1024 + 1;
|
||||
ret = SendData4Message(DATA_TYPE_BYTE, size);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "call sendbytes(empty) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0100
|
||||
* @tc.name : SendMessage Packet size 1B, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0100, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -168,13 +296,13 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0100, TestSize.Level3
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendMessage_Func_0200
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0200
|
||||
* @tc.name : SendMessage Packet size 1K, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0200, TestSize.Level1)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0200, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -189,13 +317,13 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0200, TestSize.Level1
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendMessage_Func_0300
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0300
|
||||
* @tc.name : SendMessage Packet size Max, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0300, TestSize.Level2)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0300, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -210,13 +338,13 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0300, TestSize.Level2
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendMessage_Func_0400
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0400
|
||||
* @tc.name : SendMessage Packet size 0, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0400, TestSize.Level3)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0400, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -233,13 +361,13 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0400, TestSize.Level3
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_SendMessage_Func_0500
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0500
|
||||
* @tc.name : SendMessage Packet size Max+1, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0500, TestSize.Level3)
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0500, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Data();
|
||||
@ -256,4 +384,111 @@ HWTEST_F(TransFuncTest, SUB_Softbus_Trans_SendMessage_Func_0500, TestSize.Level3
|
||||
ret = CloseSessionAndRemoveSs4Data();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
free(dataMoreMax);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0600
|
||||
* @tc.name : SendMessage Packet size 1B, proxy channel, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0600, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = 1;
|
||||
ret = SendData4Message(DATA_TYPE_MSG, size);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "SendData4Data(msg, 1B) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0700
|
||||
* @tc.name : SendMessage Packet size 1K, proxy channel, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0700, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = 1000;
|
||||
ret = SendData4Message(DATA_TYPE_MSG, size);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "SendData4Data(msg,1K) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0800
|
||||
* @tc.name : SendMessage Packet size Max, proxy channel, send and receive successful
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0800, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = TRANS_PROXY_MESSAGE_LENGTH_MAX;
|
||||
ret = SendData4Message(DATA_TYPE_MSG, size);
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "SendData4Data(msg,Max) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_0900
|
||||
* @tc.name : SendMessage Packet size 0, proxy channel, send and receive failed
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_0900, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = 0;
|
||||
string emptystr = "";
|
||||
int sessionId = GetCurrentSessionId4Ctl();
|
||||
ret = SendMessage(sessionId, emptystr.c_str(), size);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "call sendmsg(empty) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number : SUB_Softbus_Trans_Comp_SendMessage_Fun_1000
|
||||
* @tc.name : SendMessage Packet size 1kb +1, proxy channel, send and receive failed
|
||||
* @tc.desc : Test the SendMessage specification
|
||||
* @tc.type : FUNC
|
||||
* @tc.size : MediumTest
|
||||
*/
|
||||
HWTEST_F(TransFuncTest, SUB_Softbus_Trans_Comp_SendMessage_Fun_1000, TestSize.Level3)
|
||||
{
|
||||
int ret;
|
||||
ret = CreateSsAndOpenSession4Ctl();
|
||||
ASSERT_EQ(SOFTBUS_OK, ret) << "create Ss and openS[data] fail";
|
||||
|
||||
int size = TRANS_PROXY_MESSAGE_LENGTH_MAX + 1;
|
||||
ret = SendData4Message(DATA_TYPE_MSG, size);
|
||||
EXPECT_NE(SOFTBUS_OK, ret) << "call sendmsg(Max+1) fail";
|
||||
|
||||
ret = CloseSessionAndRemoveSs4Ctl();
|
||||
EXPECT_EQ(SOFTBUS_OK, ret) << "close session and remove Ss fail";
|
||||
}
|
Loading…
Reference in New Issue
Block a user