1 /*
2 * Copyright (c) 2024-2025 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 PutSessionKey(uint32_t userId, const std::vector<uint8_t>& sessionKey, int32_t& sessionKeyId) override;
46 int32_t GetSessionKey(uint32_t userId, int32_t sessionKeyId, std::vector<uint8_t>& sessionKey) override;
47 int32_t UpdateSessionKey(uint32_t userId, int32_t sessionKeyId, const std::vector<uint8_t>& sessionKey) override;
48 int32_t DeleteSessionKey(uint32_t userId, int32_t sessionKeyId) override;
49 int32_t PutServiceProfile(const ServiceProfile& serviceProfile) override;
50 int32_t PutServiceProfileBatch(const std::vector<ServiceProfile>& serviceProfiles) override;
51 int32_t PutCharacteristicProfile(const CharacteristicProfile& charProfile) override;
52 int32_t PutCharacteristicProfileBatch(const std::vector<CharacteristicProfile>& charProfiles) override;
53 int32_t GetDeviceProfile(const std::string& deviceId, DeviceProfile& deviceProfile) override;
54 int32_t DeleteDeviceProfileBatch(std::vector<DeviceProfile>& deviceProfiles) override;
55 int32_t GetServiceProfile(const std::string& deviceId, const std::string& serviceName,
56 ServiceProfile& serviceProfile) override;
57 int32_t GetCharacteristicProfile(const std::string& deviceId, const std::string& serviceName,
58 const std::string& characteristicId, CharacteristicProfile& charProfile) override;
59 int32_t DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName, bool isMultiUser = false,
60 int32_t userId = DEFAULT_USER_ID) override;
61 int32_t DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName,
62 const std::string& characteristicId, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) override;
63 int32_t SubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) override;
64 int32_t UnSubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) override;
65 int32_t SubscribeDeviceProfileInited(int32_t saId, sptr<IRemoteObject> dpInitedCallback) override;
66 int32_t UnSubscribeDeviceProfileInited(int32_t saId) override;
67 int32_t SubscribePinCodeInvalid(const std::string& bundleName, int32_t pinExchangeType,
68 sptr<IRemoteObject> pinCodeCallback) override;
69 int32_t UnSubscribePinCodeInvalid(const std::string& bundleName, int32_t pinExchangeType) override;
70 int32_t PutAllTrustedDevices(const std::vector<TrustedDeviceInfo> deviceInfos) override;
71 int32_t SyncDeviceProfile(const DistributedDeviceProfile::DpSyncOptions& syncOptions,
72 sptr<IRemoteObject> syncCompletedCallback) override;
73 int32_t SendSubscribeInfos(std::map<std::string, SubscribeInfo> listenerMap) override;
74 int32_t PutDeviceProfileBatch(std::vector<DeviceProfile>& deviceProfiles) override;
75 int32_t GetDeviceProfiles(DeviceProfileFilterOptions& options,
76 std::vector<DeviceProfile>& deviceProfiles) override;
77 int32_t PutProductInfoBatch(const std::vector<ProductInfo>& productInfos) override;
78 int32_t PutDeviceIconInfoBatch(const std::vector<DeviceIconInfo>& deviceIconInfos) override;
79 int32_t GetDeviceIconInfos(const DeviceIconInfoFilterOptions& filterOptions,
80 std::vector<DeviceIconInfo>& deviceIconInfos) override;
81 int32_t PutServiceInfoProfile(const ServiceInfoProfile& serviceInfoProfile) override;
82 int32_t DeleteServiceInfoProfile(const ServiceInfoUniqueKey& key) override;
83 int32_t UpdateServiceInfoProfile(const ServiceInfoProfile& serviceInfoProfile) override;
84 int32_t GetServiceInfoProfileByUniqueKey(const ServiceInfoUniqueKey& key,
85 ServiceInfoProfile& serviceInfoProfile) override;
86 int32_t GetServiceInfoProfileListByTokenId(const ServiceInfoUniqueKey& key,
87 std::vector<ServiceInfoProfile>& serviceInfoProfiles) override;
88 int32_t GetAllServiceInfoProfileList(std::vector<ServiceInfoProfile>& serviceInfoProfiles) override;
89 int32_t GetServiceInfoProfileListByBundleName(const ServiceInfoUniqueKey& key,
90 std::vector<ServiceInfoProfile>& serviceInfoProfiles) override;
91 int32_t PutLocalServiceInfo(const LocalServiceInfo& localServiceInfo) override;
92 int32_t UpdateLocalServiceInfo(const LocalServiceInfo& localServiceInfo) override;
93 int32_t GetLocalServiceInfoByBundleAndPinType(const std::string& bundleName,
94 int32_t pinExchangeType, LocalServiceInfo& localServiceInfo) override;
95 int32_t DeleteLocalServiceInfo(const std::string& bundleName, int32_t pinExchangeType) override;
96 void DelayUnloadTask() override;
97 bool IsInited() override;
98 };
99
100 class DistributedDeviceProfileStubNewTest : public testing::Test {
101 public:
102 static void SetUpTestCase(void);
103 static void TearDownTestCase(void);
104 void SetUp();
105 void TearDown();
106
107 std::shared_ptr<DistributedDeviceProfileStubNew> ProfileStub_ = nullptr;
108 };
109
SetUpTestCase(void)110 void DistributedDeviceProfileStubNewTest::SetUpTestCase(void)
111 {
112 }
113
TearDownTestCase(void)114 void DistributedDeviceProfileStubNewTest::TearDownTestCase(void)
115 {
116 }
117
SetUp()118 void DistributedDeviceProfileStubNewTest::SetUp()
119 {
120 ProfileStub_ = std::make_shared<MockDistributedDeviceProfileStubNew>();
121 }
122
TearDown()123 void DistributedDeviceProfileStubNewTest::TearDown()
124 {
125 ProfileStub_ = nullptr;
126 }
127
PutAccessControlProfile(const AccessControlProfile & aclProfile)128 int32_t MockDistributedDeviceProfileStubNew::PutAccessControlProfile(const AccessControlProfile& aclProfile)
129 {
130 (void)aclProfile;
131 return 0;
132 }
UpdateAccessControlProfile(const AccessControlProfile & aclProfile)133 int32_t MockDistributedDeviceProfileStubNew::UpdateAccessControlProfile(const AccessControlProfile& aclProfile)
134 {
135 (void)aclProfile;
136 return 0;
137 }
GetTrustDeviceProfile(const std::string & deviceId,TrustDeviceProfile & trustDeviceProfile)138 int32_t MockDistributedDeviceProfileStubNew::GetTrustDeviceProfile(const std::string& deviceId,
139 TrustDeviceProfile& trustDeviceProfile)
140 {
141 (void)deviceId;
142 (void)trustDeviceProfile;
143 return 0;
144 }
GetAllTrustDeviceProfile(std::vector<TrustDeviceProfile> & trustDeviceProfiles)145 int32_t MockDistributedDeviceProfileStubNew::GetAllTrustDeviceProfile(
146 std::vector<TrustDeviceProfile>& trustDeviceProfiles)
147 {
148 (void)trustDeviceProfiles;
149 return 0;
150 }
151
DeleteDeviceProfileBatch(std::vector<DeviceProfile> & deviceProfiles)152 int32_t MockDistributedDeviceProfileStubNew::DeleteDeviceProfileBatch(std::vector<DeviceProfile>& deviceProfiles)
153 {
154 (void)deviceProfiles;
155 return 0;
156 }
157
GetAccessControlProfile(std::map<std::string,std::string> queryParams,std::vector<AccessControlProfile> & accessControlProfiles)158 int32_t MockDistributedDeviceProfileStubNew::GetAccessControlProfile(std::map<std::string, std::string> queryParams,
159 std::vector<AccessControlProfile>& accessControlProfiles)
160 {
161 (void)queryParams;
162 (void)accessControlProfiles;
163 return 0;
164 }
GetAllAccessControlProfile(std::vector<AccessControlProfile> & accessControlProfiles)165 int32_t MockDistributedDeviceProfileStubNew::GetAllAccessControlProfile(
166 std::vector<AccessControlProfile>& accessControlProfiles)
167 {
168 (void)accessControlProfiles;
169 return 0;
170 }
DeleteAccessControlProfile(int32_t accessControlId)171 int32_t MockDistributedDeviceProfileStubNew::DeleteAccessControlProfile(int32_t accessControlId)
172 {
173 (void)accessControlId;
174 return 0;
175 }
PutSessionKey(uint32_t userId,const std::vector<uint8_t> & sessionKey,int32_t & sessionKeyId)176 int32_t MockDistributedDeviceProfileStubNew::PutSessionKey(
177 uint32_t userId, const std::vector<uint8_t>& sessionKey, int32_t& sessionKeyId)
178 {
179 (void)userId;
180 (void)sessionKey;
181 (void)sessionKeyId;
182 return 0;
183 }
GetSessionKey(uint32_t userId,int32_t sessionKeyId,std::vector<uint8_t> & sessionKey)184 int32_t MockDistributedDeviceProfileStubNew::GetSessionKey(
185 uint32_t userId, int32_t sessionKeyId, std::vector<uint8_t>& sessionKey)
186 {
187 (void)userId;
188 (void)sessionKey;
189 (void)sessionKeyId;
190 return 0;
191 }
UpdateSessionKey(uint32_t userId,int32_t sessionKeyId,const std::vector<uint8_t> & sessionKey)192 int32_t MockDistributedDeviceProfileStubNew::UpdateSessionKey(
193 uint32_t userId, int32_t sessionKeyId, const std::vector<uint8_t>& sessionKey)
194 {
195 (void)userId;
196 (void)sessionKey;
197 (void)sessionKeyId;
198 return 0;
199 }
DeleteSessionKey(uint32_t userId,int32_t sessionKeyId)200 int32_t MockDistributedDeviceProfileStubNew::DeleteSessionKey(uint32_t userId, int32_t sessionKeyId)
201 {
202 (void)userId;
203 (void)sessionKeyId;
204 return 0;
205 }
PutServiceProfile(const ServiceProfile & serviceProfile)206 int32_t MockDistributedDeviceProfileStubNew::PutServiceProfile(const ServiceProfile& serviceProfile)
207 {
208 (void)serviceProfile;
209 return 0;
210 }
PutServiceProfileBatch(const std::vector<ServiceProfile> & serviceProfiles)211 int32_t MockDistributedDeviceProfileStubNew::PutServiceProfileBatch(const std::vector<ServiceProfile>& serviceProfiles)
212 {
213 (void)serviceProfiles;
214 return 0;
215 }
PutCharacteristicProfile(const CharacteristicProfile & charProfile)216 int32_t MockDistributedDeviceProfileStubNew::PutCharacteristicProfile(const CharacteristicProfile& charProfile)
217 {
218 (void)charProfile;
219 return 0;
220 }
PutCharacteristicProfileBatch(const std::vector<CharacteristicProfile> & charProfiles)221 int32_t MockDistributedDeviceProfileStubNew::PutCharacteristicProfileBatch(
222 const std::vector<CharacteristicProfile>& charProfiles)
223 {
224 (void)charProfiles;
225 return 0;
226 }
GetDeviceProfile(const std::string & deviceId,DeviceProfile & deviceProfile)227 int32_t MockDistributedDeviceProfileStubNew::GetDeviceProfile(const std::string& deviceId,
228 DeviceProfile& deviceProfile)
229 {
230 (void)deviceId;
231 (void)deviceProfile;
232 return 0;
233 }
GetServiceProfile(const std::string & deviceId,const std::string & serviceName,ServiceProfile & serviceProfile)234 int32_t MockDistributedDeviceProfileStubNew::GetServiceProfile(const std::string& deviceId,
235 const std::string& serviceName, ServiceProfile& serviceProfile)
236 {
237 (void)deviceId;
238 (void)serviceName;
239 (void)serviceProfile;
240 return 0;
241 }
GetCharacteristicProfile(const std::string & deviceId,const std::string & serviceName,const std::string & characteristicId,CharacteristicProfile & charProfile)242 int32_t MockDistributedDeviceProfileStubNew::GetCharacteristicProfile(const std::string& deviceId,
243 const std::string& serviceName, const std::string& characteristicId, CharacteristicProfile& charProfile)
244 {
245 (void)deviceId;
246 (void)serviceName;
247 (void)characteristicId;
248 (void)charProfile;
249 return 0;
250 }
DeleteServiceProfile(const std::string & deviceId,const std::string & serviceName,bool isMultiUser,int32_t userId)251 int32_t MockDistributedDeviceProfileStubNew::DeleteServiceProfile(const std::string& deviceId,
252 const std::string& serviceName, bool isMultiUser, int32_t userId)
253 {
254 (void)deviceId;
255 (void)serviceName;
256 (void)isMultiUser;
257 (void)userId;
258 return 0;
259 }
DeleteCharacteristicProfile(const std::string & deviceId,const std::string & serviceName,const std::string & characteristicId,bool isMultiUser,int32_t userId)260 int32_t MockDistributedDeviceProfileStubNew::DeleteCharacteristicProfile(const std::string& deviceId,
261 const std::string& serviceName, const std::string& characteristicId, bool isMultiUser, int32_t userId)
262 {
263 (void)deviceId;
264 (void)serviceName;
265 (void)characteristicId;
266 (void)isMultiUser;
267 (void)userId;
268 return 0;
269 }
SubscribeDeviceProfile(const SubscribeInfo & subscribeInfo)270 int32_t MockDistributedDeviceProfileStubNew::SubscribeDeviceProfile(const SubscribeInfo& subscribeInfo)
271 {
272 (void)subscribeInfo;
273 return 0;
274 }
UnSubscribeDeviceProfile(const SubscribeInfo & subscribeInfo)275 int32_t MockDistributedDeviceProfileStubNew::UnSubscribeDeviceProfile(const SubscribeInfo& subscribeInfo)
276 {
277 (void)subscribeInfo;
278 return 0;
279 }
SubscribeDeviceProfileInited(int32_t saId,sptr<IRemoteObject> dpInitedCallback)280 int32_t MockDistributedDeviceProfileStubNew::SubscribeDeviceProfileInited(int32_t saId,
281 sptr<IRemoteObject> dpInitedCallback)
282 {
283 (void)saId;
284 (void)dpInitedCallback;
285 return 0;
286 }
UnSubscribeDeviceProfileInited(int32_t saId)287 int32_t MockDistributedDeviceProfileStubNew::UnSubscribeDeviceProfileInited(int32_t saId)
288 {
289 (void)saId;
290 return 0;
291 }
292
SubscribePinCodeInvalid(const std::string & bundleName,int32_t pinExchangeType,sptr<IRemoteObject> pinCodeCallback)293 int32_t MockDistributedDeviceProfileStubNew::SubscribePinCodeInvalid(const std::string& bundleName,
294 int32_t pinExchangeType, sptr <IRemoteObject> pinCodeCallback)
295 {
296 (void)bundleName;
297 (void)pinExchangeType;
298 (void)pinCodeCallback;
299 return 0;
300 }
301
UnSubscribePinCodeInvalid(const std::string & bundleName,int32_t pinExchangeType)302 int32_t MockDistributedDeviceProfileStubNew::UnSubscribePinCodeInvalid(const std::string& bundleName,
303 int32_t pinExchangeType)
304 {
305 (void)bundleName;
306 (void)pinExchangeType;
307 return 0;
308 }
309
PutAllTrustedDevices(const std::vector<TrustedDeviceInfo> deviceInfos)310 int32_t MockDistributedDeviceProfileStubNew::PutAllTrustedDevices(const std::vector<TrustedDeviceInfo> deviceInfos)
311 {
312 (void)deviceInfos;
313 return 0;
314 }
SyncDeviceProfile(const DistributedDeviceProfile::DpSyncOptions & syncOptions,sptr<IRemoteObject> syncCompletedCallback)315 int32_t MockDistributedDeviceProfileStubNew::SyncDeviceProfile(
316 const DistributedDeviceProfile::DpSyncOptions& syncOptions, sptr<IRemoteObject> syncCompletedCallback)
317 {
318 (void)syncOptions;
319 (void)syncCompletedCallback;
320 return 0;
321 }
SendSubscribeInfos(std::map<std::string,SubscribeInfo> listenerMap)322 int32_t MockDistributedDeviceProfileStubNew::SendSubscribeInfos(std::map<std::string, SubscribeInfo> listenerMap)
323 {
324 (void)listenerMap;
325 return 0;
326 }
DelayUnloadTask()327 void MockDistributedDeviceProfileStubNew::DelayUnloadTask()
328 {
329 return;
330 }
IsInited()331 bool MockDistributedDeviceProfileStubNew::IsInited()
332 {
333 return true;
334 }
335
GetDeviceProfiles(DeviceProfileFilterOptions & options,std::vector<DeviceProfile> & deviceProfiles)336 int32_t MockDistributedDeviceProfileStubNew::GetDeviceProfiles(DeviceProfileFilterOptions& options,
337 std::vector<DeviceProfile>& deviceProfiles)
338 {
339 (void)options;
340 (void)deviceProfiles;
341 return 0;
342 }
343
PutDeviceProfileBatch(std::vector<DeviceProfile> & deviceProfiles)344 int32_t MockDistributedDeviceProfileStubNew::PutDeviceProfileBatch(std::vector<DeviceProfile>& deviceProfiles)
345 {
346 (void)deviceProfiles;
347 return 0;
348 }
349
PutProductInfoBatch(const std::vector<ProductInfo> & productInfos)350 int32_t MockDistributedDeviceProfileStubNew::PutProductInfoBatch(const std::vector<ProductInfo>& productInfos)
351 {
352 (void)productInfos;
353 return 0;
354 }
355
PutDeviceIconInfoBatch(const std::vector<DeviceIconInfo> & deviceIconInfos)356 int32_t MockDistributedDeviceProfileStubNew::PutDeviceIconInfoBatch(const std::vector<DeviceIconInfo>& deviceIconInfos)
357 {
358 (void)deviceIconInfos;
359 return 0;
360 }
361
GetDeviceIconInfos(const DeviceIconInfoFilterOptions & filterOptions,std::vector<DeviceIconInfo> & deviceIconInfos)362 int32_t MockDistributedDeviceProfileStubNew::GetDeviceIconInfos(const DeviceIconInfoFilterOptions& filterOptions,
363 std::vector<DeviceIconInfo>& deviceIconInfos)
364 {
365 (void)filterOptions;
366 (void)deviceIconInfos;
367 return 0;
368 }
369
PutServiceInfoProfile(const ServiceInfoProfile & serviceInfoProfile)370 int32_t MockDistributedDeviceProfileStubNew::PutServiceInfoProfile(const ServiceInfoProfile& serviceInfoProfile)
371 {
372 (void)serviceInfoProfile;
373 return 0;
374 }
375
DeleteServiceInfoProfile(const ServiceInfoUniqueKey & key)376 int32_t MockDistributedDeviceProfileStubNew::DeleteServiceInfoProfile(const ServiceInfoUniqueKey& key)
377 {
378 (void)key;
379 return 0;
380 }
381
UpdateServiceInfoProfile(const ServiceInfoProfile & serviceInfoProfile)382 int32_t MockDistributedDeviceProfileStubNew::UpdateServiceInfoProfile(const ServiceInfoProfile& serviceInfoProfile)
383 {
384 (void)serviceInfoProfile;
385 return 0;
386 }
387
GetServiceInfoProfileByUniqueKey(const ServiceInfoUniqueKey & key,ServiceInfoProfile & serviceInfoProfile)388 int32_t MockDistributedDeviceProfileStubNew::GetServiceInfoProfileByUniqueKey(const ServiceInfoUniqueKey& key,
389 ServiceInfoProfile& serviceInfoProfile)
390 {
391 (void)key;
392 (void)serviceInfoProfile;
393 return 0;
394 }
395
GetServiceInfoProfileListByTokenId(const ServiceInfoUniqueKey & key,std::vector<ServiceInfoProfile> & serviceInfoProfiles)396 int32_t MockDistributedDeviceProfileStubNew::GetServiceInfoProfileListByTokenId(const ServiceInfoUniqueKey& key,
397 std::vector<ServiceInfoProfile>& serviceInfoProfiles)
398 {
399 (void)key;
400 (void)serviceInfoProfiles;
401 return 0;
402 }
GetAllServiceInfoProfileList(std::vector<ServiceInfoProfile> & serviceInfoProfiles)403 int32_t MockDistributedDeviceProfileStubNew::GetAllServiceInfoProfileList(
404 std::vector<ServiceInfoProfile>& serviceInfoProfiles)
405 {
406 (void)serviceInfoProfiles;
407 return 0;
408 }
GetServiceInfoProfileListByBundleName(const ServiceInfoUniqueKey & key,std::vector<ServiceInfoProfile> & serviceInfoProfiles)409 int32_t MockDistributedDeviceProfileStubNew::GetServiceInfoProfileListByBundleName(const ServiceInfoUniqueKey& key,
410 std::vector<ServiceInfoProfile>& serviceInfoProfiles)
411 {
412 (void)key;
413 (void)serviceInfoProfiles;
414 return 0;
415 }
PutLocalServiceInfo(const LocalServiceInfo & localServiceInfo)416 int32_t MockDistributedDeviceProfileStubNew::PutLocalServiceInfo(const LocalServiceInfo& localServiceInfo)
417 {
418 (void)localServiceInfo;
419 return 0;
420 }
UpdateLocalServiceInfo(const LocalServiceInfo & localServiceInfo)421 int32_t MockDistributedDeviceProfileStubNew::UpdateLocalServiceInfo(const LocalServiceInfo& localServiceInfo)
422 {
423 (void)localServiceInfo;
424 return 0;
425 }
GetLocalServiceInfoByBundleAndPinType(const std::string & bundleName,int32_t pinExchangeType,LocalServiceInfo & localServiceInfo)426 int32_t MockDistributedDeviceProfileStubNew::GetLocalServiceInfoByBundleAndPinType(const std::string& bundleName,
427 int32_t pinExchangeType, LocalServiceInfo& localServiceInfo)
428 {
429 (void)bundleName;
430 (void)pinExchangeType;
431 (void)localServiceInfo;
432 return 0;
433 }
DeleteLocalServiceInfo(const std::string & bundleName,int32_t pinExchangeType)434 int32_t MockDistributedDeviceProfileStubNew::DeleteLocalServiceInfo(const std::string& bundleName,
435 int32_t pinExchangeType)
436 {
437 (void)bundleName;
438 (void)pinExchangeType;
439 return 0;
440 }
441 /**
442 * @tc.name: IsInterfaceTokenValid001
443 * @tc.desc: IsInterfaceTokenValid
444 * @tc.type: FUNC
445 * @tc.require:
446 */
447 HWTEST_F(DistributedDeviceProfileStubNewTest, IsInterfaceTokenValid_001, TestSize.Level1)
448 {
449 std::shared_ptr<DistributedDeviceProfileStubNew> devProStubNew =
450 std::make_shared<MockDistributedDeviceProfileStubNew>();
451
452 MessageParcel data;
453 bool ret = ProfileStub_->IsInterfaceTokenValid(data);
454 EXPECT_EQ(false, ret);
455 }
456
457 /**
458 * @tc.name: OnRemoteRequest001
459 * @tc.desc: OnRemoteRequest
460 * @tc.type: FUNC
461 * @tc.require:
462 */
463 HWTEST_F(DistributedDeviceProfileStubNewTest, OnRemoteRequest_001, TestSize.Level1)
464 {
465 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::ON_TRUST_DEVICE_PROFILE_ADD);
466 MessageParcel data;
467 MessageParcel reply;
468 MessageOption option;
469 int32_t ret = ProfileStub_->OnRemoteRequest(code, data, reply, option);
470 EXPECT_EQ(DP_INTERFACE_CHECK_FAILED, ret);
471 }
472
473 /**
474 * @tc.name: OnRemoteRequest002
475 * @tc.desc: OnRemoteRequest
476 * @tc.type: FUNC
477 * @tc.require:
478 */
479 HWTEST_F(DistributedDeviceProfileStubNewTest, OnRemoteRequest_002, TestSize.Level1)
480 {
481 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_ACL_PROFILE);
482 MessageParcel data;
483 MessageParcel reply;
484 MessageOption option;
485 int32_t ret = ProfileStub_->OnRemoteRequest(code, data, reply, option);
486 EXPECT_EQ(DP_INTERFACE_CHECK_FAILED, ret);
487 }
488
489 /**
490 * @tc.name: PutAccessControlProfileInner001
491 * @tc.desc: PutAccessControlProfileInner
492 * @tc.type: FUNC
493 * @tc.require:
494 */
495 HWTEST_F(DistributedDeviceProfileStubNewTest, PutAccessControlProfileInner_001, TestSize.Level1)
496 {
497 MessageParcel data;
498 MessageParcel reply;
499 int32_t ret = ProfileStub_->PutAccessControlProfileInner(data, reply);
500 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
501 }
502
503 /**
504 * @tc.name: UpdateAccessControlProfileInner001
505 * @tc.desc: UpdateAccessControlProfileInner
506 * @tc.type: FUNC
507 * @tc.require:
508 */
509 HWTEST_F(DistributedDeviceProfileStubNewTest, UpdateAccessControlProfileInner_001, TestSize.Level1)
510 {
511 MessageParcel data;
512 MessageParcel reply;
513 int32_t ret = ProfileStub_->UpdateAccessControlProfileInner(data, reply);
514 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
515 }
516
517 /**
518 * @tc.name: GetTrustDeviceProfileInner001
519 * @tc.desc: GetTrustDeviceProfileInner
520 * @tc.type: FUNC
521 * @tc.require:
522 */
523 HWTEST_F(DistributedDeviceProfileStubNewTest, GetTrustDeviceProfileInner_001, TestSize.Level1)
524 {
525 MessageParcel data;
526 MessageParcel reply;
527 int32_t ret = ProfileStub_->GetTrustDeviceProfileInner(data, reply);
528 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
529 }
530
531 /**
532 * @tc.name: GetAllTrustDeviceProfileInner001
533 * @tc.desc: GetAllTrustDeviceProfileInner
534 * @tc.type: FUNC
535 * @tc.require:
536 */
537 HWTEST_F(DistributedDeviceProfileStubNewTest, GetAllTrustDeviceProfileInner_001, TestSize.Level1)
538 {
539 std::string udid = "udid";
540 std::string serviceId = "serviceId";
541 MessageParcel data;
542 MessageParcel reply;
543 data.WriteString(udid);
544 data.WriteString(serviceId);
545 int32_t ret = ProfileStub_->GetAllTrustDeviceProfileInner(data, reply);
546 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
547 }
548
549 /**
550 * @tc.name: GetAccessControlProfileInner001
551 * @tc.desc: GetAccessControlProfileInner
552 * @tc.type: FUNC
553 * @tc.require:
554 */
555 HWTEST_F(DistributedDeviceProfileStubNewTest, GetAccessControlProfileInner_001, TestSize.Level1)
556 {
557 MessageParcel data;
558 MessageParcel reply;
559 int32_t ret = ProfileStub_->GetAccessControlProfileInner(data, reply);
560 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
561 }
562
563 /**
564 * @tc.name: GetAllAccessControlProfileInner001
565 * @tc.desc: GetAllAccessControlProfileInner
566 * @tc.type: FUNC
567 * @tc.require:
568 */
569 HWTEST_F(DistributedDeviceProfileStubNewTest, GetAllAccessControlProfileInner_001, TestSize.Level1)
570 {
571 MessageParcel data;
572 MessageParcel reply;
573 int32_t ret = ProfileStub_->GetAllAccessControlProfileInner(data, reply);
574 EXPECT_EQ(DP_WRITE_PARCEL_FAIL, ret);
575 }
576
577 /**
578 * @tc.name: DeleteAccessControlProfileInner001
579 * @tc.desc: DeleteAccessControlProfileInner
580 * @tc.type: FUNC
581 * @tc.require:
582 */
583 HWTEST_F(DistributedDeviceProfileStubNewTest, DeleteAccessControlProfileInner_001, TestSize.Level1)
584 {
585 MessageParcel data;
586 MessageParcel reply;
587 int32_t ret = ProfileStub_->DeleteAccessControlProfileInner(data, reply);
588 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
589 }
590
591 /**
592 * @tc.name: PutServiceProfileInner001
593 * @tc.desc: PutServiceProfileInner
594 * @tc.type: FUNC
595 * @tc.require:
596 */
597 HWTEST_F(DistributedDeviceProfileStubNewTest, PutServiceProfileInner_001, TestSize.Level1)
598 {
599 MessageParcel data;
600 MessageParcel reply;
601 int32_t ret = ProfileStub_->PutServiceProfileInner(data, reply);
602 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
603 }
604
605 /**
606 * @tc.name: PutServiceProfileBatchInner001
607 * @tc.desc: PutServiceProfileBatchInner
608 * @tc.type: FUNC
609 * @tc.require:
610 */
611 HWTEST_F(DistributedDeviceProfileStubNewTest, PutServiceProfileBatchInner_001, TestSize.Level1)
612 {
613 MessageParcel data;
614 MessageParcel reply;
615 int32_t ret = ProfileStub_->PutServiceProfileBatchInner(data, reply);
616 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
617 }
618
619 /**
620 * @tc.name: PutCharacteristicProfileBatchInner001
621 * @tc.desc: PutCharacteristicProfileBatchInner
622 * @tc.type: FUNC
623 * @tc.require:
624 */
625 HWTEST_F(DistributedDeviceProfileStubNewTest, PutCharacteristicProfileBatchInner_001, TestSize.Level1)
626 {
627 MessageParcel data;
628 MessageParcel reply;
629 int32_t ret = ProfileStub_->PutCharacteristicProfileBatchInner(data, reply);
630 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
631 }
632
633 /**
634 * @tc.name: GetDeviceProfileInner001
635 * @tc.desc: GetDeviceProfileInner
636 * @tc.type: FUNC
637 * @tc.require:
638 */
639 HWTEST_F(DistributedDeviceProfileStubNewTest, GetDeviceProfileInner_001, TestSize.Level1)
640 {
641 MessageParcel data;
642 MessageParcel reply;
643 int32_t ret = ProfileStub_->GetDeviceProfileInner(data, reply);
644 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
645 }
646
647 /**
648 * @tc.name: GetServiceProfileInner001
649 * @tc.desc: GetServiceProfileInner
650 * @tc.type: FUNC
651 * @tc.require:
652 */
653 HWTEST_F(DistributedDeviceProfileStubNewTest, GetServiceProfileInner_001, TestSize.Level1)
654 {
655 MessageParcel data;
656 MessageParcel reply;
657 int32_t ret = ProfileStub_->GetServiceProfileInner(data, reply);
658 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
659 }
660
661 /**
662 * @tc.name: GetCharacteristicProfileInner001
663 * @tc.desc: GetCharacteristicProfileInner
664 * @tc.type: FUNC
665 * @tc.require:
666 */
667 HWTEST_F(DistributedDeviceProfileStubNewTest, GetCharacteristicProfileInner_001, TestSize.Level1)
668 {
669 MessageParcel data;
670 MessageParcel reply;
671 int32_t ret = ProfileStub_->GetCharacteristicProfileInner(data, reply);
672 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
673 }
674
675 /**
676 * @tc.name: DeleteServiceProfileInner001
677 * @tc.desc: DeleteServiceProfileInner
678 * @tc.type: FUNC
679 * @tc.require:
680 */
681 HWTEST_F(DistributedDeviceProfileStubNewTest, DeleteServiceProfileInner_001, TestSize.Level1)
682 {
683 MessageParcel data;
684 MessageParcel reply;
685 int32_t ret = ProfileStub_->DeleteServiceProfileInner(data, reply);
686 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
687 }
688
689 /**
690 * @tc.name: DeleteCharacteristicProfileInner001
691 * @tc.desc: DeleteCharacteristicProfileInner
692 * @tc.type: FUNC
693 * @tc.require:
694 */
695 HWTEST_F(DistributedDeviceProfileStubNewTest, DeleteCharacteristicProfileInner_001, TestSize.Level1)
696 {
697 MessageParcel data;
698 MessageParcel reply;
699 int32_t ret = ProfileStub_->DeleteServiceProfileInner(data, reply);
700 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
701 }
702
703 /**
704 * @tc.name: SubscribeDeviceProfileInner001
705 * @tc.desc: SubscribeDeviceProfileInner
706 * @tc.type: FUNC
707 * @tc.require:
708 */
709 HWTEST_F(DistributedDeviceProfileStubNewTest, SubscribeDeviceProfileInner_001, TestSize.Level1)
710 {
711 MessageParcel data;
712 MessageParcel reply;
713 int32_t ret = ProfileStub_->SubscribeDeviceProfileInner(data, reply);
714 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
715 }
716
717 /**
718 * @tc.name: UnSubscribeDeviceProfileInner001
719 * @tc.desc: UnSubscribeDeviceProfileInner
720 * @tc.type: FUNC
721 * @tc.require:
722 */
723 HWTEST_F(DistributedDeviceProfileStubNewTest, UnSubscribeDeviceProfileInner_001, TestSize.Level1)
724 {
725 MessageParcel data;
726 MessageParcel reply;
727 int32_t ret = ProfileStub_->UnSubscribeDeviceProfileInner(data, reply);
728 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
729 }
730
731 /**
732 * @tc.name: SyncDeviceProfileInner001
733 * @tc.desc: SyncDeviceProfileInner
734 * @tc.type: FUNC
735 * @tc.require:
736 */
737 HWTEST_F(DistributedDeviceProfileStubNewTest, SyncDeviceProfileInner_001, TestSize.Level1)
738 {
739 MessageParcel data;
740 MessageParcel reply;
741 int32_t ret = ProfileStub_->SyncDeviceProfileInner(data, reply);
742 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
743 }
744
745 /**
746 * @tc.name: SendSubscribeInfosInner001
747 * @tc.desc: SendSubscribeInfosInner
748 * @tc.type: FUNC
749 * @tc.require:
750 */
751 HWTEST_F(DistributedDeviceProfileStubNewTest, SendSubscribeInfosInner_001, TestSize.Level1)
752 {
753 MessageParcel data;
754 MessageParcel reply;
755 int32_t ret = ProfileStub_->SendSubscribeInfosInner(data, reply);
756 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
757 }
758
759 /**
760 * @tc.name: NotifyAclEventInner_001
761 * @tc.desc: succeed
762 * @tc.type: FUNC
763 * @tc.require:
764 */
765 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_001, TestSize.Level0)
766 {
767 uint32_t code = 1000;
768 MessageParcel data;
769 MessageParcel reply;
770 MessageOption option;
771 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
772 EXPECT_EQ(305, ret);
773 }
774
775 /**
776 * @tc.name: NotifyAclEventInner_002
777 * @tc.desc: succeed
778 * @tc.type: FUNC
779 * @tc.require:
780 */
781 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_002, TestSize.Level0)
782 {
783 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_ACL_PROFILE);
784 MessageParcel data;
785 MessageParcel reply;
786 MessageOption option;
787 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
788 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
789 }
790
791 /**
792 * @tc.name: NotifyAclEventInner_003
793 * @tc.desc: succeed
794 * @tc.type: FUNC
795 * @tc.require:
796 */
797 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_003, TestSize.Level0)
798 {
799 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::UPDATE_ACL_PROFILE);
800 MessageParcel data;
801 MessageParcel reply;
802 MessageOption option;
803 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
804 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
805 }
806
807 /**
808 * @tc.name: NotifyAclEventInner_004
809 * @tc.desc: succeed
810 * @tc.type: FUNC
811 * @tc.require:
812 */
813 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_004, TestSize.Level0)
814 {
815 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_TRUST_DEVICE_PROFILE);
816 MessageParcel data;
817 MessageParcel reply;
818 MessageOption option;
819 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
820 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
821 }
822
823 /**
824 * @tc.name: NotifyAclEventInner_005
825 * @tc.desc: succeed
826 * @tc.type: FUNC
827 * @tc.require:
828 */
829 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_005, TestSize.Level0)
830 {
831 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_ALL_TRUST_DEVICE_PROFILE);
832 MessageParcel data;
833 MessageParcel reply;
834 MessageOption option;
835 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
836 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
837 }
838
839 /**
840 * @tc.name: NotifyAclEventInner_006
841 * @tc.desc: succeed
842 * @tc.type: FUNC
843 * @tc.require:
844 */
845 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_006, TestSize.Level0)
846 {
847 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_ACL_PROFILE);
848 MessageParcel data;
849 MessageParcel reply;
850 MessageOption option;
851 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
852 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
853 }
854
855 /**
856 * @tc.name: NotifyAclEventInner_007
857 * @tc.desc: succeed
858 * @tc.type: FUNC
859 * @tc.require:
860 */
861 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_007, TestSize.Level0)
862 {
863 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_ALL_ACL_PROFILE);
864 MessageParcel data;
865 MessageParcel reply;
866 MessageOption option;
867 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
868 EXPECT_EQ(DP_WRITE_PARCEL_FAIL, ret);
869 }
870
871 /**
872 * @tc.name: NotifyAclEventInner_008
873 * @tc.desc: succeed
874 * @tc.type: FUNC
875 * @tc.require:
876 */
877 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_008, TestSize.Level0)
878 {
879 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::DELETE_ACL_PROFILE);
880 MessageParcel data;
881 MessageParcel reply;
882 MessageOption option;
883 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
884 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
885 }
886
887 /**
888 * @tc.name: NotifyAclEventInner_009
889 * @tc.desc: succeed
890 * @tc.type: FUNC
891 * @tc.require:
892 */
893 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_009, TestSize.Level0)
894 {
895 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::SUBSCRIBE_DEVICE_PROFILE);
896 MessageParcel data;
897 MessageParcel reply;
898 MessageOption option;
899 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
900 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
901 }
902
903 /**
904 * @tc.name: NotifyAclEventInner_010
905 * @tc.desc: succeed
906 * @tc.type: FUNC
907 * @tc.require:
908 */
909 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_010, TestSize.Level0)
910 {
911 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::UNSUBSCRIBE_DEVICE_PROFILE);
912 MessageParcel data;
913 MessageParcel reply;
914 MessageOption option;
915 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
916 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
917 }
918
919 /**
920 * @tc.name: NotifyAclEventInner_011
921 * @tc.desc: succeed
922 * @tc.type: FUNC
923 * @tc.require:
924 */
925 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_011, TestSize.Level0)
926 {
927 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::SEND_SUBSCRIBE_INFOS);
928 MessageParcel data;
929 MessageParcel reply;
930 MessageOption option;
931 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
932 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
933 }
934
935 /**
936 * @tc.name: NotifyAclEventInner_012
937 * @tc.desc: succeed
938 * @tc.type: FUNC
939 * @tc.require:
940 */
941 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_012, TestSize.Level0)
942 {
943 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_SERVICE_PROFILE);
944 MessageParcel data;
945 MessageParcel reply;
946 MessageOption option;
947 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
948 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
949 }
950
951 /**
952 * @tc.name: NotifyAclEventInner_013
953 * @tc.desc: succeed
954 * @tc.type: FUNC
955 * @tc.require:
956 */
957 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_013, TestSize.Level0)
958 {
959 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_SERVICE_PROFILE_BATCH);
960 MessageParcel data;
961 MessageParcel reply;
962 MessageOption option;
963 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
964 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
965 }
966
967 /**
968 * @tc.name: NotifyAclEventInner_014
969 * @tc.desc: succeed
970 * @tc.type: FUNC
971 * @tc.require:
972 */
973 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_014, TestSize.Level0)
974 {
975 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_CHAR_PROFILE);
976 MessageParcel data;
977 MessageParcel reply;
978 MessageOption option;
979 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
980 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
981 }
982
983 /**
984 * @tc.name: NotifyAclEventInner_015
985 * @tc.desc: succeed
986 * @tc.type: FUNC
987 * @tc.require:
988 */
989 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyAclEventInner_015, TestSize.Level0)
990 {
991 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::PUT_CHAR_PROFILE_BATCH);
992 MessageParcel data;
993 MessageParcel reply;
994 MessageOption option;
995 int32_t ret = ProfileStub_->NotifyAclEventInner(code, data, reply, option);
996 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
997 }
998
999 /**
1000 * @tc.name: NotifyEventInner_001
1001 * @tc.desc: succeed
1002 * @tc.type: FUNC
1003 * @tc.require:
1004 */
1005 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_001, TestSize.Level0)
1006 {
1007 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_DEVICE_PROFILE_NEW);
1008 MessageParcel data;
1009 MessageParcel reply;
1010 MessageOption option;
1011 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
1012 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
1013 }
1014
1015 /**
1016 * @tc.name: NotifyEventInner_002
1017 * @tc.desc: succeed
1018 * @tc.type: FUNC
1019 * @tc.require:
1020 */
1021 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_002, TestSize.Level0)
1022 {
1023 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_SERVICE_PROFILE);
1024 MessageParcel data;
1025 MessageParcel reply;
1026 MessageOption option;
1027 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
1028 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
1029 }
1030
1031 /**
1032 * @tc.name: NotifyEventInner_003
1033 * @tc.desc: succeed
1034 * @tc.type: FUNC
1035 * @tc.require:
1036 */
1037 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_003, TestSize.Level0)
1038 {
1039 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::GET_CHAR_PROFILE);
1040 MessageParcel data;
1041 MessageParcel reply;
1042 MessageOption option;
1043 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
1044 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
1045 }
1046
1047 /**
1048 * @tc.name: NotifyEventInner_004
1049 * @tc.desc: succeed
1050 * @tc.type: FUNC
1051 * @tc.require:
1052 */
1053 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_004, TestSize.Level0)
1054 {
1055 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::DEL_SERVICE_PROFILE);
1056 MessageParcel data;
1057 MessageParcel reply;
1058 MessageOption option;
1059 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
1060 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
1061 }
1062
1063 /**
1064 * @tc.name: NotifyEventInner_005
1065 * @tc.desc: succeed
1066 * @tc.type: FUNC
1067 * @tc.require:
1068 */
1069 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_005, TestSize.Level0)
1070 {
1071 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::DEL_CHAR_PROFILE);
1072 MessageParcel data;
1073 MessageParcel reply;
1074 MessageOption option;
1075 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
1076 EXPECT_EQ(ERR_FLATTEN_OBJECT, ret);
1077 }
1078
1079 /**
1080 * @tc.name: NotifyEventInner_006
1081 * @tc.desc: succeed
1082 * @tc.type: FUNC
1083 * @tc.require:
1084 */
1085 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_006, TestSize.Level0)
1086 {
1087 uint32_t code = static_cast<uint32_t>(DPInterfaceCode::SYNC_DEVICE_PROFILE_NEW);
1088 MessageParcel data;
1089 MessageParcel reply;
1090 MessageOption option;
1091 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
1092 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
1093 }
1094
1095 /**
1096 * @tc.name: NotifyEventInner_007
1097 * @tc.desc: succeed
1098 * @tc.type: FUNC
1099 * @tc.require:
1100 */
1101 HWTEST_F(DistributedDeviceProfileStubNewTest, NotifyEventInner_007, TestSize.Level0)
1102 {
1103 uint32_t code = 1000;
1104 MessageParcel data;
1105 MessageParcel reply;
1106 MessageOption option;
1107 int32_t ret = ProfileStub_->NotifyEventInner(code, data, reply, option);
1108 EXPECT_EQ(305, ret);
1109 }
1110
1111 /**
1112 * @tc.name: PutAllTrustedDevicesInner001
1113 * @tc.desc: PutAllTrustedDevicesInner
1114 * @tc.type: FUNC
1115 * @tc.require:
1116 */
1117 HWTEST_F(DistributedDeviceProfileStubNewTest, PutAllTrustedDevicesInner_001, TestSize.Level1)
1118 {
1119 MessageParcel data;
1120 MessageParcel reply;
1121 int32_t ret = ProfileStub_->PutAllTrustedDevicesInner(data, reply);
1122 EXPECT_EQ(DP_READ_PARCEL_FAIL, ret);
1123 }
1124 } // namespace DistributedDeviceProfile
1125 } // namespace OHOS
1126