``` UT of transmission

Signed-off-by: breakfei1 <zhangshen6@huawei.com>
This commit is contained in:
breakfei1 2022-09-28 14:23:45 +08:00
parent 1b95e3c528
commit 8ec2421c6a
9 changed files with 566 additions and 29 deletions

View File

@ -93,6 +93,8 @@
"//foundation/communication/dsoftbus/tests/core/connection:unittest",
"//foundation/communication/dsoftbus/tests/core/discovery/manager:unittest",
"//foundation/communication/dsoftbus/tests/core/transmission/trans_channel/tcp_direct:unittest",
"//foundation/communication/dsoftbus/tests/core/transmission/trans_channel/auth_channel:unittest",
"//foundation/communication/dsoftbus/tests/core/transmission/trans_channel/proxy_channel:unittest",
"//foundation/communication/dsoftbus/tests/sdk/bus_center/fuzztest:fuzztest",
"//foundation/communication/dsoftbus/tests/sdk/bus_center/unittest:unittest",
"//foundation/communication/dsoftbus/tests/sdk/discovery/fuzztest:fuzztest",

View File

@ -17,6 +17,10 @@
#define SOFTBUS_PROXYCHANNEL_CONTROL_H
#include "softbus_proxychannel_message.h"
#ifdef __cplusplus
extern "C" {
#endif
int32_t TransProxySendMessage(ProxyChannelInfo *info, const char *payLoad, uint32_t payLoadLen, int32_t priority);
int32_t TransProxyHandshake(ProxyChannelInfo *info);
int32_t TransProxyAckHandshake(uint32_t connId, ProxyChannelInfo *chan, int32_t retCode);
@ -24,4 +28,8 @@ void TransProxyKeepalive(uint32_t connId, const ProxyChannelInfo *info);
int32_t TransProxyAckKeepalive(ProxyChannelInfo *info);
int32_t TransProxyResetPeer(ProxyChannelInfo *info);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -21,6 +21,8 @@
extern "C" {
#endif
int32_t GetCipherFlagByAuthId(int64_t authId, uint32_t *flag, bool *isAuthServer);
int32_t TransTdcStartSessionListener(ListenerModule module, const LocalListenerInfo *info);
int32_t TransTdcStopSessionListener(ListenerModule module);

View File

@ -0,0 +1,96 @@
# Copyright (c) 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/communication/dsoftbus/dsoftbus.gni")
module_output_path = "dsoftbus/transmission"
ohos_unittest("TransAuthChannelCoreTest") {
module_out_path = module_output_path
sources = [ "trans_auth_channel_test.cpp" ]
include_dirs = [
"$softbus_adapter_common/include",
"$dsoftbus_root_path/core/common/include",
"$dsoftbus_root_path/core/discovery/interface",
"$dsoftbus_root_path/interfaces/kits/discovery",
"$dsoftbus_root_path/core/discovery/manager/include",
"$dsoftbus_root_path/core/discovery/coap/include",
"$dsoftbus_root_path/interfaces/kits/common",
"$dsoftbus_root_path/core/connection/interface",
"$dsoftbus_root_path/core/transmission/common/include",
"$dsoftbus_root_path/core/transmission/trans_channel/tcp_direct/include",
"$dsoftbus_root_path/core/transmission/trans_channel/proxy/include",
"$dsoftbus_root_path/core/transmission/interface",
"$dsoftbus_root_path/core/transmission/session/include",
"$dsoftbus_root_path/core/transmission/trans_channel/manager/include",
"$dsoftbus_root_path/core/transmission/pending_packet/include",
"//commonlibrary/c_utils/base/include",
"unittest/common/",
"//commonlibrary/c_utils/base/include",
"unittest/common/",
"$dsoftbus_root_path/core/authentication/include",
"$dsoftbus_root_path/core/authentication/interface",
"$dsoftbus_root_path/core/bus_center/interface",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/sync_ledger/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
"$dsoftbus_root_path/core/common/include",
"$dsoftbus_root_path/core/common/message_handler/include",
"$dsoftbus_root_path/core/connection/interface",
"$dsoftbus_root_path/interfaces/kits/bus_center",
"$dsoftbus_root_path/interfaces/kits/common",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
"$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
"$dsoftbus_root_path/core/discovery/manager/include",
"$dsoftbus_root_path/core/discovery/coap/include",
"$dsoftbus_root_path/core/discovery/interface",
"$dsoftbus_root_path/third_party/dfinder/include",
"$dsoftbus_root_path/interfaces/kits/discovery",
"$dsoftbus_root_path/interfaces/kits/bus_center",
"$dsoftbus_root_path/interfaces/kits/common",
"//base/security/device_auth/interfaces/innerkits",
"//third_party/cJSON",
"$dsoftbus_root_path/core/adapter/bus_center/include",
"$dsoftbus_root_path/core/transmission/trans_channel/auth/include",
"$dsoftbus_root_path/interfaces/kits/transport",
"$dsoftbus_root_path/core/common/include",
"$dsoftbus_root_path/interfaces/kits",
]
deps = [
"$dsoftbus_root_path/core/common:softbus_utils",
"$dsoftbus_root_path/core/frame:softbus_server",
"//third_party/googletest:gtest_main",
]
if (is_standard_system) {
external_deps = [
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
]
} else {
external_deps = [
"c_utils:utils",
"hilog:libhilog",
]
}
}
group("unittest") {
testonly = true
deps = [ ":TransAuthChannelCoreTest" ]
}

View File

@ -0,0 +1,83 @@
/*
* Copyright (c) 2021-2022 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <securec.h>
#include "gtest/gtest.h"
#include "session.h"
#include "softbus_errcode.h"
#include "softbus_json_utils.h"
#include "softbus_log.h"
#include "softbus_protocol_def.h"
#include "trans_auth_manager.h"
using namespace testing::ext;
namespace OHOS {
class TransAuthChannelTest : public testing::Test {
public:
TransAuthChannelTest()
{}
~TransAuthChannelTest()
{}
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp() override
{}
void TearDown() override
{}
};
void TransAuthChannelTest::SetUpTestCase(void)
{}
void TransAuthChannelTest::TearDownTestCase(void)
{}
/**
* @tc.name: TransOpenAuthMsgChannelTest001
* @tc.desc: TransOpenAuthMsgChannel, use the wrong parameter.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransAuthChannelTest, TransOpenAuthMsgChannelTest001, TestSize.Level1)
{
const char* sessionName = "com.softbus.transmission.test";
int32_t channelId = 0;
ConnectOption connInfo = {
.type = CONNECT_TCP,
.socketOption = {
.addr = {0},
.port = 6000,
.moduleId = MODULE_MESSAGE_SERVICE,
.protocol = LNN_PROTOCOL_IP
}
};
if (strcpy_s(connInfo.socketOption.addr, sizeof(connInfo.socketOption.addr), "192.168.8.1") != EOK) {
return;
}
int ret = TransOpenAuthMsgChannel(sessionName, NULL, &channelId);
EXPECT_TRUE(ret != 0);
ret = TransOpenAuthMsgChannel(sessionName, &connInfo, NULL);
EXPECT_TRUE(ret != 0);
connInfo.type = CONNECT_BR;
ret = TransOpenAuthMsgChannel(sessionName, &connInfo, &channelId);
EXPECT_TRUE(ret != 0);
}
} // namespace OHOS

View File

@ -0,0 +1,99 @@
# Copyright (c) 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build/test.gni")
import("//foundation/communication/dsoftbus/dsoftbus.gni")
module_output_path = "dsoftbus/transmission"
ohos_unittest("TransProxyChannelCoreTest") {
module_out_path = module_output_path
sources = [ "trans_proxy_channel_test.cpp" ]
include_dirs = [
"$softbus_adapter_common/include",
"$dsoftbus_root_path/core/common/include",
"$dsoftbus_root_path/core/discovery/interface",
"$dsoftbus_root_path/interfaces/kits/discovery",
"$dsoftbus_root_path/core/discovery/manager/include",
"$dsoftbus_root_path/core/discovery/coap/include",
"$dsoftbus_root_path/interfaces/kits/common",
"$dsoftbus_root_path/core/connection/interface",
"$dsoftbus_root_path/core/transmission/common/include",
"$dsoftbus_root_path/core/transmission/trans_channel/tcp_direct/include",
"$dsoftbus_root_path/core/transmission/trans_channel/proxy/include",
"$dsoftbus_root_path/core/transmission/interface",
"$dsoftbus_root_path/core/transmission/session/include",
"$dsoftbus_root_path/core/transmission/trans_channel/manager/include",
"$dsoftbus_root_path/core/transmission/pending_packet/include",
"//commonlibrary/c_utils/base/include",
"unittest/common/",
"//commonlibrary/c_utils/base/include",
"unittest/common/",
"$dsoftbus_root_path/core/authentication/include",
"$dsoftbus_root_path/core/authentication/interface",
"$dsoftbus_root_path/core/bus_center/interface",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/common/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/distributed_ledger/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/local_ledger/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_ledger/sync_ledger/include",
"$dsoftbus_root_path/core/bus_center/lnn/net_builder/include",
"$dsoftbus_root_path/core/common/include",
"$dsoftbus_root_path/core/common/message_handler/include",
"$dsoftbus_root_path/core/connection/interface",
"$dsoftbus_root_path/interfaces/kits/bus_center",
"$dsoftbus_root_path/interfaces/kits/common",
"//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite",
"$dsoftbus_root_path/core/bus_center/lnn/lane_hub/lane_manager/include",
"$dsoftbus_root_path/core/discovery/manager/include",
"$dsoftbus_root_path/core/discovery/coap/include",
"$dsoftbus_root_path/core/discovery/interface",
"$dsoftbus_root_path/third_party/dfinder/include",
"$dsoftbus_root_path/interfaces/kits/discovery",
"$dsoftbus_root_path/interfaces/kits/bus_center",
"$dsoftbus_root_path/interfaces/kits/common",
"//base/security/device_auth/interfaces/innerkits",
"//third_party/cJSON",
"$dsoftbus_root_path/core/adapter/bus_center/include",
"$dsoftbus_root_path/interfaces/kits/transport",
"$dsoftbus_root_path/core/common/include",
"$dsoftbus_root_path/interfaces/kits",
]
deps = [
"$dsoftbus_root_path/core/common:softbus_utils",
"$dsoftbus_root_path/core/frame:softbus_server",
"//third_party/googletest:gtest_main",
]
if (is_standard_system) {
external_deps = [
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
]
} else {
external_deps = [
"c_utils:utils",
"hilog:libhilog",
]
}
}
group("unittest") {
testonly = true
deps = [ ":TransProxyChannelCoreTest" ]
}

View File

@ -0,0 +1,151 @@
/*
* Copyright (c) 2021-2022 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <securec.h>
#include "gtest/gtest.h"
#include "session.h"
#include "softbus_errcode.h"
#include "softbus_json_utils.h"
#include "softbus_log.h"
#include "softbus_protocol_def.h"
#include "auth_interface.h"
#include "softbus_proxychannel_control.h"
#include "softbus_proxychannel_session.h"
#include "softbus_proxychannel_message.h"
using namespace testing::ext;
namespace OHOS {
class TransProxyChannelTest : public testing::Test {
public:
TransProxyChannelTest()
{}
~TransProxyChannelTest()
{}
static void SetUpTestCase(void);
static void TearDownTestCase(void);
void SetUp() override
{}
void TearDown() override
{}
};
void TransProxyChannelTest::SetUpTestCase(void)
{}
void TransProxyChannelTest::TearDownTestCase(void)
{}
/**
* @tc.name: TransProxySendMessageTest001
* @tc.desc: extern module active publish, use the wrong parameter.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransProxyChannelTest, TransProxySendMessageTest001, TestSize.Level1)
{
ProxyChannelInfo info;
const char *payLoad = "12345678";
uint32_t payLoadLen = strlen(payLoad);
info.appInfo.appType = APP_TYPE_AUTH;
info.myId = 0;
info.peerId = 0;
info.authId = AUTH_INVALID_ID;
int ret = TransProxySendMessage(&info, payLoad, payLoadLen, 0);
EXPECT_TRUE(ret != 0);
}
/**
* @tc.name: TransProxyHandshakeTest001
* @tc.desc: TransProxyHandshakeTest001, use the wrong parameter.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransProxyChannelTest, TransProxyHandshakeTest001, TestSize.Level1)
{
ProxyChannelInfo info;
info.appInfo.appType = APP_TYPE_NORMAL;
info.myId = 0;
info.peerId = 0;
info.channelId = INVALID_CHANNEL_ID;
int ret = TransProxyHandshake(&info);
EXPECT_TRUE(ret != 0);
}
/**
* @tc.name: TransProxyAckHandshakeTest001
* @tc.desc: TransProxyAckHandshake, use the wrong parameter.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransProxyChannelTest, TransProxyAckHandshakeTest001, TestSize.Level1)
{
ProxyChannelInfo info;
info.appInfo.appType = APP_TYPE_AUTH;
info.myId = 0;
info.peerId = 0;
info.authId = AUTH_INVALID_ID;
int ret = TransProxyAckHandshake(0, &info, SOFTBUS_ERR);
EXPECT_TRUE(ret != 0);
}
/**
* @tc.name: TransProxyAckKeepaliveTest001
* @tc.desc: TransProxyAckKeepaliveTest001, use the wrong parameter.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransProxyChannelTest, TransProxyAckKeepaliveTest001, TestSize.Level1)
{
ProxyChannelInfo info;
info.appInfo.appType = APP_TYPE_AUTH;
info.myId = 0;
info.peerId = 0;
info.authId = AUTH_INVALID_ID;
(void)strcpy_s(info.identity, sizeof(info.identity), "12345678");
int ret = TransProxyAckKeepalive(&info);
EXPECT_TRUE(ret != 0);
}
/**
* @tc.name: TransProxyResetPeerTest001
* @tc.desc: TransProxyResetPeerTest001, use the wrong parameter.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransProxyChannelTest, TransProxyResetPeerTest001, TestSize.Level1)
{
ProxyChannelInfo info;
info.appInfo.appType = APP_TYPE_AUTH;
info.myId = 0;
info.peerId = 0;
info.authId = AUTH_INVALID_ID;
(void)strcpy_s(info.identity, sizeof(info.identity), "12345678");
int ret = TransProxyResetPeer(&info);
EXPECT_TRUE(ret != 0);
}
} // namespace OHOS

View File

@ -75,6 +75,7 @@ ohos_unittest("TransTcpDirectCoreTest") {
]
deps = [
"$dsoftbus_root_path/core/common:softbus_utils",
"$dsoftbus_root_path/core/frame:softbus_server",
"//third_party/googletest:gtest_main",
]

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021-2022 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
@ -20,27 +20,18 @@
#include "softbus_errcode.h"
#include "softbus_json_utils.h"
#include "softbus_log.h"
#include "auth_interface.h"
#include "trans_tcp_direct_listener.h"
#include "trans_tcp_direct_manager.h"
#include "trans_tcp_direct_message.h"
#include "trans_tcp_direct_wifi.h"
#include "trans_tcp_direct_sessionconn.h"
#include "trans_tcp_direct_message.h"
#include "softbus_protocol_def.h"
#define TEST_ASSERT_TRUE(ret) \
if (ret) { \
LOG_INFO("[succ]:%d\n", __LINE__); \
printf("[succ]:%d\n", __LINE__); \
g_succTestCount++; \
} else { \
LOG_INFO("[error]:%d\n", __LINE__); \
printf("[error]:%d\n", __LINE__); \
g_failTestCount++; \
}
using namespace testing::ext;
namespace OHOS {
static int32_t g_succTestCount = 0;
static int32_t g_failTestCount = 0;
class TransTcpDirectTest : public testing::Test {
public:
@ -76,36 +67,36 @@ HWTEST_F(TransTcpDirectTest, StartSessionListenerTest001, TestSize.Level1)
.socketOption = {
.addr = "",
.port = 6000,
.protocol = LNN_PROTOCOL_IP,
.moduleId = DIRECT_CHANNEL_SERVER_WIFI
.moduleId = DIRECT_CHANNEL_SERVER_WIFI,
.protocol = LNN_PROTOCOL_IP
}
};
ret = TransTdcStartSessionListener(UNUSE_BUTT, &info);
TEST_ASSERT_TRUE(ret != 0);
EXPECT_TRUE(ret != 0);
LocalListenerInfo info2 = {
.type = CONNECT_TCP,
.socketOption = {
.addr = "192.168.8.119",
.port = -1,
.protocol = LNN_PROTOCOL_IP,
.moduleId = DIRECT_CHANNEL_SERVER_WIFI
.moduleId = DIRECT_CHANNEL_SERVER_WIFI,
.protocol = LNN_PROTOCOL_IP
}
};
ret = TransTdcStartSessionListener(DIRECT_CHANNEL_SERVER_WIFI, &info2);
TEST_ASSERT_TRUE(ret != 0);
EXPECT_TRUE(ret != 0);
LocalListenerInfo info3 = {
.type = CONNECT_TCP,
.socketOption = {
.addr = "",
.port = -1,
.protocol = LNN_PROTOCOL_IP,
.moduleId = DIRECT_CHANNEL_SERVER_WIFI
.moduleId = DIRECT_CHANNEL_SERVER_WIFI,
.protocol = LNN_PROTOCOL_IP
}
};
ret = TransTdcStartSessionListener(DIRECT_CHANNEL_SERVER_WIFI, &info3);
TEST_ASSERT_TRUE(ret != 0);
EXPECT_TRUE(ret != 0);
}
/**
@ -118,7 +109,7 @@ HWTEST_F(TransTcpDirectTest, StoptSessionListenerTest001, TestSize.Level1)
{
int ret = 0;
ret = TransTdcStopSessionListener(DIRECT_CHANNEL_SERVER_WIFI);
TEST_ASSERT_TRUE(ret != 0);
EXPECT_TRUE(ret != 0);
}
/**
@ -136,8 +127,8 @@ HWTEST_F(TransTcpDirectTest, OpenTcpDirectChannelTest001, TestSize.Level1)
.socketOption = {
.addr = {0},
.port = 6000,
.protocol = LNN_PROTOCOL_IP,
.moduleId = MODULE_MESSAGE_SERVICE
.moduleId = MODULE_MESSAGE_SERVICE,
.protocol = LNN_PROTOCOL_IP
}
};
(void)memset_s(&appInfo, sizeof(AppInfo), 0, sizeof(AppInfo));
@ -147,12 +138,116 @@ HWTEST_F(TransTcpDirectTest, OpenTcpDirectChannelTest001, TestSize.Level1)
int fd = 1;
ret = TransOpenDirectChannel(NULL, &connInfo, &fd);
TEST_ASSERT_TRUE(ret != 0);
EXPECT_TRUE(ret != 0);
ret = TransOpenDirectChannel(&appInfo, NULL, &fd);
TEST_ASSERT_TRUE(ret != 0);
EXPECT_TRUE(ret != 0);
ret = TransOpenDirectChannel(&appInfo, &connInfo, NULL);
TEST_ASSERT_TRUE(ret != 0);
EXPECT_TRUE(ret != 0);
}
/**
* @tc.name: OpenTcpDirectChannelTest002
* @tc.desc: extern module active publish, start channel with wrong parms.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransTcpDirectTest, OpenTcpDirectChannelTest002, TestSize.Level1)
{
int ret = 0;
AppInfo appInfo;
(void)memset_s(&appInfo, sizeof(AppInfo), 0, sizeof(AppInfo));
ConnectOption connInfo = {
.type = CONNECT_TCP,
.socketOption = {
.addr = {0},
.port = 6000,
.moduleId = MODULE_MESSAGE_SERVICE,
.protocol = LNN_PROTOCOL_IP
}
};
if (strcpy_s(connInfo.socketOption.addr, sizeof(connInfo.socketOption.addr), "192.168.8.1") != EOK) {
return;
}
int32_t channelId = 0;
ret = OpenTcpDirectChannel(&appInfo, &connInfo, &channelId);
EXPECT_TRUE(ret != 0);
}
/**
* @tc.name: TransTdcPostBytesTest001
* @tc.desc: TransTdcPostBytesTest, start with wrong parms.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransTcpDirectTest, TransTdcPostBytesTest001, TestSize.Level1)
{
int ret = 0;
const char *bytes = "Get Message";
TdcPacketHead packetHead = {
.magicNumber = MAGIC_NUMBER,
.module = MODULE_SESSION,
.seq = 0,
.flags = FLAG_REQUEST,
.dataLen = strlen(bytes), /* reset after encrypt */
};
int32_t channelId = 0;
ret = TransTdcPostBytes(channelId, NULL, bytes);
EXPECT_TRUE(ret != 0);
ret = TransTdcPostBytes(channelId, &packetHead, NULL);
EXPECT_TRUE(ret != 0);
packetHead.dataLen = 0;
ret = TransTdcPostBytes(channelId, &packetHead, bytes);
EXPECT_TRUE(ret != 0);
}
/**
* @tc.name: GetCipherFlagByAuthIdTest001
* @tc.desc: GetCipherFlagByAuthId, start channel with wrong parms.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransTcpDirectTest, GetCipherFlagByAuthIdTest001, TestSize.Level1)
{
int64_t authId = 0;
uint32_t flag = 0;
int ret = GetCipherFlagByAuthId(authId, &flag, NULL);
EXPECT_TRUE(ret != 0);
}
/**
* @tc.name: SessionConnListTest001
* @tc.desc: SessionConnListTest001, start channel with wrong parms.
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F(TransTcpDirectTest, SessionConnListTest001, TestSize.Level1)
{
SessionConn conn;
ListInit(&conn.node);
int ret = CreatSessionConnList();
ASSERT_TRUE(ret == SOFTBUS_OK);
ret = TransTdcAddSessionConn(&conn);
EXPECT_TRUE(ret == SOFTBUS_OK);
AppInfo appInfo;
ret = GetAppInfoById(conn.channelId, &appInfo);
EXPECT_TRUE(ret == SOFTBUS_OK);
ret = SetAuthIdByChanId(conn.channelId, 0);
EXPECT_TRUE(ret == SOFTBUS_OK);
int authId = GetAuthIdByChanId(conn.channelId);
EXPECT_TRUE(authId != AUTH_INVALID_ID);
DestroySoftBusList(GetSessionConnList());
}
} // namespace OHOS