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 <sys/stat.h>
18 #include <sys/types.h>
19 #include <string>
20 #include <vector>
21 #include <iostream>
22
23 #include "profile_utils.h"
24 #include "distributed_device_profile_constants.h"
25 #include "distributed_device_profile_client.h"
26 #include "distributed_device_profile_log.h"
27 #include "distributed_device_profile_errors.h"
28 #include "distributed_device_profile_enums.h"
29 #include "distributed_device_profile_stub_new.h"
30
31 namespace OHOS {
32 namespace DistributedDeviceProfile {
33 using namespace testing::ext;
34 using namespace std;
35
36 class MockDistributedDeviceProfileStubNew : public DistributedDeviceProfileStubNew {
37 int32_t PutAccessControlProfile(const AccessControlProfile& aclProfile) override;
38 int32_t UpdateAccessControlProfile(const AccessControlProfile& aclProfile) override;
39 int32_t GetTrustDeviceProfile(const std::string& deviceId, TrustDeviceProfile& trustDeviceProfile) override;
40 int32_t GetAllTrustDeviceProfile(std::vector<TrustDeviceProfile>& trustDeviceProfiles) override;
41 int32_t GetAccessControlProfile(std::map<std::string, std::string> queryParams,
42 std::vector<AccessControlProfile>& accessControlProfiles) override;
43 int32_t GetAllAccessControlProfile(std::vector<AccessControlProfile>& accessControlProfiles) override;
44 int32_t DeleteAccessControlProfile(int32_t accessControlId) override;
45 int32_t PutServiceProfile(const ServiceProfile& serviceProfile) override;
46 int32_t PutServiceProfileBatch(const std::vector<ServiceProfile>& serviceProfiles) override;
47 int32_t PutCharacteristicProfile(const CharacteristicProfile& charProfile) override;
48 int32_t PutCharacteristicProfileBatch(const std::vector<CharacteristicProfile>& charProfiles) override;
49 int32_t GetDeviceProfile(const std::string& deviceId, DeviceProfile& deviceProfile) override;
50 int32_t GetServiceProfile(const std::string& deviceId, const std::string& serviceName,
51 ServiceProfile& serviceProfile) override;
52 int32_t GetCharacteristicProfile(const std::string& deviceId, const std::string& serviceName,
53 const std::string& characteristicId, CharacteristicProfile& charProfile) override;
54 int32_t DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName) override;
55 int32_t DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName,
56 const std::string& characteristicId) override;
57 int32_t SubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) override;
58 int32_t UnSubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) override;
59 int32_t SubscribeDeviceProfileInited(int32_t saId, sptr<IRemoteObject> dpInitedCallback) override;
60 int32_t UnSubscribeDeviceProfileInited(int32_t saId) override;
61 int32_t SyncDeviceProfile(const DistributedDeviceProfile::DpSyncOptions& syncOptions,
62 sptr<IRemoteObject> syncCompletedCallback) override;
63 int32_t SendSubscribeInfos(std::map<std::string, SubscribeInfo> listenerMap) override;
64 void DelayUnloadTask() override;
65 bool IsInited() override;
66 };
67
68 class DistributedDeviceProfileStubNewTest : public testing::Test {
69 public:
70 static void SetUpTestCase(void);
71 static void TearDownTestCase(void);
72 void SetUp();
73 void TearDown();
74
75 std::shared_ptr<DistributedDeviceProfileStubNew> ProfileStub_ = nullptr;
76 };
77
SetUpTestCase(void)78 void DistributedDeviceProfileStubNewTest::SetUpTestCase(void)
79 {
80 }
81
TearDownTestCase(void)82 void DistributedDeviceProfileStubNewTest::TearDownTestCase(void)
83 {
84 }
85
SetUp()86 void DistributedDeviceProfileStubNewTest::SetUp()
87 {
88 ProfileStub_ = std::make_shared<MockDistributedDeviceProfileStubNew>();
89 }
90
TearDown()91 void DistributedDeviceProfileStubNewTest::TearDown()
92 {
93 ProfileStub_ = nullptr;
94 }
95
PutAccessControlProfile(const AccessControlProfile & aclProfile)96 int32_t MockDistributedDeviceProfileStubNew::PutAccessControlProfile(const AccessControlProfile& aclProfile)
97 {
98 (void)aclProfile;
99 return 0;
100 }
UpdateAccessControlProfile(const AccessControlProfile & aclProfile)101 int32_t MockDistributedDeviceProfileStubNew::UpdateAccessControlProfile(const AccessControlProfile& aclProfile)
102 {
103 (void)aclProfile;
104 return 0;
105 }
GetTrustDeviceProfile(const std::string & deviceId,TrustDeviceProfile & trustDeviceProfile)106 int32_t MockDistributedDeviceProfileStubNew::GetTrustDeviceProfile(const std::string& deviceId,
107 TrustDeviceProfile& trustDeviceProfile)
108 {
109 (void)deviceId;
110 (void)trustDeviceProfile;
111 return 0;
112 }
GetAllTrustDeviceProfile(std::vector<TrustDeviceProfile> & trustDeviceProfiles)113 int32_t MockDistributedDeviceProfileStubNew::GetAllTrustDeviceProfile(
114 std::vector<TrustDeviceProfile>& trustDeviceProfiles)
115 {
116 (void)trustDeviceProfiles;
117 return 0;
118 }
GetAccessControlProfile(std::map<std::string,std::string> queryParams,std::vector<AccessControlProfile> & accessControlProfiles)119 int32_t MockDistributedDeviceProfileStubNew::GetAccessControlProfile(std::map<std::string, std::string> queryParams,
120 std::vector<AccessControlProfile>& accessControlProfiles)
121 {
122 (void)queryParams;
123 (void)accessControlProfiles;
124 return 0;
125 }
GetAllAccessControlProfile(std::vector<AccessControlProfile> & accessControlProfiles)126 int32_t MockDistributedDeviceProfileStubNew::GetAllAccessControlProfile(
127 std::vector<AccessControlProfile>& accessControlProfiles)
128 {
129 (void)accessControlProfiles;
130 return 0;
131 }
DeleteAccessControlProfile(int32_t accessControlId)132 int32_t MockDistributedDeviceProfileStubNew::DeleteAccessControlProfile(int32_t accessControlId)
133 {
134 (void)accessControlId;
135 return 0;
136 }
PutServiceProfile(const ServiceProfile & serviceProfile)137 int32_t MockDistributedDeviceProfileStubNew::PutServiceProfile(const ServiceProfile& serviceProfile)
138 {
139 (void)serviceProfile;
140 return 0;
141 }
PutServiceProfileBatch(const std::vector<ServiceProfile> & serviceProfiles)142 int32_t MockDistributedDeviceProfileStubNew::PutServiceProfileBatch(const std::vector<ServiceProfile>& serviceProfiles)
143 {
144 (void)serviceProfiles;
145 return 0;
146 }
PutCharacteristicProfile(const CharacteristicProfile & charProfile)147 int32_t MockDistributedDeviceProfileStubNew::PutCharacteristicProfile(const CharacteristicProfile& charProfile)
148 {
149 (void)charProfile;
150 return 0;
151 }
PutCharacteristicProfileBatch(const std::vector<CharacteristicProfile> & charProfiles)152 int32_t MockDistributedDeviceProfileStubNew::PutCharacteristicProfileBatch(
153 const std::vector<CharacteristicProfile>& charProfiles)
154 {
155 (void)charProfiles;
156 return 0;
157 }
GetDeviceProfile(const std::string & deviceId,DeviceProfile & deviceProfile)158 int32_t MockDistributedDeviceProfileStubNew::GetDeviceProfile(const std::string& deviceId,
159 DeviceProfile& deviceProfile)
160 {
161 (void)deviceId;
162 (void)deviceProfile;
163 return 0;
164 }
GetServiceProfile(const std::string & deviceId,const std::string & serviceName,ServiceProfile & serviceProfile)165 int32_t MockDistributedDeviceProfileStubNew::GetServiceProfile(const std::string& deviceId,
166 const std::string& serviceName, ServiceProfile& serviceProfile)
167 {
168 (void)deviceId;
169 (void)serviceName;
170 (void)serviceProfile;
171 return 0;
172 }
GetCharacteristicProfile(const std::string & deviceId,const std::string & serviceName,const std::string & characteristicId,CharacteristicProfile & charProfile)173 int32_t MockDistributedDeviceProfileStubNew::GetCharacteristicProfile(const std::string& deviceId,
174 const std::string& serviceName, const std::string& characteristicId, CharacteristicProfile& charProfile)
175 {
176 (void)deviceId;
177 (void)serviceName;
178 (void)characteristicId;
179 (void)charProfile;
180 return 0;
181 }
DeleteServiceProfile(const std::string & deviceId,const std::string & serviceName)182 int32_t MockDistributedDeviceProfileStubNew::DeleteServiceProfile(const std::string& deviceId,
183 const std::string& serviceName)
184 {
185 (void)deviceId;
186 (void)serviceName;
187 return 0;
188 }
DeleteCharacteristicProfile(const std::string & deviceId,const std::string & serviceName,const std::string & characteristicId)189 int32_t MockDistributedDeviceProfileStubNew::DeleteCharacteristicProfile(const std::string& deviceId,
190 const std::string& serviceName, const std::string& characteristicId)
191 {
192 (void)deviceId;
193 (void)serviceName;
194 (void)characteristicId;
195 return 0;
196 }
SubscribeDeviceProfile(const SubscribeInfo & subscribeInfo)197 int32_t MockDistributedDeviceProfileStubNew::SubscribeDeviceProfile(const SubscribeInfo& subscribeInfo)
198 {
199 (void)subscribeInfo;
200 return 0;
201 }
UnSubscribeDeviceProfile(const SubscribeInfo & subscribeInfo)202 int32_t MockDistributedDeviceProfileStubNew::UnSubscribeDeviceProfile(const SubscribeInfo& subscribeInfo)
203 {
204 (void)subscribeInfo;
205 return 0;
206 }
SubscribeDeviceProfileInited(int32_t saId,sptr<IRemoteObject> dpInitedCallback)207 int32_t MockDistributedDeviceProfileStubNew::SubscribeDeviceProfileInited(int32_t saId,
208 sptr<IRemoteObject> dpInitedCallback)
209 {
210 (void)saId;
211 (void)dpInitedCallback;
212 return 0;
213 }
UnSubscribeDeviceProfileInited(int32_t saId)214 int32_t MockDistributedDeviceProfileStubNew::UnSubscribeDeviceProfileInited(int32_t saId)
215 {
216 (void)saId;
217 return 0;
218 }
SyncDeviceProfile(const DistributedDeviceProfile::DpSyncOptions & syncOptions,sptr<IRemoteObject> syncCompletedCallback)219 int32_t MockDistributedDeviceProfileStubNew::SyncDeviceProfile(
220 const DistributedDeviceProfile::DpSyncOptions& syncOptions, sptr<IRemoteObject> syncCompletedCallback)
221 {
222 (void)syncOptions;
223 (void)syncCompletedCallback;
224 return 0;
225 }
SendSubscribeInfos(std::map<std::string,SubscribeInfo> listenerMap)226 int32_t MockDistributedDeviceProfileStubNew::SendSubscribeInfos(std::map<std::string, SubscribeInfo> listenerMap)
227 {
228 (void)listenerMap;
229 return 0;
230 }
DelayUnloadTask()231 void MockDistributedDeviceProfileStubNew::DelayUnloadTask()
232 {
233 return;
234 }
IsInited()235 bool MockDistributedDeviceProfileStubNew::IsInited()
236 {
237 return true;
238 }
239
240 /**
241 * @tc.name: IsInterfaceTokenValid001
242 * @tc.desc: IsInterfaceTokenValid
243 * @tc.type: FUNC
244 * @tc.require:
245 */
246 HWTEST_F(DistributedDeviceProfileStubNewTest, IsInterfaceTokenValid_001, TestSize.Level1)
247 {
248 std::shared_ptr<DistributedDeviceProfileStubNew> devProStubNew =
249 std::make_shared<MockDistributedDeviceProfileStubNew>();
250
251 MessageParcel data;
252 bool ret = ProfileStub_->IsInterfaceTokenValid(data);
253 EXPECT_EQ(false, ret);
254 }
255
256 /**
257 * @tc.name: OnRemoteRequest001
258 * @tc.desc: OnRemoteRequest
259 * @tc.type: FUNC
260 * @tc.require:
261 */
262 HWTEST_F(DistributedDeviceProfileStubNewTest, OnRemoteRequest_001, TestSize.Level1)
263 {
264 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::ON_TRUST_DEVICE_PROFILE_ADD);
265 MessageParcel data;
266 MessageParcel reply;
267 MessageOption option;
268 int32_t ret = ProfileStub_->OnRemoteRequest(code, data, reply, option);
269 EXPECT_EQ(DP_INTERFACE_CHECK_FAILED, ret);
270 }
271
272 /**
273 * @tc.name: OnRemoteRequest002
274 * @tc.desc: OnRemoteRequest
275 * @tc.type: FUNC
276 * @tc.require:
277 */
278 HWTEST_F(DistributedDeviceProfileStubNewTest, OnRemoteRequest_002, TestSize.Level1)
279 {
280 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_ACL_PROFILE);
281 MessageParcel data;
282 MessageParcel reply;
283 MessageOption option;
284 int32_t ret = ProfileStub_->OnRemoteRequest(code, data, reply, option);
285 EXPECT_EQ(DP_INTERFACE_CHECK_FAILED, ret);
286 }
287
288 /**
289 * @tc.name: PutAccessControlProfileInner001
290 * @tc.desc: PutAccessControlProfileInner
291 * @tc.type: FUNC
292 * @tc.require:
293 */
294 HWTEST_F(DistributedDeviceProfileStubNewTest, PutAccessControlProfileInner_001, TestSize.Level1)
295 {
296 MessageParcel data;
297 MessageParcel reply;
298 int32_t ret = ProfileStub_->PutAccessControlProfileInner(data, reply);
299 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
300 }
301
302 /**
303 * @tc.name: UpdateAccessControlProfileInner001
304 * @tc.desc: UpdateAccessControlProfileInner
305 * @tc.type: FUNC
306 * @tc.require:
307 */
308 HWTEST_F(DistributedDeviceProfileStubNewTest, UpdateAccessControlProfileInner_001, TestSize.Level1)
309 {
310 MessageParcel data;
311 MessageParcel reply;
312 int32_t ret = ProfileStub_->UpdateAccessControlProfileInner(data, reply);
313 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
314 }
315
316 /**
317 * @tc.name: GetTrustDeviceProfileInner001
318 * @tc.desc: GetTrustDeviceProfileInner
319 * @tc.type: FUNC
320 * @tc.require:
321 */
322 HWTEST_F(DistributedDeviceProfileStubNewTest, GetTrustDeviceProfileInner_001, TestSize.Level1)
323 {
324 MessageParcel data;
325 MessageParcel reply;
326 int32_t ret = ProfileStub_->GetTrustDeviceProfileInner(data, reply);
327 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
328 }
329
330 /**
331 * @tc.name: GetAllTrustDeviceProfileInner001
332 * @tc.desc: GetAllTrustDeviceProfileInner
333 * @tc.type: FUNC
334 * @tc.require:
335 */
336 HWTEST_F(DistributedDeviceProfileStubNewTest, GetAllTrustDeviceProfileInner_001, TestSize.Level1)
337 {
338 std::string udid = "udid";
339 std::string serviceId = "serviceId";
340 MessageParcel data;
341 MessageParcel reply;
342 data.WriteString(udid);
343 data.WriteString(serviceId);
344 int32_t ret = ProfileStub_->GetAllTrustDeviceProfileInner(data, reply);
345 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
346 }
347
348 /**
349 * @tc.name: GetAccessControlProfileInner001
350 * @tc.desc: GetAccessControlProfileInner
351 * @tc.type: FUNC
352 * @tc.require:
353 */
354 HWTEST_F(DistributedDeviceProfileStubNewTest, GetAccessControlProfileInner_001, TestSize.Level1)
355 {
356 MessageParcel data;
357 MessageParcel reply;
358 int32_t ret = ProfileStub_->GetAccessControlProfileInner(data, reply);
359 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
360 }
361
362 /**
363 * @tc.name: GetAllAccessControlProfileInner001
364 * @tc.desc: GetAllAccessControlProfileInner
365 * @tc.type: FUNC
366 * @tc.require:
367 */
368 HWTEST_F(DistributedDeviceProfileStubNewTest, GetAllAccessControlProfileInner_001, TestSize.Level1)
369 {
370 MessageParcel data;
371 MessageParcel reply;
372 int32_t ret = ProfileStub_->GetAllAccessControlProfileInner(data, reply);
373 EXPECT_EQ(DP_WRITE_PARCEL_FAIL, ret);
374 }
375
376 /**
377 * @tc.name: DeleteAccessControlProfileInner001
378 * @tc.desc: DeleteAccessControlProfileInner
379 * @tc.type: FUNC
380 * @tc.require:
381 */
382 HWTEST_F(DistributedDeviceProfileStubNewTest, DeleteAccessControlProfileInner_001, TestSize.Level1)
383 {
384 MessageParcel data;
385 MessageParcel reply;
386 int32_t ret = ProfileStub_->DeleteAccessControlProfileInner(data, reply);
387 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
388 }
389
390 /**
391 * @tc.name: PutServiceProfileInner001
392 * @tc.desc: PutServiceProfileInner
393 * @tc.type: FUNC
394 * @tc.require:
395 */
396 HWTEST_F(DistributedDeviceProfileStubNewTest, PutServiceProfileInner_001, TestSize.Level1)
397 {
398 MessageParcel data;
399 MessageParcel reply;
400 int32_t ret = ProfileStub_->PutServiceProfileInner(data, reply);
401 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
402 }
403
404 /**
405 * @tc.name: PutServiceProfileBatchInner001
406 * @tc.desc: PutServiceProfileBatchInner
407 * @tc.type: FUNC
408 * @tc.require:
409 */
410 HWTEST_F(DistributedDeviceProfileStubNewTest, PutServiceProfileBatchInner_001, TestSize.Level1)
411 {
412 MessageParcel data;
413 MessageParcel reply;
414 int32_t ret = ProfileStub_->PutServiceProfileBatchInner(data, reply);
415 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
416 }
417
418 /**
419 * @tc.name: PutCharacteristicProfileBatchInner001
420 * @tc.desc: PutCharacteristicProfileBatchInner
421 * @tc.type: FUNC
422 * @tc.require:
423 */
424 HWTEST_F(DistributedDeviceProfileStubNewTest, PutCharacteristicProfileBatchInner_001, TestSize.Level1)
425 {
426 MessageParcel data;
427 MessageParcel reply;
428 int32_t ret = ProfileStub_->PutCharacteristicProfileBatchInner(data, reply);
429 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
430 }
431
432 /**
433 * @tc.name: GetDeviceProfileInner001
434 * @tc.desc: GetDeviceProfileInner
435 * @tc.type: FUNC
436 * @tc.require:
437 */
438 HWTEST_F(DistributedDeviceProfileStubNewTest, GetDeviceProfileInner_001, TestSize.Level1)
439 {
440 MessageParcel data;
441 MessageParcel reply;
442 int32_t ret = ProfileStub_->GetDeviceProfileInner(data, reply);
443 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
444 }
445
446 /**
447 * @tc.name: GetServiceProfileInner001
448 * @tc.desc: GetServiceProfileInner
449 * @tc.type: FUNC
450 * @tc.require:
451 */
452 HWTEST_F(DistributedDeviceProfileStubNewTest, GetServiceProfileInner_001, TestSize.Level1)
453 {
454 MessageParcel data;
455 MessageParcel reply;
456 int32_t ret = ProfileStub_->GetServiceProfileInner(data, reply);
457 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
458 }
459
460 /**
461 * @tc.name: GetCharacteristicProfileInner001
462 * @tc.desc: GetCharacteristicProfileInner
463 * @tc.type: FUNC
464 * @tc.require:
465 */
466 HWTEST_F(DistributedDeviceProfileStubNewTest, GetCharacteristicProfileInner_001, TestSize.Level1)
467 {
468 MessageParcel data;
469 MessageParcel reply;
470 int32_t ret = ProfileStub_->GetCharacteristicProfileInner(data, reply);
471 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
472 }
473
474 /**
475 * @tc.name: DeleteServiceProfileInner001
476 * @tc.desc: DeleteServiceProfileInner
477 * @tc.type: FUNC
478 * @tc.require:
479 */
480 HWTEST_F(DistributedDeviceProfileStubNewTest, DeleteServiceProfileInner_001, TestSize.Level1)
481 {
482 MessageParcel data;
483 MessageParcel reply;
484 int32_t ret = ProfileStub_->DeleteServiceProfileInner(data, reply);
485 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
486 }
487
488 /**
489 * @tc.name: DeleteCharacteristicProfileInner001
490 * @tc.desc: DeleteCharacteristicProfileInner
491 * @tc.type: FUNC
492 * @tc.require:
493 */
494 HWTEST_F(DistributedDeviceProfileStubNewTest, DeleteCharacteristicProfileInner_001, TestSize.Level1)
495 {
496 MessageParcel data;
497 MessageParcel reply;
498 int32_t ret = ProfileStub_->DeleteServiceProfileInner(data, reply);
499 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
500 }
501
502 /**
503 * @tc.name: SubscribeDeviceProfileInner001
504 * @tc.desc: SubscribeDeviceProfileInner
505 * @tc.type: FUNC
506 * @tc.require:
507 */
508 HWTEST_F(DistributedDeviceProfileStubNewTest, SubscribeDeviceProfileInner_001, TestSize.Level1)
509 {
510 MessageParcel data;
511 MessageParcel reply;
512 int32_t ret = ProfileStub_->SubscribeDeviceProfileInner(data, reply);
513 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
514 }
515
516 /**
517 * @tc.name: UnSubscribeDeviceProfileInner001
518 * @tc.desc: UnSubscribeDeviceProfileInner
519 * @tc.type: FUNC
520 * @tc.require:
521 */
522 HWTEST_F(DistributedDeviceProfileStubNewTest, UnSubscribeDeviceProfileInner_001, TestSize.Level1)
523 {
524 MessageParcel data;
525 MessageParcel reply;
526 int32_t ret = ProfileStub_->UnSubscribeDeviceProfileInner(data, reply);
527 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
528 }
529
530 /**
531 * @tc.name: SyncDeviceProfileInner001
532 * @tc.desc: SyncDeviceProfileInner
533 * @tc.type: FUNC
534 * @tc.require:
535 */
536 HWTEST_F(DistributedDeviceProfileStubNewTest, SyncDeviceProfileInner_001, TestSize.Level1)
537 {
538 MessageParcel data;
539 MessageParcel reply;
540 int32_t ret = ProfileStub_->SyncDeviceProfileInner(data, reply);
541 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
542 }
543
544 /**
545 * @tc.name: SendSubscribeInfosInner001
546 * @tc.desc: SendSubscribeInfosInner
547 * @tc.type: FUNC
548 * @tc.require:
549 */
550 HWTEST_F(DistributedDeviceProfileStubNewTest, SendSubscribeInfosInner_001, TestSize.Level1)
551 {
552 MessageParcel data;
553 MessageParcel reply;
554 int32_t ret = ProfileStub_->SendSubscribeInfosInner(data, reply);
555 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
556 }
557
558 /**
559 * @tc.name: NotifyAclEventInner_001
560 * @tc.desc: succeed
561 * @tc.type: FUNC
562 * @tc.require:
563 */
564 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_001, TestSize.Level0)
565 {
566 uint32_t code = 1000;
567 MessageParcel data;
568 MessageParcel reply;
569 MessageOption option;
570 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
571 EXPECT_EQ(305, ret);
572 }
573
574 /**
575 * @tc.name: NotifyAclEventInner_002
576 * @tc.desc: succeed
577 * @tc.type: FUNC
578 * @tc.require:
579 */
580 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_002, TestSize.Level0)
581 {
582 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_ACL_PROFILE);
583 MessageParcel data;
584 MessageParcel reply;
585 MessageOption option;
586 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
587 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
588 }
589
590 /**
591 * @tc.name: NotifyAclEventInner_003
592 * @tc.desc: succeed
593 * @tc.type: FUNC
594 * @tc.require:
595 */
596 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_003, TestSize.Level0)
597 {
598 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::UPDATE_ACL_PROFILE);
599 MessageParcel data;
600 MessageParcel reply;
601 MessageOption option;
602 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
603 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
604 }
605
606 /**
607 * @tc.name: NotifyAclEventInner_004
608 * @tc.desc: succeed
609 * @tc.type: FUNC
610 * @tc.require:
611 */
612 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_004, TestSize.Level0)
613 {
614 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_TRUST_DEVICE_PROFILE);
615 MessageParcel data;
616 MessageParcel reply;
617 MessageOption option;
618 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
619 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
620 }
621
622 /**
623 * @tc.name: NotifyAclEventInner_005
624 * @tc.desc: succeed
625 * @tc.type: FUNC
626 * @tc.require:
627 */
628 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_005, TestSize.Level0)
629 {
630 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_ALL_TRUST_DEVICE_PROFILE);
631 MessageParcel data;
632 MessageParcel reply;
633 MessageOption option;
634 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
635 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
636 }
637
638 /**
639 * @tc.name: NotifyAclEventInner_006
640 * @tc.desc: succeed
641 * @tc.type: FUNC
642 * @tc.require:
643 */
644 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_006, TestSize.Level0)
645 {
646 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_ACL_PROFILE);
647 MessageParcel data;
648 MessageParcel reply;
649 MessageOption option;
650 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
651 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
652 }
653
654 /**
655 * @tc.name: NotifyAclEventInner_007
656 * @tc.desc: succeed
657 * @tc.type: FUNC
658 * @tc.require:
659 */
660 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_007, TestSize.Level0)
661 {
662 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_ALL_ACL_PROFILE);
663 MessageParcel data;
664 MessageParcel reply;
665 MessageOption option;
666 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
667 EXPECT_EQ(DP_WRITE_PARCEL_FAIL, ret);
668 }
669
670 /**
671 * @tc.name: NotifyAclEventInner_008
672 * @tc.desc: succeed
673 * @tc.type: FUNC
674 * @tc.require:
675 */
676 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_008, TestSize.Level0)
677 {
678 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::DELETE_ACL_PROFILE);
679 MessageParcel data;
680 MessageParcel reply;
681 MessageOption option;
682 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
683 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
684 }
685
686 /**
687 * @tc.name: NotifyAclEventInner_009
688 * @tc.desc: succeed
689 * @tc.type: FUNC
690 * @tc.require:
691 */
692 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_009, TestSize.Level0)
693 {
694 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::SUBSCRIBE_DEVICE_PROFILE);
695 MessageParcel data;
696 MessageParcel reply;
697 MessageOption option;
698 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
699 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
700 }
701
702 /**
703 * @tc.name: NotifyAclEventInner_010
704 * @tc.desc: succeed
705 * @tc.type: FUNC
706 * @tc.require:
707 */
708 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_010, TestSize.Level0)
709 {
710 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::UNSUBSCRIBE_DEVICE_PROFILE);
711 MessageParcel data;
712 MessageParcel reply;
713 MessageOption option;
714 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
715 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
716 }
717
718 /**
719 * @tc.name: NotifyAclEventInner_011
720 * @tc.desc: succeed
721 * @tc.type: FUNC
722 * @tc.require:
723 */
724 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_011, TestSize.Level0)
725 {
726 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::SEND_SUBSCRIBE_INFOS);
727 MessageParcel data;
728 MessageParcel reply;
729 MessageOption option;
730 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
731 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
732 }
733
734 /**
735 * @tc.name: NotifyAclEventInner_012
736 * @tc.desc: succeed
737 * @tc.type: FUNC
738 * @tc.require:
739 */
740 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_012, TestSize.Level0)
741 {
742 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_SERVICE_PROFILE);
743 MessageParcel data;
744 MessageParcel reply;
745 MessageOption option;
746 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
747 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
748 }
749
750 /**
751 * @tc.name: NotifyAclEventInner_013
752 * @tc.desc: succeed
753 * @tc.type: FUNC
754 * @tc.require:
755 */
756 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_013, TestSize.Level0)
757 {
758 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_SERVICE_PROFILE_BATCH);
759 MessageParcel data;
760 MessageParcel reply;
761 MessageOption option;
762 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
763 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
764 }
765
766 /**
767 * @tc.name: NotifyAclEventInner_014
768 * @tc.desc: succeed
769 * @tc.type: FUNC
770 * @tc.require:
771 */
772 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_014, TestSize.Level0)
773 {
774 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_CHAR_PROFILE);
775 MessageParcel data;
776 MessageParcel reply;
777 MessageOption option;
778 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
779 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
780 }
781
782 /**
783 * @tc.name: NotifyAclEventInner_015
784 * @tc.desc: succeed
785 * @tc.type: FUNC
786 * @tc.require:
787 */
788 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_015, TestSize.Level0)
789 {
790 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_CHAR_PROFILE_BATCH);
791 MessageParcel data;
792 MessageParcel reply;
793 MessageOption option;
794 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
795 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
796 }
797
798 /**
799 * @tc.name: NotifyEventInner_001
800 * @tc.desc: succeed
801 * @tc.type: FUNC
802 * @tc.require:
803 */
804 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_001, TestSize.Level0)
805 {
806 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_DEVICE_PROFILE_NEW);
807 MessageParcel data;
808 MessageParcel reply;
809 MessageOption option;
810 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
811 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
812 }
813
814 /**
815 * @tc.name: NotifyEventInner_002
816 * @tc.desc: succeed
817 * @tc.type: FUNC
818 * @tc.require:
819 */
820 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_002, TestSize.Level0)
821 {
822 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_SERVICE_PROFILE);
823 MessageParcel data;
824 MessageParcel reply;
825 MessageOption option;
826 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
827 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
828 }
829
830 /**
831 * @tc.name: NotifyEventInner_003
832 * @tc.desc: succeed
833 * @tc.type: FUNC
834 * @tc.require:
835 */
836 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_003, TestSize.Level0)
837 {
838 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_CHAR_PROFILE);
839 MessageParcel data;
840 MessageParcel reply;
841 MessageOption option;
842 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
843 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
844 }
845
846 /**
847 * @tc.name: NotifyEventInner_004
848 * @tc.desc: succeed
849 * @tc.type: FUNC
850 * @tc.require:
851 */
852 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_004, TestSize.Level0)
853 {
854 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::DEL_SERVICE_PROFILE);
855 MessageParcel data;
856 MessageParcel reply;
857 MessageOption option;
858 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
859 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
860 }
861
862 /**
863 * @tc.name: NotifyEventInner_005
864 * @tc.desc: succeed
865 * @tc.type: FUNC
866 * @tc.require:
867 */
868 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_005, TestSize.Level0)
869 {
870 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::DEL_CHAR_PROFILE);
871 MessageParcel data;
872 MessageParcel reply;
873 MessageOption option;
874 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
875 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
876 }
877
878 /**
879 * @tc.name: NotifyEventInner_006
880 * @tc.desc: succeed
881 * @tc.type: FUNC
882 * @tc.require:
883 */
884 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_006, TestSize.Level0)
885 {
886 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::SYNC_DEVICE_PROFILE_NEW);
887 MessageParcel data;
888 MessageParcel reply;
889 MessageOption option;
890 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
891 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
892 }
893
894 /**
895 * @tc.name: NotifyEventInner_007
896 * @tc.desc: succeed
897 * @tc.type: FUNC
898 * @tc.require:
899 */
900 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_007, TestSize.Level0)
901 {
902 uint32_t code = 1000;
903 MessageParcel data;
904 MessageParcel reply;
905 MessageOption option;
906 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
907 EXPECT_EQ(305, ret);
908 }
909 } // namespace DistributedDeviceProfile
910 } // namespace OHOS
911