1060ff233Sopenharmony_ci/* 2060ff233Sopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3060ff233Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4060ff233Sopenharmony_ci * you may not use this file except in compliance with the License. 5060ff233Sopenharmony_ci * You may obtain a copy of the License at 6060ff233Sopenharmony_ci * 7060ff233Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8060ff233Sopenharmony_ci * 9060ff233Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10060ff233Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11060ff233Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12060ff233Sopenharmony_ci * See the License for the specific language governing permissions and 13060ff233Sopenharmony_ci * limitations under the License. 14060ff233Sopenharmony_ci */ 15060ff233Sopenharmony_ci 16060ff233Sopenharmony_ci#include "securec.h" 17060ff233Sopenharmony_ci#include <gtest/gtest.h> 18060ff233Sopenharmony_ci 19060ff233Sopenharmony_ci#include "softbus_def.h" 20060ff233Sopenharmony_ci#include "softbus_adapter_mem.h" 21060ff233Sopenharmony_ci#include "trans_server_proxy.h" 22060ff233Sopenharmony_ci#include "trans_server_proxy_standard.cpp" 23060ff233Sopenharmony_ci#include "client_trans_session_manager.h" 24060ff233Sopenharmony_ci 25060ff233Sopenharmony_ciusing namespace testing::ext; 26060ff233Sopenharmony_ci 27060ff233Sopenharmony_cinamespace OHOS { 28060ff233Sopenharmony_ci#define INVALID_VALUE (-1) 29060ff233Sopenharmony_ci#define SESSIONKEY_LEN 32 30060ff233Sopenharmony_ci#define LEN 32 31060ff233Sopenharmony_cistatic const int32_t UUID = 0; 32060ff233Sopenharmony_cistatic const int32_t PID = 0; 33060ff233Sopenharmony_cistatic const char *g_sessionName = "ohos.distributedschedule.dms.test"; 34060ff233Sopenharmony_cistatic const char *g_peerSessionName = "ohos.distributedschedule.dms.test"; 35060ff233Sopenharmony_cistatic const char *g_peerDeviceId = "1000"; 36060ff233Sopenharmony_cistatic const char *g_peerNetworkId = "123456789"; 37060ff233Sopenharmony_cistatic const char *g_pkgName = "com.test.trans.session"; 38060ff233Sopenharmony_cistatic const char *g_addr = "192.168.8.1"; 39060ff233Sopenharmony_cistatic const uint16_t PORT = 10; 40060ff233Sopenharmony_cistatic const char *g_networkId = "ABCDEF00ABCDEF00ABCDEF00ABCDEF00ABCDEF00ABCDEF00ABCDEF00ABCDEF00"; 41060ff233Sopenharmony_cistatic const char *g_groupId = "TEST_GROUP_ID"; 42060ff233Sopenharmony_ci 43060ff233Sopenharmony_ciclass TransIpcStandardTest : public testing::Test { 44060ff233Sopenharmony_cipublic: 45060ff233Sopenharmony_ci TransIpcStandardTest() 46060ff233Sopenharmony_ci { 47060ff233Sopenharmony_ci } 48060ff233Sopenharmony_ci ~TransIpcStandardTest() 49060ff233Sopenharmony_ci { 50060ff233Sopenharmony_ci } 51060ff233Sopenharmony_ci static void SetUpTestCase(void); 52060ff233Sopenharmony_ci static void TearDownTestCase(void); 53060ff233Sopenharmony_ci void SetUp() override 54060ff233Sopenharmony_ci { 55060ff233Sopenharmony_ci } 56060ff233Sopenharmony_ci void TearDown() override 57060ff233Sopenharmony_ci { 58060ff233Sopenharmony_ci } 59060ff233Sopenharmony_ci}; 60060ff233Sopenharmony_ci 61060ff233Sopenharmony_civoid TransIpcStandardTest::SetUpTestCase(void) 62060ff233Sopenharmony_ci{ 63060ff233Sopenharmony_ci} 64060ff233Sopenharmony_ci 65060ff233Sopenharmony_civoid TransIpcStandardTest::TearDownTestCase(void) 66060ff233Sopenharmony_ci{ 67060ff233Sopenharmony_ci} 68060ff233Sopenharmony_ci 69060ff233Sopenharmony_ci/** 70060ff233Sopenharmony_ci * @tc.name: SoftbusRegisterServiceTest001 71060ff233Sopenharmony_ci * @tc.desc: SoftbusRegisterService, use the wrong parameter. 72060ff233Sopenharmony_ci * @tc.type: FUNC 73060ff233Sopenharmony_ci * @tc.require:I5HQGA 74060ff233Sopenharmony_ci */ 75060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, SoftbusRegisterServiceTest001, TestSize.Level0) 76060ff233Sopenharmony_ci{ 77060ff233Sopenharmony_ci SubscribeInfo* subInfo = (SubscribeInfo*)SoftBusCalloc(sizeof(SubscribeInfo)); 78060ff233Sopenharmony_ci ASSERT_TRUE(subInfo != nullptr); 79060ff233Sopenharmony_ci (void)memset_s(subInfo, sizeof(SubscribeInfo), 0, sizeof(SubscribeInfo)); 80060ff233Sopenharmony_ci PublishInfo* pubInfo = (PublishInfo*)SoftBusCalloc(sizeof(PublishInfo)); 81060ff233Sopenharmony_ci ASSERT_TRUE(pubInfo != nullptr); 82060ff233Sopenharmony_ci (void)memset_s(pubInfo, sizeof(PublishInfo), 0, sizeof(PublishInfo)); 83060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 84060ff233Sopenharmony_ci 85060ff233Sopenharmony_ci int32_t ret = transServerProxy.SoftbusRegisterService(g_pkgName, nullptr); 86060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 87060ff233Sopenharmony_ci SoftBusFree(subInfo); 88060ff233Sopenharmony_ci SoftBusFree(pubInfo); 89060ff233Sopenharmony_ci} 90060ff233Sopenharmony_ci 91060ff233Sopenharmony_ci/** 92060ff233Sopenharmony_ci * @tc.name: SoftbusRegisterServiceTest002 93060ff233Sopenharmony_ci * @tc.desc: SoftbusRegisterService, use the wrong parameter. 94060ff233Sopenharmony_ci * @tc.type: FUNC 95060ff233Sopenharmony_ci * @tc.require:I5HQGA 96060ff233Sopenharmony_ci */ 97060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, SoftbusRegisterServiceTest002, TestSize.Level0) 98060ff233Sopenharmony_ci{ 99060ff233Sopenharmony_ci uint32_t addrTypeLen = 1; 100060ff233Sopenharmony_ci void *info = nullptr; 101060ff233Sopenharmony_ci uint32_t infoTypeLen = 1; 102060ff233Sopenharmony_ci int32_t infoNum = 1; 103060ff233Sopenharmony_ci int32_t key = 1; 104060ff233Sopenharmony_ci unsigned char *buf = nullptr; 105060ff233Sopenharmony_ci uint16_t dataChangeFlag = 1; 106060ff233Sopenharmony_ci int32_t accuracy = 1; 107060ff233Sopenharmony_ci int32_t period = 1; 108060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 109060ff233Sopenharmony_ci 110060ff233Sopenharmony_ci int32_t ret = transServerProxy.JoinLNN(g_pkgName, (void *)g_addr, addrTypeLen); 111060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 112060ff233Sopenharmony_ci 113060ff233Sopenharmony_ci ret = transServerProxy.LeaveLNN(g_pkgName, g_networkId); 114060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 115060ff233Sopenharmony_ci 116060ff233Sopenharmony_ci ret = transServerProxy.GetAllOnlineNodeInfo(g_pkgName, &info, infoTypeLen, &infoNum); 117060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 118060ff233Sopenharmony_ci 119060ff233Sopenharmony_ci ret = transServerProxy.GetLocalDeviceInfo(g_pkgName, info, infoTypeLen); 120060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 121060ff233Sopenharmony_ci 122060ff233Sopenharmony_ci ret = transServerProxy.GetNodeKeyInfo(g_pkgName, g_networkId, key, buf, infoTypeLen); 123060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 124060ff233Sopenharmony_ci 125060ff233Sopenharmony_ci ret = transServerProxy.SetNodeDataChangeFlag(g_pkgName, g_networkId, dataChangeFlag); 126060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 127060ff233Sopenharmony_ci 128060ff233Sopenharmony_ci ret = transServerProxy.StartTimeSync(g_pkgName, g_networkId, accuracy, period); 129060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 130060ff233Sopenharmony_ci 131060ff233Sopenharmony_ci ret = transServerProxy.StopTimeSync(g_pkgName, g_networkId); 132060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_OK); 133060ff233Sopenharmony_ci} 134060ff233Sopenharmony_ci 135060ff233Sopenharmony_ci/** 136060ff233Sopenharmony_ci * @tc.name: CreateSessionServerTest001 137060ff233Sopenharmony_ci * @tc.desc: CreateSessionServer, use the wrong parameter. 138060ff233Sopenharmony_ci * @tc.type: FUNC 139060ff233Sopenharmony_ci * @tc.require:I5HQGA 140060ff233Sopenharmony_ci */ 141060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, CreateSessionServerTest001, TestSize.Level0) 142060ff233Sopenharmony_ci{ 143060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 144060ff233Sopenharmony_ci int32_t ret = transServerProxy.CreateSessionServer(nullptr, g_sessionName); 145060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 146060ff233Sopenharmony_ci 147060ff233Sopenharmony_ci ret = transServerProxy.CreateSessionServer(g_pkgName, nullptr); 148060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 149060ff233Sopenharmony_ci 150060ff233Sopenharmony_ci ret = transServerProxy.CreateSessionServer(g_pkgName, g_sessionName); 151060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 152060ff233Sopenharmony_ci} 153060ff233Sopenharmony_ci 154060ff233Sopenharmony_ci/** 155060ff233Sopenharmony_ci * @tc.name: RemoveSessionServerTest001 156060ff233Sopenharmony_ci * @tc.desc: RemoveSessionServer, use the wrong parameter. 157060ff233Sopenharmony_ci * @tc.type: FUNC 158060ff233Sopenharmony_ci * @tc.require:I5HQGA 159060ff233Sopenharmony_ci */ 160060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, RemoveSessionServerTest001, TestSize.Level0) 161060ff233Sopenharmony_ci{ 162060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 163060ff233Sopenharmony_ci int32_t ret = transServerProxy.RemoveSessionServer(nullptr, g_sessionName); 164060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 165060ff233Sopenharmony_ci 166060ff233Sopenharmony_ci ret = transServerProxy.RemoveSessionServer(g_pkgName, nullptr); 167060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 168060ff233Sopenharmony_ci 169060ff233Sopenharmony_ci ret = transServerProxy.RemoveSessionServer(g_pkgName, g_sessionName); 170060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 171060ff233Sopenharmony_ci} 172060ff233Sopenharmony_ci 173060ff233Sopenharmony_ci/** 174060ff233Sopenharmony_ci * @tc.name: OpenSessionTest001 175060ff233Sopenharmony_ci * @tc.desc: OpenSession, use the wrong parameter. 176060ff233Sopenharmony_ci * @tc.type: FUNC 177060ff233Sopenharmony_ci * @tc.require:I5HQGA 178060ff233Sopenharmony_ci */ 179060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, OpenSessionTest001, TestSize.Level0) 180060ff233Sopenharmony_ci{ 181060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 182060ff233Sopenharmony_ci SessionParam *param = (SessionParam*)SoftBusCalloc(sizeof(SessionParam)); 183060ff233Sopenharmony_ci TransInfo *info = (TransInfo*)SoftBusCalloc(sizeof(TransInfo)); 184060ff233Sopenharmony_ci ASSERT_TRUE(param != nullptr); 185060ff233Sopenharmony_ci ASSERT_TRUE(info != nullptr); 186060ff233Sopenharmony_ci (void)memset_s(param, sizeof(SessionParam), 0, sizeof(SessionParam)); 187060ff233Sopenharmony_ci (void)memset_s(info, sizeof(TransInfo), 0, sizeof(TransInfo)); 188060ff233Sopenharmony_ci param->sessionName = nullptr; 189060ff233Sopenharmony_ci param->peerSessionName = nullptr; 190060ff233Sopenharmony_ci param->peerDeviceId = nullptr; 191060ff233Sopenharmony_ci param->groupId = nullptr; 192060ff233Sopenharmony_ci 193060ff233Sopenharmony_ci int32_t ret = transServerProxy.OpenSession(param, info); 194060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 195060ff233Sopenharmony_ci 196060ff233Sopenharmony_ci param->sessionName = g_sessionName; 197060ff233Sopenharmony_ci ret = transServerProxy.OpenSession(param, info); 198060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 199060ff233Sopenharmony_ci 200060ff233Sopenharmony_ci param->peerSessionName = g_peerSessionName; 201060ff233Sopenharmony_ci ret = transServerProxy.OpenSession(param, info); 202060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 203060ff233Sopenharmony_ci 204060ff233Sopenharmony_ci param->peerDeviceId = g_peerDeviceId; 205060ff233Sopenharmony_ci ret = transServerProxy.OpenSession(param, info); 206060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 207060ff233Sopenharmony_ci 208060ff233Sopenharmony_ci param->groupId = g_groupId; 209060ff233Sopenharmony_ci ret = transServerProxy.OpenSession(param, info); 210060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 211060ff233Sopenharmony_ci 212060ff233Sopenharmony_ci SessionAttribute sessionAttribute; 213060ff233Sopenharmony_ci sessionAttribute.dataType = 1; 214060ff233Sopenharmony_ci sessionAttribute.linkTypeNum= 1; 215060ff233Sopenharmony_ci param->attr = &sessionAttribute; 216060ff233Sopenharmony_ci ret = transServerProxy.OpenSession(param, info); 217060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 218060ff233Sopenharmony_ci SoftBusFree(param); 219060ff233Sopenharmony_ci SoftBusFree(info); 220060ff233Sopenharmony_ci} 221060ff233Sopenharmony_ci 222060ff233Sopenharmony_ci/** 223060ff233Sopenharmony_ci * @tc.name: OpenAuthSessionTest001 224060ff233Sopenharmony_ci * @tc.desc: OpenAuthSession, use the wrong parameter. 225060ff233Sopenharmony_ci * @tc.type: FUNC 226060ff233Sopenharmony_ci * @tc.require:I5HQGA 227060ff233Sopenharmony_ci */ 228060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, OpenAuthSessionTest001, TestSize.Level0) 229060ff233Sopenharmony_ci{ 230060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 231060ff233Sopenharmony_ci ConnectionAddr *addrInfo = (ConnectionAddr*)SoftBusCalloc(sizeof(ConnectionAddr)); 232060ff233Sopenharmony_ci ASSERT_TRUE(addrInfo != nullptr); 233060ff233Sopenharmony_ci (void)memset_s(addrInfo, sizeof(ConnectionAddr), 0, sizeof(ConnectionAddr)); 234060ff233Sopenharmony_ci addrInfo->type = CONNECTION_ADDR_WLAN; 235060ff233Sopenharmony_ci (void)memcpy_s(addrInfo->info.ip.ip, strlen(addrInfo->info.ip.ip), g_addr, strlen(g_addr)); 236060ff233Sopenharmony_ci addrInfo->info.ip.port = PORT; 237060ff233Sopenharmony_ci int32_t ret = transServerProxy.OpenAuthSession(nullptr, addrInfo); 238060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 239060ff233Sopenharmony_ci 240060ff233Sopenharmony_ci ret = transServerProxy.OpenAuthSession(g_sessionName, nullptr); 241060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 242060ff233Sopenharmony_ci 243060ff233Sopenharmony_ci ret = transServerProxy.OpenAuthSession(g_sessionName, addrInfo); 244060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_REMOTE_NULL); 245060ff233Sopenharmony_ci SoftBusFree(addrInfo); 246060ff233Sopenharmony_ci} 247060ff233Sopenharmony_ci 248060ff233Sopenharmony_ci/** 249060ff233Sopenharmony_ci * @tc.name: NotifyAuthSuccessTest001 250060ff233Sopenharmony_ci * @tc.desc: NotifyAuthSuccess, use the wrong parameter. 251060ff233Sopenharmony_ci * @tc.type: FUNC 252060ff233Sopenharmony_ci * @tc.require:I5HQGA 253060ff233Sopenharmony_ci */ 254060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, NotifyAuthSuccessTest001, TestSize.Level0) 255060ff233Sopenharmony_ci{ 256060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 257060ff233Sopenharmony_ci int32_t channelId = 0; 258060ff233Sopenharmony_ci int32_t channelType = CHANNEL_TYPE_AUTH; 259060ff233Sopenharmony_ci int32_t ret = transServerProxy.NotifyAuthSuccess(channelId, channelType); 260060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 261060ff233Sopenharmony_ci 262060ff233Sopenharmony_ci channelId = INVALID_VALUE; 263060ff233Sopenharmony_ci ret = transServerProxy.NotifyAuthSuccess(channelId, channelType); 264060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 265060ff233Sopenharmony_ci} 266060ff233Sopenharmony_ci 267060ff233Sopenharmony_ci/** 268060ff233Sopenharmony_ci * @tc.name: CloseChannelTest001 269060ff233Sopenharmony_ci * @tc.desc: CloseChannel, use the wrong parameter. 270060ff233Sopenharmony_ci * @tc.type: FUNC 271060ff233Sopenharmony_ci * @tc.require:I5HQGA 272060ff233Sopenharmony_ci */ 273060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, CloseChannelTest001, TestSize.Level0) 274060ff233Sopenharmony_ci{ 275060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 276060ff233Sopenharmony_ci int32_t channelId = -1; 277060ff233Sopenharmony_ci int32_t channelType = CHANNEL_TYPE_AUTH; 278060ff233Sopenharmony_ci int32_t ret = transServerProxy.CloseChannel(nullptr, channelId, channelType); 279060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 280060ff233Sopenharmony_ci} 281060ff233Sopenharmony_ci 282060ff233Sopenharmony_ci/** 283060ff233Sopenharmony_ci * @tc.name: SendMessageTest001 284060ff233Sopenharmony_ci * @tc.desc: SendMessage, use the wrong parameter. 285060ff233Sopenharmony_ci * @tc.type: FUNC 286060ff233Sopenharmony_ci * @tc.require:I5HQGA 287060ff233Sopenharmony_ci */ 288060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, SendMessageTest001, TestSize.Level0) 289060ff233Sopenharmony_ci{ 290060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 291060ff233Sopenharmony_ci int32_t channelId = 0; 292060ff233Sopenharmony_ci int32_t channelType = CHANNEL_TYPE_AUTH; 293060ff233Sopenharmony_ci const char *dataInfo = "datainfo"; 294060ff233Sopenharmony_ci uint32_t len = LEN; 295060ff233Sopenharmony_ci int32_t msgType = TRANS_SESSION_BYTES; 296060ff233Sopenharmony_ci int32_t ret = transServerProxy.SendMessage(channelId, channelType, (const void *)dataInfo, len, msgType); 297060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_REMOTE_NULL); 298060ff233Sopenharmony_ci 299060ff233Sopenharmony_ci ret = transServerProxy.SendMessage(channelId, channelType, nullptr, len, msgType); 300060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_REMOTE_NULL); 301060ff233Sopenharmony_ci} 302060ff233Sopenharmony_ci 303060ff233Sopenharmony_ci/** 304060ff233Sopenharmony_ci * @tc.name: QosReportTest001 305060ff233Sopenharmony_ci * @tc.desc: SendMessage, use the wrong parameter. 306060ff233Sopenharmony_ci * @tc.type: FUNC 307060ff233Sopenharmony_ci * @tc.require:I5HQGA 308060ff233Sopenharmony_ci */ 309060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, QosReportTest001, TestSize.Level0) 310060ff233Sopenharmony_ci{ 311060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 312060ff233Sopenharmony_ci int32_t channelId = 1; 313060ff233Sopenharmony_ci int32_t channelType = CHANNEL_TYPE_BUTT; 314060ff233Sopenharmony_ci int32_t appType = 0; 315060ff233Sopenharmony_ci int32_t quality = QOS_IMPROVE; 316060ff233Sopenharmony_ci int32_t ret = transServerProxy.QosReport(channelId, channelType, appType, quality); 317060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 318060ff233Sopenharmony_ci 319060ff233Sopenharmony_ci channelId = INVALID_VALUE; 320060ff233Sopenharmony_ci ret = transServerProxy.QosReport(channelId, channelType, appType, quality); 321060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 322060ff233Sopenharmony_ci} 323060ff233Sopenharmony_ci 324060ff233Sopenharmony_ci/** 325060ff233Sopenharmony_ci * @tc.name: StreamStatsTest001 326060ff233Sopenharmony_ci * @tc.desc: StreamStats, use the wrong parameter. 327060ff233Sopenharmony_ci * @tc.type: FUNC 328060ff233Sopenharmony_ci * @tc.require:I5HQGA 329060ff233Sopenharmony_ci */ 330060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, StreamStatsTest001, TestSize.Level0) 331060ff233Sopenharmony_ci{ 332060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 333060ff233Sopenharmony_ci int32_t channelId = INVALID_VALUE; 334060ff233Sopenharmony_ci int32_t channelType = CHANNEL_TYPE_BUTT; 335060ff233Sopenharmony_ci StreamSendStats *statsData = (StreamSendStats*)SoftBusCalloc(sizeof(StreamSendStats)); 336060ff233Sopenharmony_ci ASSERT_TRUE(statsData != nullptr); 337060ff233Sopenharmony_ci (void)memset_s(statsData, sizeof(StreamSendStats), 0, sizeof(StreamSendStats)); 338060ff233Sopenharmony_ci 339060ff233Sopenharmony_ci int32_t ret = transServerProxy.StreamStats(channelId, channelType, nullptr); 340060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 341060ff233Sopenharmony_ci 342060ff233Sopenharmony_ci channelId = INVALID_VALUE; 343060ff233Sopenharmony_ci ret = transServerProxy.StreamStats(channelId, channelType, statsData); 344060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED); 345060ff233Sopenharmony_ci SoftBusFree(statsData); 346060ff233Sopenharmony_ci} 347060ff233Sopenharmony_ci 348060ff233Sopenharmony_ci/** 349060ff233Sopenharmony_ci * @tc.name: RippleStatsTest0011 350060ff233Sopenharmony_ci * @tc.desc: RippleStats, use the wrong parameter. 351060ff233Sopenharmony_ci * @tc.type: FUNC 352060ff233Sopenharmony_ci * @tc.require:I5HQGA 353060ff233Sopenharmony_ci */ 354060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, RippleStatsTest0011, TestSize.Level0) 355060ff233Sopenharmony_ci{ 356060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 357060ff233Sopenharmony_ci int32_t channelId = INVALID_VALUE; 358060ff233Sopenharmony_ci int32_t channelType = CHANNEL_TYPE_BUTT; 359060ff233Sopenharmony_ci TrafficStats *statsData = (TrafficStats*)SoftBusCalloc(sizeof(TrafficStats)); 360060ff233Sopenharmony_ci ASSERT_TRUE(statsData != nullptr); 361060ff233Sopenharmony_ci (void)memset_s(statsData, sizeof(TrafficStats), 0, sizeof(TrafficStats)); 362060ff233Sopenharmony_ci 363060ff233Sopenharmony_ci int32_t ret = transServerProxy.RippleStats(channelId, channelType, nullptr); 364060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 365060ff233Sopenharmony_ci 366060ff233Sopenharmony_ci channelId = INVALID_VALUE; 367060ff233Sopenharmony_ci ret = transServerProxy.RippleStats(channelId, channelType, statsData); 368060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 369060ff233Sopenharmony_ci SoftBusFree(statsData); 370060ff233Sopenharmony_ci} 371060ff233Sopenharmony_ci 372060ff233Sopenharmony_ci/** 373060ff233Sopenharmony_ci * @tc.name: GrantPermissionTest001 374060ff233Sopenharmony_ci * @tc.desc: GrantPermission, use the wrong parameter. 375060ff233Sopenharmony_ci * @tc.type: FUNC 376060ff233Sopenharmony_ci * @tc.require:I5HQGA 377060ff233Sopenharmony_ci */ 378060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, GrantPermissionTest001, TestSize.Level0) 379060ff233Sopenharmony_ci{ 380060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 381060ff233Sopenharmony_ci int32_t ret = transServerProxy.GrantPermission(UUID, PID, nullptr); 382060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITECSTRING_FAILED); 383060ff233Sopenharmony_ci 384060ff233Sopenharmony_ci ret = transServerProxy.GrantPermission(UUID, PID, g_sessionName); 385060ff233Sopenharmony_ci EXPECT_EQ(SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED, ret); 386060ff233Sopenharmony_ci} 387060ff233Sopenharmony_ci 388060ff233Sopenharmony_ci/** 389060ff233Sopenharmony_ci * @tc.name: RemovePermissionTest001 390060ff233Sopenharmony_ci * @tc.desc: RemovePermission, use the wrong parameter. 391060ff233Sopenharmony_ci * @tc.type: FUNC 392060ff233Sopenharmony_ci * @tc.require:I5HQGA 393060ff233Sopenharmony_ci */ 394060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, RemovePermissionTest001, TestSize.Level0) 395060ff233Sopenharmony_ci{ 396060ff233Sopenharmony_ci TransServerProxy transServerProxy(nullptr); 397060ff233Sopenharmony_ci int32_t ret = transServerProxy.RemovePermission(g_sessionName); 398060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED); 399060ff233Sopenharmony_ci 400060ff233Sopenharmony_ci ret = transServerProxy.RemovePermission(g_sessionName); 401060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED); 402060ff233Sopenharmony_ci} 403060ff233Sopenharmony_ci 404060ff233Sopenharmony_ci/** 405060ff233Sopenharmony_ci * @tc.name: ServerIpcCreateSessionServerTest001 406060ff233Sopenharmony_ci * @tc.desc: ServerIpcCreateSessionServer, use the wrong parameter. 407060ff233Sopenharmony_ci * @tc.type: FUNC 408060ff233Sopenharmony_ci * @tc.require:I5HQGA 409060ff233Sopenharmony_ci */ 410060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcCreateSessionServerTest001, TestSize.Level0) 411060ff233Sopenharmony_ci{ 412060ff233Sopenharmony_ci int32_t ret = ServerIpcCreateSessionServer(g_pkgName, g_sessionName); 413060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 414060ff233Sopenharmony_ci 415060ff233Sopenharmony_ci ret = TransServerProxyInit(); 416060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 417060ff233Sopenharmony_ci 418060ff233Sopenharmony_ci ret = ServerIpcCreateSessionServer(nullptr, g_sessionName); 419060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 420060ff233Sopenharmony_ci 421060ff233Sopenharmony_ci ret = ServerIpcCreateSessionServer(g_pkgName, nullptr); 422060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 423060ff233Sopenharmony_ci 424060ff233Sopenharmony_ci ret = ServerIpcCreateSessionServer(g_pkgName, g_sessionName); 425060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 426060ff233Sopenharmony_ci 427060ff233Sopenharmony_ci TransClientDeinit(); 428060ff233Sopenharmony_ci} 429060ff233Sopenharmony_ci 430060ff233Sopenharmony_ci/** 431060ff233Sopenharmony_ci * @tc.name: ServerIpcRemoveSessionServerTest001 432060ff233Sopenharmony_ci * @tc.desc: ServerIpcRemoveSessionServer, use the wrong parameter. 433060ff233Sopenharmony_ci * @tc.type: FUNC 434060ff233Sopenharmony_ci * @tc.require:I5HQGA 435060ff233Sopenharmony_ci */ 436060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcRemoveSessionServerTest001, TestSize.Level0) 437060ff233Sopenharmony_ci{ 438060ff233Sopenharmony_ci int32_t ret = ServerIpcRemoveSessionServer(g_pkgName, g_sessionName); 439060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 440060ff233Sopenharmony_ci 441060ff233Sopenharmony_ci ret = TransServerProxyInit(); 442060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 443060ff233Sopenharmony_ci 444060ff233Sopenharmony_ci ret = ServerIpcRemoveSessionServer(nullptr, g_sessionName); 445060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 446060ff233Sopenharmony_ci 447060ff233Sopenharmony_ci ret = ServerIpcRemoveSessionServer(g_pkgName, nullptr); 448060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 449060ff233Sopenharmony_ci 450060ff233Sopenharmony_ci ret = ServerIpcRemoveSessionServer(g_pkgName, g_sessionName); 451060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 452060ff233Sopenharmony_ci 453060ff233Sopenharmony_ci TransClientDeinit(); 454060ff233Sopenharmony_ci} 455060ff233Sopenharmony_ci 456060ff233Sopenharmony_ci/** 457060ff233Sopenharmony_ci * @tc.name: ServerIpcOpenSessionTest001 458060ff233Sopenharmony_ci * @tc.desc: ServerIpcOpenSession, use the wrong parameter. 459060ff233Sopenharmony_ci * @tc.type: FUNC 460060ff233Sopenharmony_ci * @tc.require:I5HQGA 461060ff233Sopenharmony_ci */ 462060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcOpenSessionTest001, TestSize.Level0) 463060ff233Sopenharmony_ci{ 464060ff233Sopenharmony_ci TransInfo* info = (TransInfo*)SoftBusCalloc(sizeof(TransInfo)); 465060ff233Sopenharmony_ci ASSERT_TRUE(info != nullptr); 466060ff233Sopenharmony_ci (void)memset_s(info, sizeof(TransInfo), 0, sizeof(TransInfo)); 467060ff233Sopenharmony_ci SessionParam* param = (SessionParam*)SoftBusCalloc(sizeof(SessionParam)); 468060ff233Sopenharmony_ci ASSERT_TRUE(param != nullptr); 469060ff233Sopenharmony_ci (void)memset_s(param, sizeof(SessionParam), 0, sizeof(SessionParam)); 470060ff233Sopenharmony_ci param->sessionName = nullptr; 471060ff233Sopenharmony_ci param->peerSessionName = nullptr; 472060ff233Sopenharmony_ci param->peerDeviceId = nullptr; 473060ff233Sopenharmony_ci param->groupId = nullptr; 474060ff233Sopenharmony_ci param->attr = nullptr; 475060ff233Sopenharmony_ci 476060ff233Sopenharmony_ci int32_t sessionId = INVALID_SESSION_ID; 477060ff233Sopenharmony_ci int32_t ret = ServerIpcOpenSession(param, info); 478060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 479060ff233Sopenharmony_ci 480060ff233Sopenharmony_ci TransClientDeinit(); 481060ff233Sopenharmony_ci ret = TransServerProxyInit(); 482060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 483060ff233Sopenharmony_ci 484060ff233Sopenharmony_ci param->sessionName = g_sessionName; 485060ff233Sopenharmony_ci ret = ServerIpcOpenSession(param, info); 486060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 487060ff233Sopenharmony_ci (void)ClientDeleteSession(sessionId); 488060ff233Sopenharmony_ci 489060ff233Sopenharmony_ci param->peerSessionName = g_peerSessionName; 490060ff233Sopenharmony_ci ret = ServerIpcOpenSession(param, info); 491060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 492060ff233Sopenharmony_ci (void)ClientDeleteSession(sessionId); 493060ff233Sopenharmony_ci 494060ff233Sopenharmony_ci param->peerDeviceId = g_peerDeviceId; 495060ff233Sopenharmony_ci ret = ServerIpcOpenSession(param, info); 496060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 497060ff233Sopenharmony_ci (void)ClientDeleteSession(sessionId); 498060ff233Sopenharmony_ci 499060ff233Sopenharmony_ci param->groupId = g_groupId; 500060ff233Sopenharmony_ci ret = ServerIpcOpenSession(param, info); 501060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 502060ff233Sopenharmony_ci (void)ClientDeleteSession(sessionId); 503060ff233Sopenharmony_ci 504060ff233Sopenharmony_ci SessionAttribute sessionAttribute; 505060ff233Sopenharmony_ci sessionAttribute.dataType = 1; 506060ff233Sopenharmony_ci sessionAttribute.linkTypeNum = 1; 507060ff233Sopenharmony_ci param->attr = &sessionAttribute; 508060ff233Sopenharmony_ci ret = ServerIpcOpenSession(param, info); 509060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 510060ff233Sopenharmony_ci (void)ClientDeleteSession(sessionId); 511060ff233Sopenharmony_ci 512060ff233Sopenharmony_ci TransClientDeinit(); 513060ff233Sopenharmony_ci SoftBusFree(param); 514060ff233Sopenharmony_ci SoftBusFree(info); 515060ff233Sopenharmony_ci} 516060ff233Sopenharmony_ci 517060ff233Sopenharmony_ci/** 518060ff233Sopenharmony_ci * @tc.name: ServerIpcOpenAuthSessionTest001 519060ff233Sopenharmony_ci * @tc.desc: ServerIpcOpenAuthSession, use the wrong parameter. 520060ff233Sopenharmony_ci * @tc.type: FUNC 521060ff233Sopenharmony_ci * @tc.require:I5HQGA 522060ff233Sopenharmony_ci */ 523060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcOpenAuthSessionTest001, TestSize.Level0) 524060ff233Sopenharmony_ci{ 525060ff233Sopenharmony_ci ConnectionAddr* addrInfo = (ConnectionAddr*)SoftBusCalloc(sizeof(ConnectionAddr)); 526060ff233Sopenharmony_ci ASSERT_TRUE(addrInfo != nullptr); 527060ff233Sopenharmony_ci (void)memset_s(addrInfo, sizeof(ConnectionAddr), 0, sizeof(ConnectionAddr)); 528060ff233Sopenharmony_ci addrInfo->type = CONNECTION_ADDR_BR; 529060ff233Sopenharmony_ci int32_t ret = ServerIpcOpenAuthSession(g_sessionName, addrInfo); 530060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_NO_INIT); 531060ff233Sopenharmony_ci 532060ff233Sopenharmony_ci ret = TransServerProxyInit(); 533060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 534060ff233Sopenharmony_ci 535060ff233Sopenharmony_ci ret = ServerIpcOpenAuthSession(nullptr, addrInfo); 536060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 537060ff233Sopenharmony_ci 538060ff233Sopenharmony_ci ret = ServerIpcOpenAuthSession(g_sessionName, nullptr); 539060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 540060ff233Sopenharmony_ci 541060ff233Sopenharmony_ci ret = ServerIpcOpenAuthSession(g_sessionName, addrInfo); 542060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_NO_INIT); 543060ff233Sopenharmony_ci 544060ff233Sopenharmony_ci TransClientDeinit(); 545060ff233Sopenharmony_ci SoftBusFree(addrInfo); 546060ff233Sopenharmony_ci} 547060ff233Sopenharmony_ci 548060ff233Sopenharmony_ci/** 549060ff233Sopenharmony_ci * @tc.name: ServerIpcNotifyAuthSuccessTest001 550060ff233Sopenharmony_ci * @tc.desc: ServerIpcNotifyAuthSuccess, use the wrong parameter. 551060ff233Sopenharmony_ci * @tc.type: FUNC 552060ff233Sopenharmony_ci * @tc.require:I5HQGA 553060ff233Sopenharmony_ci */ 554060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcNotifyAuthSuccessTest001, TestSize.Level0) 555060ff233Sopenharmony_ci{ 556060ff233Sopenharmony_ci int32_t ret = TransServerProxyInit(); 557060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 558060ff233Sopenharmony_ci 559060ff233Sopenharmony_ci int32_t channelId = 0; 560060ff233Sopenharmony_ci int32_t channelType = CHANNEL_TYPE_AUTH; 561060ff233Sopenharmony_ci ret = ServerIpcNotifyAuthSuccess(channelId, channelType); 562060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 563060ff233Sopenharmony_ci TransClientDeinit(); 564060ff233Sopenharmony_ci} 565060ff233Sopenharmony_ci 566060ff233Sopenharmony_ci/** 567060ff233Sopenharmony_ci * @tc.name: ServerIpcCloseChannelTest001 568060ff233Sopenharmony_ci * @tc.desc: ServerIpcCloseChannel, use the wrong parameter. 569060ff233Sopenharmony_ci * @tc.type: FUNC 570060ff233Sopenharmony_ci * @tc.require:I5HQGA 571060ff233Sopenharmony_ci */ 572060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcCloseChannelTest001, TestSize.Level0) 573060ff233Sopenharmony_ci{ 574060ff233Sopenharmony_ci int32_t channelId = 0; 575060ff233Sopenharmony_ci int32_t chanType = CHANNEL_TYPE_AUTH; 576060ff233Sopenharmony_ci int32_t ret = ServerIpcCloseChannel(nullptr, channelId, chanType); 577060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 578060ff233Sopenharmony_ci 579060ff233Sopenharmony_ci ret = TransServerProxyInit(); 580060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 581060ff233Sopenharmony_ci 582060ff233Sopenharmony_ci ret = ServerIpcCloseChannel(nullptr, -1, chanType); 583060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 584060ff233Sopenharmony_ci 585060ff233Sopenharmony_ci ret = ServerIpcCloseChannel(nullptr, channelId, chanType); 586060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 587060ff233Sopenharmony_ci 588060ff233Sopenharmony_ci TransClientDeinit(); 589060ff233Sopenharmony_ci} 590060ff233Sopenharmony_ci 591060ff233Sopenharmony_ci/** 592060ff233Sopenharmony_ci * @tc.name: ServerIpcCloseChannelWithStatisticsTest001 593060ff233Sopenharmony_ci * @tc.desc: ServerIpcCloseChannelWithStatistics, use the wrong parameter. 594060ff233Sopenharmony_ci * @tc.type: FUNC 595060ff233Sopenharmony_ci * @tc.require:I5HQGA 596060ff233Sopenharmony_ci */ 597060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcCloseChannelWithStatisticsTest001, TestSize.Level0) 598060ff233Sopenharmony_ci{ 599060ff233Sopenharmony_ci int32_t channelId = -1; 600060ff233Sopenharmony_ci int32_t channelType = 0; 601060ff233Sopenharmony_ci int32_t laneId = 0; 602060ff233Sopenharmony_ci const char *dataInfo = "dataInfo"; 603060ff233Sopenharmony_ci uint32_t length = strlen(dataInfo); 604060ff233Sopenharmony_ci 605060ff233Sopenharmony_ci int32_t ret = ServerIpcCloseChannelWithStatistics(channelId, channelType, laneId, (void *)dataInfo, length); 606060ff233Sopenharmony_ci EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret); 607060ff233Sopenharmony_ci} 608060ff233Sopenharmony_ci 609060ff233Sopenharmony_ci/** 610060ff233Sopenharmony_ci * @tc.name: ServerIpcSendMessageTest001 611060ff233Sopenharmony_ci * @tc.desc: ServerIpcSendMessage, use the wrong parameter. 612060ff233Sopenharmony_ci * @tc.type: FUNC 613060ff233Sopenharmony_ci * @tc.require:I5HQGA 614060ff233Sopenharmony_ci */ 615060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcSendMessageTest001, TestSize.Level0) 616060ff233Sopenharmony_ci{ 617060ff233Sopenharmony_ci int32_t channelId = 0; 618060ff233Sopenharmony_ci int32_t chanType = CHANNEL_TYPE_AUTH; 619060ff233Sopenharmony_ci int32_t ret = ServerIpcSendMessage(channelId, chanType, nullptr, 0, 0); 620060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 621060ff233Sopenharmony_ci 622060ff233Sopenharmony_ci ret = TransServerProxyInit(); 623060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 624060ff233Sopenharmony_ci 625060ff233Sopenharmony_ci ret = ServerIpcSendMessage(channelId, chanType, nullptr, 0, 0); 626060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 627060ff233Sopenharmony_ci 628060ff233Sopenharmony_ci TransClientDeinit(); 629060ff233Sopenharmony_ci} 630060ff233Sopenharmony_ci 631060ff233Sopenharmony_ci/** 632060ff233Sopenharmony_ci * @tc.name: ServerIpcQosReportTest001 633060ff233Sopenharmony_ci * @tc.desc: ServerIpcQosReport, use the wrong parameter. 634060ff233Sopenharmony_ci * @tc.type: FUNC 635060ff233Sopenharmony_ci * @tc.require:I5HQGA 636060ff233Sopenharmony_ci */ 637060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcQosReportTest001, TestSize.Level0) 638060ff233Sopenharmony_ci{ 639060ff233Sopenharmony_ci int32_t channelId = 0; 640060ff233Sopenharmony_ci int32_t chanType = CHANNEL_TYPE_AUTH; 641060ff233Sopenharmony_ci int32_t appType = 0; 642060ff233Sopenharmony_ci int32_t quality = QOS_IMPROVE; 643060ff233Sopenharmony_ci int32_t ret = ServerIpcQosReport(channelId, chanType, appType, quality); 644060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 645060ff233Sopenharmony_ci 646060ff233Sopenharmony_ci ret = TransServerProxyInit(); 647060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 648060ff233Sopenharmony_ci 649060ff233Sopenharmony_ci ret = ServerIpcQosReport(channelId, chanType, appType, quality); 650060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_ACCESS_TOKEN_DENIED); 651060ff233Sopenharmony_ci 652060ff233Sopenharmony_ci TransClientDeinit(); 653060ff233Sopenharmony_ci} 654060ff233Sopenharmony_ci 655060ff233Sopenharmony_ci/** 656060ff233Sopenharmony_ci * @tc.name: ServerIpcStreamStatsTest001 657060ff233Sopenharmony_ci * @tc.desc: ServerIpcStreamStats, use the wrong parameter. 658060ff233Sopenharmony_ci * @tc.type: FUNC 659060ff233Sopenharmony_ci * @tc.require:I5HQGA 660060ff233Sopenharmony_ci */ 661060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcStreamStatsTest001, TestSize.Level0) 662060ff233Sopenharmony_ci{ 663060ff233Sopenharmony_ci int32_t channelId = 0; 664060ff233Sopenharmony_ci int32_t chanType = CHANNEL_TYPE_AUTH; 665060ff233Sopenharmony_ci int32_t ret = ServerIpcStreamStats(channelId, chanType, nullptr); 666060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 667060ff233Sopenharmony_ci 668060ff233Sopenharmony_ci ret = TransServerProxyInit(); 669060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 670060ff233Sopenharmony_ci 671060ff233Sopenharmony_ci ret = ServerIpcStreamStats(channelId, chanType, nullptr); 672060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 673060ff233Sopenharmony_ci 674060ff233Sopenharmony_ci TransClientDeinit(); 675060ff233Sopenharmony_ci} 676060ff233Sopenharmony_ci 677060ff233Sopenharmony_ci/** 678060ff233Sopenharmony_ci * @tc.name: ServerIpcRippleStatsTest001 679060ff233Sopenharmony_ci * @tc.desc: ServerIpcRippleStats, use the wrong parameter. 680060ff233Sopenharmony_ci * @tc.type: FUNC 681060ff233Sopenharmony_ci * @tc.require:I5HQGA 682060ff233Sopenharmony_ci */ 683060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcRippleStatsTest001, TestSize.Level0) 684060ff233Sopenharmony_ci{ 685060ff233Sopenharmony_ci int32_t channelId = 0; 686060ff233Sopenharmony_ci int32_t chanType = CHANNEL_TYPE_AUTH; 687060ff233Sopenharmony_ci int32_t ret = ServerIpcRippleStats(channelId, chanType, nullptr); 688060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 689060ff233Sopenharmony_ci 690060ff233Sopenharmony_ci ret = TransServerProxyInit(); 691060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 692060ff233Sopenharmony_ci 693060ff233Sopenharmony_ci ret = ServerIpcRippleStats(channelId, chanType, nullptr); 694060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_WRITERAWDATA_FAILED); 695060ff233Sopenharmony_ci 696060ff233Sopenharmony_ci TransClientDeinit(); 697060ff233Sopenharmony_ci} 698060ff233Sopenharmony_ci 699060ff233Sopenharmony_ci/** 700060ff233Sopenharmony_ci * @tc.name: ServerIpcGrantPermissionTest001 701060ff233Sopenharmony_ci * @tc.desc: ServerIpcGrantPermission, use the wrong parameter. 702060ff233Sopenharmony_ci * @tc.type: FUNC 703060ff233Sopenharmony_ci * @tc.require:I5HQGA 704060ff233Sopenharmony_ci */ 705060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcGrantPermissionTest001, TestSize.Level0) 706060ff233Sopenharmony_ci{ 707060ff233Sopenharmony_ci int32_t uid = 1; 708060ff233Sopenharmony_ci int32_t pid = 1; 709060ff233Sopenharmony_ci int32_t ret = ServerIpcGrantPermission(uid, pid, nullptr); 710060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 711060ff233Sopenharmony_ci 712060ff233Sopenharmony_ci ret = TransServerProxyInit(); 713060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 714060ff233Sopenharmony_ci 715060ff233Sopenharmony_ci ret = ServerIpcGrantPermission(uid, pid, nullptr); 716060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 717060ff233Sopenharmony_ci 718060ff233Sopenharmony_ci ret = ServerIpcGrantPermission(uid, pid, g_sessionName); 719060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED); 720060ff233Sopenharmony_ci 721060ff233Sopenharmony_ci TransClientDeinit(); 722060ff233Sopenharmony_ci} 723060ff233Sopenharmony_ci 724060ff233Sopenharmony_ci/** 725060ff233Sopenharmony_ci * @tc.name: ServerIpcRemovePermissionTest001 726060ff233Sopenharmony_ci * @tc.desc: ServerIpcRemovePermission, use the wrong parameter. 727060ff233Sopenharmony_ci * @tc.type: FUNC 728060ff233Sopenharmony_ci * @tc.require:I5HQGA 729060ff233Sopenharmony_ci */ 730060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcRemovePermissionTest001, TestSize.Level0) 731060ff233Sopenharmony_ci{ 732060ff233Sopenharmony_ci int32_t ret = ServerIpcRemovePermission(nullptr); 733060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 734060ff233Sopenharmony_ci 735060ff233Sopenharmony_ci ret = TransServerProxyInit(); 736060ff233Sopenharmony_ci ASSERT_EQ(ret, SOFTBUS_OK); 737060ff233Sopenharmony_ci 738060ff233Sopenharmony_ci ret = ServerIpcRemovePermission(nullptr); 739060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM); 740060ff233Sopenharmony_ci 741060ff233Sopenharmony_ci ret = ServerIpcRemovePermission(g_sessionName); 742060ff233Sopenharmony_ci EXPECT_EQ(ret, SOFTBUS_TRANS_PROXY_SEND_REQUEST_FAILED); 743060ff233Sopenharmony_ci 744060ff233Sopenharmony_ci TransClientDeinit(); 745060ff233Sopenharmony_ci} 746060ff233Sopenharmony_ci 747060ff233Sopenharmony_ci/** 748060ff233Sopenharmony_ci * @tc.name: ServerIpcEvaluateQosTest001 749060ff233Sopenharmony_ci * @tc.desc: SendMessage, use the wrong parameter. 750060ff233Sopenharmony_ci * @tc.type: FUNC 751060ff233Sopenharmony_ci * @tc.require:I5HQGA 752060ff233Sopenharmony_ci */ 753060ff233Sopenharmony_ciHWTEST_F(TransIpcStandardTest, ServerIpcEvaluateQosTest001, TestSize.Level0) 754060ff233Sopenharmony_ci{ 755060ff233Sopenharmony_ci TransDataType type = DATA_TYPE_MESSAGE; 756060ff233Sopenharmony_ci uint32_t qosCount = QOS_TYPE_BUTT; 757060ff233Sopenharmony_ci QosTV *qos = reinterpret_cast<QosTV *>(SoftBusCalloc(sizeof(QosTV))); 758060ff233Sopenharmony_ci ASSERT_TRUE(qos != nullptr); 759060ff233Sopenharmony_ci 760060ff233Sopenharmony_ci int32_t ret = ServerIpcEvaluateQos(nullptr, type, qos, qosCount); 761060ff233Sopenharmony_ci EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret); 762060ff233Sopenharmony_ci 763060ff233Sopenharmony_ci ret = ServerIpcEvaluateQos(g_peerNetworkId, DATA_TYPE_BUTT, qos, qosCount); 764060ff233Sopenharmony_ci EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret); 765060ff233Sopenharmony_ci 766060ff233Sopenharmony_ci ret = ServerIpcEvaluateQos(g_peerNetworkId, type, qos, 100); 767060ff233Sopenharmony_ci EXPECT_EQ(SOFTBUS_INVALID_PARAM, ret); 768060ff233Sopenharmony_ci 769060ff233Sopenharmony_ci ret = ServerIpcEvaluateQos(g_peerNetworkId, type, qos, qosCount); 770060ff233Sopenharmony_ci EXPECT_EQ(SOFTBUS_ACCESS_TOKEN_DENIED, ret); 771060ff233Sopenharmony_ci SoftBusFree(qos); 772060ff233Sopenharmony_ci qos = nullptr; 773060ff233Sopenharmony_ci ASSERT_TRUE(qos == nullptr); 774060ff233Sopenharmony_ci} 775060ff233Sopenharmony_ci} 776