1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17 #include <securec.h>
18
19 #include "bus_center_server_proxy_standard.h"
20 #include "iremote_object.h"
21 #include "softbus_access_token_test.h"
22 #include "softbus_adapter_mem.h"
23 #include "softbus_bus_center.h"
24 #include "softbus_common.h"
25 #include "softbus_error_code.h"
26 #include "softbus_utils.h"
27
28 namespace OHOS {
29 using namespace testing::ext;
30
31 #define ADDRTYPE_LEN 2
32 #define INFOTYPE_LEN 6
33 #define LEN 0
34
35 static const int32_t KEY = 1;
36 static const int32_t INFONUM = 6;
37 static const int32_t ACCURACY = 10;
38 static const int32_t PERIOD = 10;
39 static const int32_t PUBLISHID = 0;
40 static const int32_t REFRESHID = 0;
41 static const uint32_t QOSCOUNT = 10;
42
43 class BusCenterServerProxyStandardTest : public testing::Test {
44 public:
45 static void SetUpTestCase();
46 static void TearDownTestCase();
47 void SetUp();
48 void TearDown();
49 };
50
SetUpTestCase()51 void BusCenterServerProxyStandardTest::SetUpTestCase() { }
52
TearDownTestCase()53 void BusCenterServerProxyStandardTest::TearDownTestCase() { }
54
SetUp()55 void BusCenterServerProxyStandardTest::SetUp() { }
56
TearDown()57 void BusCenterServerProxyStandardTest::TearDown() { }
58
59 /*
60 * @tc.name: SoftbusRegisterService_TEST_001
61 * @tc.desc: SoftbusRegisterService return value is equal to SOFTBUS_OK
62 * @tc.type: FUNC
63 * @tc.require:
64 */
65 HWTEST_F(BusCenterServerProxyStandardTest, SoftbusRegisterService_TEST_001, TestSize.Level1)
66 {
67 const char *clientPkgName = "000";
68 const sptr<IRemoteObject> impl = nullptr;
69 BusCenterServerProxy servertest(impl);
70 int32_t ret = servertest.SoftbusRegisterService(clientPkgName, nullptr);
71 EXPECT_EQ(ret, SOFTBUS_OK);
72 }
73
74 /*
75 * @tc.name: CreateSessionServer_TEST_001
76 * @tc.desc: CreateSessionServer return value is equal to SOFTBUS_OK
77 * @tc.type: FUNC
78 * @tc.require:
79 */
80 HWTEST_F(BusCenterServerProxyStandardTest, CreateSessionServer_TEST_001, TestSize.Level1)
81 {
82 const char *pkgName = "000";
83 const char *sessionName = "111";
84 const sptr<IRemoteObject> impl = nullptr;
85 BusCenterServerProxy servertest(impl);
86 int32_t ret = servertest.CreateSessionServer(pkgName, sessionName, 1);
87 EXPECT_EQ(ret, SOFTBUS_OK);
88 }
89
90 /*
91 * @tc.name: RemoveSessionServer_TEST_001
92 * @tc.desc: RemoveSessionServer return value is equal to SOFTBUS_OK
93 * @tc.type: FUNC
94 * @tc.require:
95 */
96 HWTEST_F(BusCenterServerProxyStandardTest, RemoveSessionServer_TEST_001, TestSize.Level1)
97 {
98 const char *pkgName = "000";
99 const char *sessionName = "111";
100 const sptr<IRemoteObject> impl = nullptr;
101 BusCenterServerProxy servertest(impl);
102 int32_t ret = servertest.RemoveSessionServer(pkgName, sessionName, 1);
103 EXPECT_EQ(ret, SOFTBUS_OK);
104 }
105
106 /*
107 * @tc.name: OpenSession_TEST_001
108 * @tc.desc: OpenSession return value is equal to SOFTBUS_OK
109 * @tc.type: FUNC
110 * @tc.require:
111 */
112 HWTEST_F(BusCenterServerProxyStandardTest, OpenSession_TEST_001, TestSize.Level1)
113 {
114 SessionParam param;
115 TransInfo info;
116 const sptr<IRemoteObject> impl = nullptr;
117 BusCenterServerProxy servertest(impl);
118 int32_t ret = servertest.OpenSession(¶m, &info);
119 EXPECT_EQ(ret, SOFTBUS_OK);
120 }
121
122 /*
123 * @tc.name: OpenAuthSession_TEST_001
124 * @tc.desc: OpenAuthSession return value is equal to SOFTBUS_OK
125 * @tc.type: FUNC
126 * @tc.require:
127 */
128 HWTEST_F(BusCenterServerProxyStandardTest, OpenAuthSession_TEST_001, TestSize.Level1)
129 {
130 const char *sessionName = "000";
131 ConnectionAddr addrInfo;
132 const sptr<IRemoteObject> impl = nullptr;
133 BusCenterServerProxy servertest(impl);
134 int32_t ret = servertest.OpenAuthSession(sessionName, &addrInfo);
135 EXPECT_EQ(ret, SOFTBUS_OK);
136 }
137
138 /*
139 * @tc.name: NotifyAuthSuccess_TEST_001
140 * @tc.desc: NotifyAuthSuccess return value is equal to SOFTBUS_OK
141 * @tc.type: FUNC
142 * @tc.require:
143 */
144 HWTEST_F(BusCenterServerProxyStandardTest, NotifyAuthSuccess_TEST_001, TestSize.Level1)
145 {
146 int32_t channelId = 0;
147 int32_t channelType = 0;
148 const sptr<IRemoteObject> impl = nullptr;
149 BusCenterServerProxy servertest(impl);
150 int32_t ret = servertest.NotifyAuthSuccess(channelId, channelType);
151 EXPECT_EQ(ret, SOFTBUS_OK);
152 }
153
154 /*
155 * @tc.name: ReleaseResources_TEST_001
156 * @tc.desc: ReleaseResources return value is equal to SOFTBUS_OK
157 * @tc.type: FUNC
158 * @tc.require:
159 */
160 HWTEST_F(BusCenterServerProxyStandardTest, ReleaseResources_TEST_001, TestSize.Level1)
161 {
162 int32_t channelId = 0;
163 const sptr<IRemoteObject> impl = nullptr;
164 BusCenterServerProxy servertest(impl);
165 int32_t ret = servertest.ReleaseResources(channelId);
166 EXPECT_EQ(ret, SOFTBUS_OK);
167 }
168
169 /*
170 * @tc.name: CloseChannel_TEST_001
171 * @tc.desc: CloseChannel return value is equal to SOFTBUS_OK
172 * @tc.type: FUNC
173 * @tc.require:
174 */
175 HWTEST_F(BusCenterServerProxyStandardTest, CloseChannel_TEST_001, TestSize.Level1)
176 {
177 const char *sessionName = "000";
178 int32_t channelId = 0;
179 int32_t channelType = 0;
180 const sptr<IRemoteObject> impl = nullptr;
181 BusCenterServerProxy servertest(impl);
182 int32_t ret = servertest.CloseChannel(sessionName, channelId, channelType);
183 EXPECT_EQ(ret, SOFTBUS_OK);
184 }
185
186 /*
187 * @tc.name: CloseChannelWithStatistics_TEST_001
188 * @tc.desc: CloseChannelWithStatistics return value is equal to SOFTBUS_OK
189 * @tc.type: FUNC
190 * @tc.require:
191 */
192 HWTEST_F(BusCenterServerProxyStandardTest, CloseChannelWithStatistics_TEST_001, TestSize.Level1)
193 {
194 int32_t channelId = 0;
195 int32_t channelType = 0;
196 uint64_t laneId = 0;
197 uint32_t len = 1;
198 const sptr<IRemoteObject> impl = nullptr;
199 BusCenterServerProxy servertest(impl);
200 int32_t ret = servertest.CloseChannelWithStatistics(channelId, channelType, laneId, nullptr, len);
201 EXPECT_EQ(ret, SOFTBUS_OK);
202 }
203
204 /*
205 * @tc.name: SendMessage_TEST_001
206 * @tc.desc: SendMessage return value is equal to SOFTBUS_OK
207 * @tc.type: FUNC
208 * @tc.require:
209 */
210 HWTEST_F(BusCenterServerProxyStandardTest, SendMessage_TEST_001, TestSize.Level1)
211 {
212 int32_t channelId = 0;
213 int32_t channelType = 0;
214 uint32_t len = 1;
215 int32_t msgType = 0;
216 const sptr<IRemoteObject> impl = nullptr;
217 BusCenterServerProxy servertest(impl);
218 int32_t ret = servertest.SendMessage(channelId, channelType, nullptr, len, msgType);
219 EXPECT_EQ(ret, SOFTBUS_OK);
220 }
221
222 /*
223 * @tc.name: QosReport_TEST_001
224 * @tc.desc: QosReport return value is equal to SOFTBUS_OK
225 * @tc.type: FUNC
226 * @tc.require:
227 */
228 HWTEST_F(BusCenterServerProxyStandardTest, QosReport_TEST_001, TestSize.Level1)
229 {
230 int32_t channelId = 0;
231 int32_t chanType = 0;
232 int32_t appType = 1;
233 int32_t quality = 1;
234 const sptr<IRemoteObject> impl = nullptr;
235 BusCenterServerProxy servertest(impl);
236 int32_t ret = servertest.QosReport(channelId, chanType, appType, quality);
237 EXPECT_EQ(ret, SOFTBUS_OK);
238 }
239
240 /*
241 * @tc.name: StreamStats_TEST_001
242 * @tc.desc: StreamStats return value is equal to SOFTBUS_OK
243 * @tc.type: FUNC
244 * @tc.require:
245 */
246 HWTEST_F(BusCenterServerProxyStandardTest, StreamStats_TEST_001, TestSize.Level1)
247 {
248 int32_t channelId = 0;
249 int32_t channelType = 0;
250 const StreamSendStats *data = nullptr;
251 const sptr<IRemoteObject> impl = nullptr;
252 BusCenterServerProxy servertest(impl);
253 int32_t ret = servertest.StreamStats(channelId, channelType, data);
254 EXPECT_EQ(ret, SOFTBUS_OK);
255 }
256
257 /*
258 * @tc.name: RippleStats_TEST_001
259 * @tc.desc: RippleStats return value is equal to SOFTBUS_OK
260 * @tc.type: FUNC
261 * @tc.require:
262 */
263 HWTEST_F(BusCenterServerProxyStandardTest, RippleStats_TEST_001, TestSize.Level1)
264 {
265 int32_t channelId = 0;
266 int32_t channelType = 0;
267 const TrafficStats *data = nullptr;
268 const sptr<IRemoteObject> impl = nullptr;
269 BusCenterServerProxy servertest(impl);
270 int32_t ret = servertest.RippleStats(channelId, channelType, data);
271 EXPECT_EQ(ret, SOFTBUS_OK);
272 }
273
274 /*
275 * @tc.name: JoinLNN_TEST_001
276 * @tc.desc: JoinLNN return value is equal to SOFTBUS_INVALID_PARAM
277 * @tc.type: FUNC
278 * @tc.require:
279 */
280 HWTEST_F(BusCenterServerProxyStandardTest, JoinLNN_TEST_001, TestSize.Level1)
281 {
282 const char *pkgName = nullptr;
283 const char *addr = "testaddr";
284 uint32_t addrTypeLen = ADDRTYPE_LEN;
285 const sptr<IRemoteObject> impl = nullptr;
286 BusCenterServerProxy servertest(impl);
287 int32_t ret = servertest.JoinLNN(pkgName, (void *)addr, addrTypeLen, false);
288 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
289 }
290
291 /*
292 * @tc.name: JoinLNN_TEST_002
293 * @tc.desc: JoinLNN return value is equal to SOFTBUS_INVALID_PARAM
294 * @tc.type: FUNC
295 * @tc.require:
296 */
297 HWTEST_F(BusCenterServerProxyStandardTest, JoinLNN_TEST_002, TestSize.Level1)
298 {
299 const char *pkgName = "testName";
300 uint32_t addrTypeLen = ADDRTYPE_LEN;
301 const sptr<IRemoteObject> impl = nullptr;
302 BusCenterServerProxy servertest(impl);
303 int32_t ret = servertest.JoinLNN(pkgName, nullptr, addrTypeLen, false);
304 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
305 }
306
307 /*
308 * @tc.name: LeaveLNN_TEST_001
309 * @tc.desc: LeaveLNN return value is equal to SOFTBUS_INVALID_PARAM
310 * @tc.type: FUNC
311 * @tc.require:
312 */
313 HWTEST_F(BusCenterServerProxyStandardTest, LeaveLNN_TEST_001, TestSize.Level1)
314 {
315 const char *pkgName = nullptr;
316 const char *networkId = "testNetworkId";
317 const sptr<IRemoteObject> impl = nullptr;
318 BusCenterServerProxy servertest(impl);
319 int32_t ret = servertest.LeaveLNN(pkgName, networkId);
320 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
321 }
322
323 /*
324 * @tc.name: LeaveLNN_TEST_002
325 * @tc.desc: LeaveLNN return value is equal to SOFTBUS_INVALID_PARAM
326 * @tc.type: FUNC
327 * @tc.require:
328 */
329 HWTEST_F(BusCenterServerProxyStandardTest, LeaveLNN_TEST_002, TestSize.Level1)
330 {
331 const char *pkgName = "testName";
332 const char *networkId = nullptr;
333 const sptr<IRemoteObject> impl = nullptr;
334 BusCenterServerProxy servertest(impl);
335 int32_t ret = servertest.LeaveLNN(pkgName, networkId);
336 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
337 }
338
339 /*
340 * @tc.name: GetAllOnlineNodeInfo_TEST_001
341 * @tc.desc: GetAllOnlineNodeInfo return value is equal to SOFTBUS_INVALID_PARAM
342 * @tc.type: FUNC
343 * @tc.require:
344 */
345 HWTEST_F(BusCenterServerProxyStandardTest, GetAllOnlineNodeInfo_TEST_001, TestSize.Level1)
346 {
347 const char *pkgName = nullptr;
348 const char *testInfo = "testinfo";
349 uint32_t infoTypeLen = INFOTYPE_LEN;
350 int32_t infoNum = INFONUM;
351 const sptr<IRemoteObject> impl = nullptr;
352 BusCenterServerProxy servertest(impl);
353 int32_t ret = servertest.GetAllOnlineNodeInfo(pkgName, (void **)&testInfo, infoTypeLen, &infoNum);
354 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
355 }
356
357 /*
358 * @tc.name: GetAllOnlineNodeInfo_TEST_002
359 * @tc.desc: GetAllOnlineNodeInfo return value is equal to SOFTBUS_INVALID_PARAM
360 * @tc.type: FUNC
361 * @tc.require:
362 */
363 HWTEST_F(BusCenterServerProxyStandardTest, GetAllOnlineNodeInfo_TEST_002, TestSize.Level1)
364 {
365 const char *pkgName = "testName";
366 uint32_t infoTypeLen = INFOTYPE_LEN;
367 int32_t infoNum = INFONUM;
368 const sptr<IRemoteObject> impl = nullptr;
369 BusCenterServerProxy servertest(impl);
370 int32_t ret = servertest.GetAllOnlineNodeInfo(pkgName, nullptr, infoTypeLen, &infoNum);
371 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
372 }
373
374 /*
375 * @tc.name: GetAllOnlineNodeInfo_TEST_003
376 * @tc.desc: GetAllOnlineNodeInfo return value is equal to SOFTBUS_INVALID_PARAM
377 * @tc.type: FUNC
378 * @tc.require:
379 */
380 HWTEST_F(BusCenterServerProxyStandardTest, GetAllOnlineNodeInfo_TEST_003, TestSize.Level1)
381 {
382 const char *pkgName = "testName";
383 const char *testInfo = "testinfo";
384 uint32_t infoTypeLen = INFOTYPE_LEN;
385 const sptr<IRemoteObject> impl = nullptr;
386 BusCenterServerProxy servertest(impl);
387 int32_t ret = servertest.GetAllOnlineNodeInfo(pkgName, (void **)&testInfo, infoTypeLen, nullptr);
388 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
389 }
390
391 /*
392 * @tc.name: GetLocalDeviceInfo_TEST_001
393 * @tc.desc: GetLocalDeviceInfo return value is equal to SOFTBUS_INVALID_PARAM
394 * @tc.type: FUNC
395 * @tc.require:
396 */
397 HWTEST_F(BusCenterServerProxyStandardTest, GetLocalDeviceInfo_TEST_001, TestSize.Level1)
398 {
399 const char *pkgName = nullptr;
400 const char *testInfo = "testinfo";
401 uint32_t infoTypeLen = INFOTYPE_LEN;
402 const sptr<IRemoteObject> impl = nullptr;
403 BusCenterServerProxy servertest(impl);
404 int32_t ret = servertest.GetLocalDeviceInfo(pkgName, (void *)testInfo, infoTypeLen);
405 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
406 }
407
408 /*
409 * @tc.name: GetLocalDeviceInfo_TEST_002
410 * @tc.desc: GetLocalDeviceInfo return value is equal to SOFTBUS_INVALID_PARAM
411 * @tc.type: FUNC
412 * @tc.require:
413 */
414 HWTEST_F(BusCenterServerProxyStandardTest, GetLocalDeviceInfo_TEST_002, TestSize.Level1)
415 {
416 const char *pkgName = "testName";
417 uint32_t infoTypeLen = INFOTYPE_LEN;
418 const sptr<IRemoteObject> impl = nullptr;
419 BusCenterServerProxy servertest(impl);
420 int32_t ret = servertest.GetLocalDeviceInfo(pkgName, nullptr, infoTypeLen);
421 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
422 }
423
424 /*
425 * @tc.name: GetLocalDeviceInfo_TEST_003
426 * @tc.desc: GetLocalDeviceInfo return value is equal to SOFTBUS_IPC_ERR
427 * @tc.type: FUNC
428 * @tc.require:
429 */
430 HWTEST_F(BusCenterServerProxyStandardTest, GetLocalDeviceInfo_TEST_003, TestSize.Level1)
431 {
432 const char *pkgName = "testName";
433 const char *info = "testinfo";
434 uint32_t infoTypeLen = INFOTYPE_LEN;
435 const sptr<IRemoteObject> impl = nullptr;
436 BusCenterServerProxy servertest(impl);
437 servertest.BusCenterServerProxyStandardDeInit();
438 int32_t ret = servertest.GetLocalDeviceInfo(pkgName, (void *)info, infoTypeLen);
439 EXPECT_EQ(ret, SOFTBUS_IPC_ERR);
440 }
441
442 /*
443 * @tc.name: GetNodeKeyInfo_TEST_001
444 * @tc.desc: GetNodeKeyInfo return value is equal to SOFTBUS_INVALID_PARAM
445 * @tc.type: FUNC
446 * @tc.require:
447 */
448 HWTEST_F(BusCenterServerProxyStandardTest, GetNodeKeyInfo_TEST_001, TestSize.Level1)
449 {
450 const char *pkgName = nullptr;
451 const char *networkId = "testNetworkId";
452 unsigned char arr[] = { 0x01, 0x02, 0x03 };
453 unsigned char *buf = arr;
454 uint32_t len = sizeof(arr);
455 const sptr<IRemoteObject> impl = nullptr;
456 BusCenterServerProxy servertest(impl);
457 int32_t ret = servertest.GetNodeKeyInfo(pkgName, networkId, KEY, buf, len);
458 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
459 }
460
461 /*
462 * @tc.name: GetNodeKeyInfo_TEST_002
463 * @tc.desc: GetNodeKeyInfo return value is equal to SOFTBUS_INVALID_PARAM
464 * @tc.type: FUNC
465 * @tc.require:
466 */
467 HWTEST_F(BusCenterServerProxyStandardTest, GetNodeKeyInfo_TEST_002, TestSize.Level1)
468 {
469 const char *pkgName = "testName";
470 const char *networkId = nullptr;
471 unsigned char arr[] = { 0x01, 0x02, 0x03 };
472 unsigned char *buf = arr;
473 uint32_t len = sizeof(arr);
474 const sptr<IRemoteObject> impl = nullptr;
475 BusCenterServerProxy servertest(impl);
476 int32_t ret = servertest.GetNodeKeyInfo(pkgName, networkId, KEY, buf, len);
477 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
478 }
479
480 /*
481 * @tc.name: GetNodeKeyInfo_TEST_003
482 * @tc.desc: GetNodeKeyInfo return value is equal to SOFTBUS_INVALID_PARAM
483 * @tc.type: FUNC
484 * @tc.require:
485 */
486 HWTEST_F(BusCenterServerProxyStandardTest, GetNodeKeyInfo_TEST_003, TestSize.Level1)
487 {
488 const char *pkgName = "testName";
489 const char *networkId = "testNetworkId";
490 unsigned char *buf = nullptr;
491 uint32_t len = LEN;
492 const sptr<IRemoteObject> impl = nullptr;
493 BusCenterServerProxy servertest(impl);
494 int32_t ret = servertest.GetNodeKeyInfo(pkgName, networkId, KEY, buf, len);
495 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
496 }
497
498 /*
499 * @tc.name: RegDataLevelChangeCb_TEST_001
500 * @tc.desc: RegDataLevelChangeCb return value is equal to SOFTBUS_INVALID_PARAM
501 * @tc.type: FUNC
502 * @tc.require:
503 */
504 HWTEST_F(BusCenterServerProxyStandardTest, RegDataLevelChangeCb_TEST_003, TestSize.Level1)
505 {
506 const char *pkgName = nullptr;
507 const sptr<IRemoteObject> impl = nullptr;
508 BusCenterServerProxy servertest(impl);
509 int32_t ret = servertest.RegDataLevelChangeCb(pkgName);
510 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
511 }
512
513 /*
514 * @tc.name: UnregDataLevelChangeCb_TEST_001
515 * @tc.desc: UnregDataLevelChangeCb return value is equal to SOFTBUS_INVALID_PARAM
516 * @tc.type: FUNC
517 * @tc.require:
518 */
519 HWTEST_F(BusCenterServerProxyStandardTest, UnregDataLevelChangeCb_TEST_001, TestSize.Level1)
520 {
521 const char *pkgName = nullptr;
522 const sptr<IRemoteObject> impl = nullptr;
523 BusCenterServerProxy servertest(impl);
524 int32_t ret = servertest.UnregDataLevelChangeCb(pkgName);
525 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
526 }
527
528 /*
529 * @tc.name: SetDataLevel_TEST_001
530 * @tc.desc: SetDataLevel return value is equal to SOFTBUS_INVALID_PARAM
531 * @tc.type: FUNC
532 * @tc.require:
533 */
534 HWTEST_F(BusCenterServerProxyStandardTest, SetDataLevel_TEST_001, TestSize.Level1)
535 {
536 const DataLevel *dataLevel = nullptr;
537 const sptr<IRemoteObject> impl = nullptr;
538 BusCenterServerProxy servertest(impl);
539 int32_t ret = servertest.SetDataLevel(dataLevel);
540 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
541 }
542
543 /*
544 * @tc.name: RegBleRangeCb_TEST_001
545 * @tc.desc: RegisterRangeCallbackForMsdp return value is equal to SOFTBUS_INVALID_PARAM
546 * @tc.type: FUNC
547 * @tc.require:
548 */
549 HWTEST_F(BusCenterServerProxyStandardTest, RegBleRangeCb_TEST_001, TestSize.Level1)
550 {
551 const char *pkgName = nullptr;
552 const sptr<IRemoteObject> impl = nullptr;
553 BusCenterServerProxy servertest(impl);
554 int32_t ret = servertest.RegisterRangeCallbackForMsdp(pkgName);
555 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
556 }
557
558 /*
559 * @tc.name: UnregBleRangeCb_TEST_001
560 * @tc.desc: UnregisterRangeCallbackForMsdp return value is equal to SOFTBUS_INVALID_PARAM
561 * @tc.type: FUNC
562 * @tc.require:
563 */
564 HWTEST_F(BusCenterServerProxyStandardTest, UnregBleRangeCb_TEST_001, TestSize.Level1)
565 {
566 const char *pkgName = nullptr;
567 const sptr<IRemoteObject> impl = nullptr;
568 BusCenterServerProxy servertest(impl);
569 int32_t ret = servertest.UnregisterRangeCallbackForMsdp(pkgName);
570 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
571 }
572
573 /*
574 * @tc.name: TriggerHbForMeasureDistance_TEST_001
575 * @tc.desc: TriggerRangeForMsdp return value is equal to SOFTBUS_INVALID_PARAM
576 * @tc.type: FUNC
577 * @tc.require:
578 */
579 HWTEST_F(BusCenterServerProxyStandardTest, TriggerHbForMeasureDistance_TEST_001, TestSize.Level1)
580 {
581 const RangeConfig *config = nullptr;
582 const sptr<IRemoteObject> impl = nullptr;
583 BusCenterServerProxy servertest(impl);
584 int32_t ret = servertest.TriggerRangeForMsdp(nullptr, config);
585 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
586 }
587
588 /*
589 * @tc.name: StartTimeSync_TEST_001
590 * @tc.desc: StartTimeSync return value is equal to SOFTBUS_INVALID_PARAM
591 * @tc.type: FUNC
592 * @tc.require:
593 */
594 HWTEST_F(BusCenterServerProxyStandardTest, StartTimeSync_TEST_001, TestSize.Level1)
595 {
596 const char *pkgName = nullptr;
597 const char *targetNetworkId = "testTargetNetworkId";
598 const sptr<IRemoteObject> impl = nullptr;
599 BusCenterServerProxy servertest(impl);
600 int32_t ret = servertest.StartTimeSync(pkgName, targetNetworkId, ACCURACY, PERIOD);
601 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
602 }
603
604 /*
605 * @tc.name: StartTimeSync_TEST_002
606 * @tc.desc: StartTimeSync return value is equal to SOFTBUS_INVALID_PARAM
607 * @tc.type: FUNC
608 * @tc.require:
609 */
610 HWTEST_F(BusCenterServerProxyStandardTest, StartTimeSync_TEST_002, TestSize.Level1)
611 {
612 const char *pkgName = "testName";
613 const char *targetNetworkId = nullptr;
614 const sptr<IRemoteObject> impl = nullptr;
615 BusCenterServerProxy servertest(impl);
616 int32_t ret = servertest.StartTimeSync(pkgName, targetNetworkId, ACCURACY, PERIOD);
617 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
618 }
619
620 /*
621 * @tc.name: PublishLNN_TEST_001
622 * @tc.desc: PublishLNN return value is equal to SOFTBUS_INVALID_PARAM
623 * @tc.type: FUNC
624 * @tc.require:
625 */
626 HWTEST_F(BusCenterServerProxyStandardTest, PublishLNN_TEST_001, TestSize.Level1)
627 {
628 const char *pkgName = nullptr;
629 PublishInfo *info = (PublishInfo *)SoftBusCalloc(sizeof(PublishInfo));
630 ASSERT_TRUE(info != nullptr);
631 const sptr<IRemoteObject> impl = nullptr;
632 BusCenterServerProxy servertest(impl);
633 int32_t ret = servertest.PublishLNN(pkgName, info);
634 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
635 SoftBusFree(info);
636 }
637
638 /*
639 * @tc.name: PublishLNN_TEST_002
640 * @tc.desc: PublishLNN return value is equal to SOFTBUS_INVALID_PARAM
641 * @tc.type: FUNC
642 * @tc.require:
643 */
644 HWTEST_F(BusCenterServerProxyStandardTest, PublishLNN_TEST_002, TestSize.Level1)
645 {
646 const char *pkgName = "testName";
647 const PublishInfo *info = nullptr;
648 const sptr<IRemoteObject> impl = nullptr;
649 BusCenterServerProxy servertest(impl);
650 int32_t ret = servertest.PublishLNN(pkgName, info);
651 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
652 }
653
654 /*
655 * @tc.name: StopPublishLNN_TEST_001
656 * @tc.desc: StopPublishLNN return value is equal to SOFTBUS_INVALID_PARAM
657 * @tc.type: FUNC
658 * @tc.require:
659 */
660 HWTEST_F(BusCenterServerProxyStandardTest, StopPublishLNN_TEST_001, TestSize.Level1)
661 {
662 const char *pkgName = nullptr;
663 const sptr<IRemoteObject> impl = nullptr;
664 BusCenterServerProxy servertest(impl);
665 int32_t ret = servertest.StopPublishLNN(pkgName, PUBLISHID);
666 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
667 }
668
669 /*
670 * @tc.name: RefreshLNN_TEST_001
671 * @tc.desc: RefreshLNN return value is equal to SOFTBUS_INVALID_PARAM
672 * @tc.type: FUNC
673 * @tc.require:
674 */
675 HWTEST_F(BusCenterServerProxyStandardTest, RefreshLNN_TEST_001, TestSize.Level1)
676 {
677 const char *pkgName = nullptr;
678 SubscribeInfo *info = (SubscribeInfo *)SoftBusCalloc(sizeof(SubscribeInfo));
679 ASSERT_TRUE(info != nullptr);
680 const sptr<IRemoteObject> impl = nullptr;
681 BusCenterServerProxy servertest(impl);
682 int32_t ret = servertest.RefreshLNN(pkgName, info);
683 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
684 SoftBusFree(info);
685 }
686
687 /*
688 * @tc.name: RefreshLNN_TEST_002
689 * @tc.desc: RefreshLNN return value is equal to SOFTBUS_INVALID_PARAM
690 * @tc.type: FUNC
691 * @tc.require:
692 */
693 HWTEST_F(BusCenterServerProxyStandardTest, RefreshLNN_TEST_002, TestSize.Level1)
694 {
695 const char *pkgName = "testName";
696 const SubscribeInfo *info = nullptr;
697 const sptr<IRemoteObject> impl = nullptr;
698 BusCenterServerProxy servertest(impl);
699 int32_t ret = servertest.RefreshLNN(pkgName, info);
700 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
701 }
702
703 /*
704 * @tc.name:StopRefreshLNN_TEST_001
705 * @tc.desc: StopRefreshLNN return value is equal to SOFTBUS_INVALID_PARAM
706 * @tc.type: FUNC
707 * @tc.require:
708 */
709 HWTEST_F(BusCenterServerProxyStandardTest, StopRefreshLNN_TEST_001, TestSize.Level1)
710 {
711 const char *pkgName = nullptr;
712 const sptr<IRemoteObject> impl = nullptr;
713 BusCenterServerProxy servertest(impl);
714 int32_t ret = servertest.StopRefreshLNN(pkgName, REFRESHID);
715 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
716 }
717
718 /*
719 * @tc.name: DeactiveMetaNode_TEST_001
720 * @tc.desc: DeactiveMetaNode return value is equal to SOFTBUS_INVALID_PARAM
721 * @tc.type: FUNC
722 * @tc.require:
723 */
724 HWTEST_F(BusCenterServerProxyStandardTest, DeactiveMetaNode_TEST_001, TestSize.Level1)
725 {
726 const char *metaNodeId = nullptr;
727 const sptr<IRemoteObject> impl = nullptr;
728 BusCenterServerProxy servertest(impl);
729 int32_t ret = servertest.DeactiveMetaNode(metaNodeId);
730 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
731 }
732
733 /*
734 * @tc.name: ShiftLNNGear_TEST_001
735 * @tc.desc: ShiftLNNGear return value is equal to SOFTBUS_INVALID_PARAM
736 * @tc.type: FUNC
737 * @tc.require:
738 */
739 HWTEST_F(BusCenterServerProxyStandardTest, ShiftLNNGear_TEST_001, TestSize.Level1)
740 {
741 const char *pkgName = nullptr;
742 const char *callerId = "testCallerId";
743 const char *targetNetworkId = "tesetTargetNetworkId";
744 GearMode *mode = (GearMode *)SoftBusCalloc(sizeof(GearMode));
745 ASSERT_TRUE(mode != nullptr);
746 const sptr<IRemoteObject> impl = nullptr;
747 BusCenterServerProxy servertest(impl);
748 int32_t ret = servertest.ShiftLNNGear(pkgName, callerId, targetNetworkId, mode);
749 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
750 SoftBusFree(mode);
751 }
752
753 /*
754 * @tc.name: ShiftLNNGear_TEST_002
755 * @tc.desc: ShiftLNNGear return value is equal to SOFTBUS_INVALID_PARAM
756 * @tc.type: FUNC
757 * @tc.require:
758 */
759 HWTEST_F(BusCenterServerProxyStandardTest, ShiftLNNGear_TEST_002, TestSize.Level1)
760 {
761 const char *pkgName = "testName";
762 const char *callerId = nullptr;
763 const char *targetNetworkId = "tesetTargetNetworkId";
764 GearMode *mode = (GearMode *)SoftBusCalloc(sizeof(GearMode));
765 ASSERT_TRUE(mode != nullptr);
766 const sptr<IRemoteObject> impl = nullptr;
767 BusCenterServerProxy servertest(impl);
768 int32_t ret = servertest.ShiftLNNGear(pkgName, callerId, targetNetworkId, mode);
769 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
770 SoftBusFree(mode);
771 }
772
773 /*
774 * @tc.name: ShiftLNNGear_TEST_003
775 * @tc.desc: ShiftLNNGear return value is equal to SOFTBUS_INVALID_PARAM
776 * @tc.type: FUNC
777 * @tc.require:
778 */
779 HWTEST_F(BusCenterServerProxyStandardTest, ShiftLNNGear_TEST_003, TestSize.Level1)
780 {
781 const char *pkgName = "testName";
782 const char *callerId = "testCallerId";
783 const char *targetNetworkId = "tesetTargetNetworkId";
784 const GearMode *mode = nullptr;
785 const sptr<IRemoteObject> impl = nullptr;
786 BusCenterServerProxy servertest(impl);
787 int32_t ret = servertest.ShiftLNNGear(pkgName, callerId, targetNetworkId, mode);
788 EXPECT_EQ(ret, SOFTBUS_INVALID_PARAM);
789 }
790
791 /*
792 * @tc.name: EvaluateQos_TEST_001
793 * @tc.desc: EvaluateQos return value is equal to SOFTBUS_INVALID_PARAM
794 * @tc.type: FUNC
795 * @tc.require:
796 */
797 HWTEST_F(BusCenterServerProxyStandardTest, EvaluateQos_TEST_001, TestSize.Level1)
798 {
799 const char *peerNetworkId = "testPeerNetworkId";
800 TransDataType dataType = DATA_TYPE_BUTT;
801 const sptr<IRemoteObject> impl = nullptr;
802 BusCenterServerProxy servertest(impl);
803 int32_t ret = servertest.EvaluateQos(peerNetworkId, dataType, nullptr, QOSCOUNT);
804 EXPECT_EQ(ret, SOFTBUS_OK);
805 }
806
807 } // namespace OHOS
808