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