• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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 #define private public
17 #include "bundle/bundle_manager_internal.h"
18 #include "distributed_sched_service.h"
19 #undef private
20 #include "distributed_sched_stub_test.h"
21 #include "distributed_sched_util.h"
22 #define private public
23 #include "mission/distributed_sched_mission_manager.h"
24 #undef private
25 #include "mock_distributed_sched.h"
26 #include "mock_remote_stub.h"
27 #include "parcel_helper.h"
28 #include "test_log.h"
29 #include "token_setproc.h"
30 
31 using namespace testing;
32 using namespace testing::ext;
33 using namespace OHOS::AAFwk;
34 using namespace OHOS::AppExecFwk;
35 
36 namespace OHOS {
37 namespace DistributedSchedule {
38 namespace {
39 const std::u16string DMS_STUB_INTERFACE_TOKEN = u"ohos.distributedschedule.accessToken";
40 const std::u16string MOCK_INVALID_DESCRIPTOR = u"invalid descriptor";
41 const std::string EXTRO_INFO_JSON_KEY_ACCESS_TOKEN = "accessTokenID";
42 const std::string EXTRO_INFO_JSON_KEY_REQUEST_CODE = "requestCode";
43 const std::string DMS_VERSION_ID = "dmsVersion";
44 const std::string CMPT_PARAM_FREEINSTALL_BUNDLENAMES = "ohos.extra.param.key.allowedBundles";
45 constexpr const char* FOUNDATION_PROCESS_NAME = "foundation";
46 constexpr int32_t MAX_WAIT_TIME = 5000;
47 const char *PERMS[] = {
48     "ohos.permission.DISTRIBUTED_DATASYNC"
49 };
50 }
51 
SetUpTestCase()52 void DistributedSchedStubTest::SetUpTestCase()
53 {
54     DTEST_LOG << "DistributedSchedStubTest::SetUpTestCase" << std::endl;
55 }
56 
TearDownTestCase()57 void DistributedSchedStubTest::TearDownTestCase()
58 {
59     DTEST_LOG << "DistributedSchedStubTest::TearDownTestCase" << std::endl;
60 }
61 
TearDown()62 void DistributedSchedStubTest::TearDown()
63 {
64     DTEST_LOG << "DistributedSchedStubTest::TearDown" << std::endl;
65     distributedSchedStub_ = nullptr;
66 }
67 
SetUp()68 void DistributedSchedStubTest::SetUp()
69 {
70     DTEST_LOG << "DistributedSchedStubTest::SetUp" << std::endl;
71     distributedSchedStub_ = new DistributedSchedService();
72     DistributedSchedUtil::MockProcessAndPermission(FOUNDATION_PROCESS_NAME, PERMS, 1);
73 }
74 
WaitHandlerTaskDone(const std::shared_ptr<AppExecFwk::EventHandler> & handler)75 void DistributedSchedStubTest::WaitHandlerTaskDone(const std::shared_ptr<AppExecFwk::EventHandler> &handler)
76 {
77     DTEST_LOG << "DistributedSchedStubTest::WaitHandlerTaskDone" << std::endl;
78     // Wait until all asyn tasks are completed before exiting the test suite
79     isTaskDone_ = false;
80     auto taskDoneNotifyTask = [this]() {
81         std::lock_guard<std::mutex> autoLock(taskDoneLock_);
82         isTaskDone_ = true;
83         taskDoneCondition_.notify_all();
84     };
85     if (handler != nullptr) {
86         handler->PostTask(taskDoneNotifyTask);
87     }
88     std::unique_lock<std::mutex> lock(taskDoneLock_);
89     taskDoneCondition_.wait_for(lock, std::chrono::milliseconds(MAX_WAIT_TIME),
90         [&] () { return isTaskDone_; });
91 }
92 
CallerInfoMarshalling(const CallerInfo & callerInfo,MessageParcel & data)93 void DistributedSchedStubTest::CallerInfoMarshalling(const CallerInfo& callerInfo, MessageParcel& data)
94 {
95     data.WriteInt32(callerInfo.uid);
96     data.WriteInt32(callerInfo.pid);
97     data.WriteInt32(callerInfo.callerType);
98     data.WriteString(callerInfo.sourceDeviceId);
99     data.WriteInt32(callerInfo.duid);
100     data.WriteString(callerInfo.callerAppId);
101     data.WriteInt32(callerInfo.dmsVersion);
102 }
103 
FreeInstallInfoMarshalling(const CallerInfo & callerInfo,const DistributedSchedService::AccountInfo accountInfo,const int64_t taskId,MessageParcel & data)104 void DistributedSchedStubTest::FreeInstallInfoMarshalling(const CallerInfo& callerInfo,
105     const DistributedSchedService::AccountInfo accountInfo, const int64_t taskId, MessageParcel& data)
106 {
107     data.WriteInt32(callerInfo.uid);
108     data.WriteString(callerInfo.sourceDeviceId);
109     data.WriteInt32(accountInfo.accountType);
110     data.WriteStringVector(accountInfo.groupIdList);
111     data.WriteString(callerInfo.callerAppId);
112     data.WriteInt64(taskId);
113 }
114 
115 /**
116  * @tc.name: OnRemoteRequest_001
117  * @tc.desc: check OnRemoteRequest
118  * @tc.type: FUNC
119  */
120 HWTEST_F(DistributedSchedStubTest, OnRemoteRequest_001, TestSize.Level3)
121 {
122     DTEST_LOG << "DistributedSchedStubTest OnRemoteRequest_001 begin" << std::endl;
123     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
124     MessageParcel data;
125     MessageParcel reply;
126     MessageOption option;
127 
128     data.WriteInterfaceToken(MOCK_INVALID_DESCRIPTOR);
129     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
130     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
131     DTEST_LOG << "DistributedSchedStubTest OnRemoteRequest_001 end" << std::endl;
132 }
133 
134 /**
135  * @tc.name: StartRemoteAbilityInner_001
136  * @tc.desc: check StartRemoteAbilityInner
137  * @tc.type: FUNC
138  */
139 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_001, TestSize.Level3)
140 {
141     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_001 begin" << std::endl;
142     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
143     MessageParcel data;
144     MessageParcel reply;
145     MessageOption option;
146 
147     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
148     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
149     EXPECT_EQ(result, ERR_NULL_OBJECT);
150     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_001 end" << std::endl;
151 }
152 
153 /**
154  * @tc.name: StartRemoteAbilityInner_002
155  * @tc.desc: check StartRemoteAbilityInner
156  * @tc.type: FUNC
157  */
158 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_002, TestSize.Level3)
159 {
160     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_002 begin" << std::endl;
161     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
162     MessageParcel data;
163     MessageParcel reply;
164     MessageOption option;
165 
166     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
167     Want want;
168     data.WriteParcelable(&want);
169     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
170     EXPECT_NE(result, ERR_NONE);
171 
172     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
173     data.WriteParcelable(&want);
174     int32_t callingUid = 0;
175     data.WriteInt32(callingUid);
176     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
177     EXPECT_NE(result, ERR_NONE);
178 
179     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
180     data.WriteParcelable(&want);
181     data.WriteInt32(callingUid);
182     int32_t requestCode = 0;
183     data.WriteInt32(requestCode);
184     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
185     EXPECT_NE(result, ERR_NONE);
186 
187     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
188     data.WriteParcelable(&want);
189     data.WriteInt32(callingUid);
190     data.WriteInt32(requestCode);
191     uint32_t accessToken = 0;
192     data.WriteUint32(accessToken);
193     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
194     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
195     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_002 end" << std::endl;
196 }
197 
198 /**
199  * @tc.name: StartRemoteAbilityInner_003
200  * @tc.desc: check StartRemoteAbilityInner
201  * @tc.type: FUNC
202  */
203 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_003, TestSize.Level3)
204 {
205     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_003 begin" << std::endl;
206     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
207     MessageParcel data;
208     MessageParcel reply;
209     MessageOption option;
210 
211     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
212     Want want;
213     data.WriteParcelable(&want);
214     int32_t callingUid = 0;
215     data.WriteInt32(callingUid);
216     int32_t requestCode = 0;
217     data.WriteInt32(requestCode);
218     uint32_t accessToken = GetSelfTokenID();
219     data.WriteUint32(accessToken);
220     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
221     EXPECT_EQ(result, ERR_NONE);
222     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_003 end" << std::endl;
223 }
224 
225 /**
226  * @tc.name: StartRemoteAbilityInner_004
227  * @tc.desc: check StartRemoteAbilityInner
228  * @tc.type: FUNC
229  * @tc.require: I70WDT
230  */
231 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_004, TestSize.Level3)
232 {
233     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_004 begin" << std::endl;
234     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
235     MessageParcel data;
236     MessageParcel reply;
237     MessageOption option;
238 
239     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
240     DistributedSchedUtil::MockPermission();
241     int32_t ret = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
242 
243     Want want;
244     std::string eventName;
245     int32_t result = 0;
246     int32_t uid = -1;
247     distributedSchedStub_->ReportEvent(want, eventName, result, uid);
248 
249     const std::string bundleName = "com.third.hiworld.example";
250     uid = BundleManagerInternal::GetUidFromBms(bundleName);
251     if (uid <= 0) {
252         return;
253     }
254     distributedSchedStub_->ReportEvent(want, eventName, result, uid);
255     EXPECT_EQ(ret, DMS_PERMISSION_DENIED);
256     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_004 end" << std::endl;
257 }
258 
259 /**
260  * @tc.name: StartAbilityFromRemoteInner_001
261  * @tc.desc: check StartAbilityFromRemoteInner
262  * @tc.type: FUNC
263  */
264 HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_001, TestSize.Level3)
265 {
266     DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_001 begin" << std::endl;
267     MessageParcel data;
268     MessageParcel reply;
269 
270     int32_t result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
271     EXPECT_EQ(result, ERR_NULL_OBJECT);
272 
273     Want want;
274     data.WriteParcelable(&want);
275     result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
276     EXPECT_EQ(result, ERR_NULL_OBJECT);
277 
278     data.WriteParcelable(&want);
279     AbilityInfo abilityInfo;
280     AppExecFwk::CompatibleAbilityInfo compatibleAbilityInfo;
281     abilityInfo.ConvertToCompatiableAbilityInfo(compatibleAbilityInfo);
282     data.WriteParcelable(&compatibleAbilityInfo);
283     result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
284     EXPECT_NE(result, ERR_NONE);
285 
286     data.WriteParcelable(&want);
287     data.WriteParcelable(&compatibleAbilityInfo);
288     int32_t requestCode = 0;
289     data.WriteInt32(requestCode);
290     result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
291     EXPECT_NE(result, ERR_NONE);
292 
293     data.WriteParcelable(&want);
294     data.WriteParcelable(&compatibleAbilityInfo);
295     data.WriteInt32(requestCode);
296     CallerInfo callerInfo;
297     callerInfo.uid = 0;
298     data.WriteInt32(callerInfo.uid);
299     result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
300     EXPECT_NE(result, ERR_NONE);
301 
302     data.WriteParcelable(&want);
303     data.WriteParcelable(&compatibleAbilityInfo);
304     data.WriteInt32(requestCode);
305     data.WriteInt32(callerInfo.uid);
306     callerInfo.sourceDeviceId = "";
307     data.WriteString(callerInfo.sourceDeviceId);
308     result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
309     EXPECT_EQ(result, ERR_NONE);
310     DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_001 end" << std::endl;
311 }
312 
313 /**
314  * @tc.name: StartAbilityFromRemoteInner_002
315  * @tc.desc: check StartAbilityFromRemoteInner
316  * @tc.type: FUNC
317  */
318 HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_002, TestSize.Level3)
319 {
320     DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_002 begin" << std::endl;
321     MessageParcel data;
322     MessageParcel reply;
323     Want want;
324     AbilityInfo abilityInfo;
325     AppExecFwk::CompatibleAbilityInfo compatibleAbilityInfo;
326     int32_t requestCode = 0;
327     CallerInfo callerInfo;
328     callerInfo.uid = 0;
329     callerInfo.sourceDeviceId = "";
330 
331     data.WriteParcelable(&want);
332     data.WriteParcelable(&compatibleAbilityInfo);
333     data.WriteInt32(requestCode);
334     data.WriteInt32(callerInfo.uid);
335     data.WriteString(callerInfo.sourceDeviceId);
336     DistributedSchedService::AccountInfo accountInfo;
337     accountInfo.accountType = 0;
338     data.WriteInt32(accountInfo.accountType);
339     int32_t result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
340     EXPECT_EQ(result, ERR_NONE);
341 
342     data.WriteParcelable(&want);
343     data.WriteParcelable(&compatibleAbilityInfo);
344     data.WriteInt32(requestCode);
345     data.WriteInt32(callerInfo.uid);
346     data.WriteString(callerInfo.sourceDeviceId);
347     data.WriteInt32(accountInfo.accountType);
348     callerInfo.callerAppId = "";
349     data.WriteString(callerInfo.callerAppId);
350     result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
351     EXPECT_EQ(result, ERR_NONE);
352     DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_002 end" << std::endl;
353 }
354 
355 /**
356  * @tc.name: StartAbilityFromRemoteInner_003
357  * @tc.desc: check StartAbilityFromRemoteInner
358  * @tc.type: FUNC
359  */
360 HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_003, TestSize.Level3)
361 {
362     DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_003 begin" << std::endl;
363     MessageParcel data;
364     MessageParcel reply;
365 
366     Want want;
367     data.WriteParcelable(&want);
368     AbilityInfo abilityInfo;
369     AppExecFwk::CompatibleAbilityInfo compatibleAbilityInfo;
370     data.WriteParcelable(&compatibleAbilityInfo);
371     int32_t requestCode = 0;
372     data.WriteInt32(requestCode);
373     CallerInfo callerInfo;
374     callerInfo.uid = 0;
375     data.WriteInt32(callerInfo.uid);
376     callerInfo.sourceDeviceId = "";
377     data.WriteString(callerInfo.sourceDeviceId);
378     DistributedSchedService::AccountInfo accountInfo;
379     accountInfo.accountType = 0;
380     data.WriteInt32(accountInfo.accountType);
381     data.WriteStringVector(accountInfo.groupIdList);
382     callerInfo.callerAppId = "";
383     data.WriteString(callerInfo.callerAppId);
384     nlohmann::json extraInfoJson;
385     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
386     std::string extraInfo = extraInfoJson.dump();
387     data.WriteString(extraInfo);
388     int32_t result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
389     EXPECT_EQ(result, ERR_NONE);
390     DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteInner_003 end" << std::endl;
391 }
392 
393 /**
394  * @tc.name: SendResultFromRemoteInner_001
395  * @tc.desc: check SendResultFromRemoteInner
396  * @tc.type: FUNC
397  */
398 HWTEST_F(DistributedSchedStubTest, SendResultFromRemoteInner_001, TestSize.Level3)
399 {
400     DTEST_LOG << "DistributedSchedStubTest SendResultFromRemoteInner_001 begin" << std::endl;
401     MessageParcel data;
402     MessageParcel reply;
403 
404     int32_t result = distributedSchedStub_->SendResultFromRemoteInner(data, reply);
405     EXPECT_EQ(result, ERR_NULL_OBJECT);
406 
407     Want want;
408     data.WriteParcelable(&want);
409     result = distributedSchedStub_->SendResultFromRemoteInner(data, reply);
410     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
411 
412     data.WriteParcelable(&want);
413     int32_t requestCode = 0;
414     data.WriteInt32(requestCode);
415     result = distributedSchedStub_->SendResultFromRemoteInner(data, reply);
416     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
417 
418     data.WriteParcelable(&want);
419     data.WriteInt32(requestCode);
420     CallerInfo callerInfo;
421     callerInfo.uid = 0;
422     data.WriteInt32(callerInfo.uid);
423     result = distributedSchedStub_->SendResultFromRemoteInner(data, reply);
424     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
425 
426     data.WriteParcelable(&want);
427     data.WriteInt32(requestCode);
428     data.WriteInt32(callerInfo.uid);
429     callerInfo.sourceDeviceId = "";
430     data.WriteString(callerInfo.sourceDeviceId);
431     result = distributedSchedStub_->SendResultFromRemoteInner(data, reply);
432     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
433     DTEST_LOG << "DistributedSchedStubTest SendResultFromRemoteInner_001 end" << std::endl;
434 }
435 
436 /**
437  * @tc.name: SendResultFromRemoteInner_002
438  * @tc.desc: check SendResultFromRemoteInner
439  * @tc.type: FUNC
440  */
441 HWTEST_F(DistributedSchedStubTest, SendResultFromRemoteInner_002, TestSize.Level3)
442 {
443     DTEST_LOG << "DistributedSchedStubTest SendResultFromRemoteInner_002 begin" << std::endl;
444     MessageParcel data;
445     MessageParcel reply;
446     Want want;
447     int32_t requestCode = 0;
448     CallerInfo callerInfo;
449     callerInfo.uid = 0;
450     callerInfo.sourceDeviceId = "";
451     callerInfo.callerAppId = "";
452 
453     data.WriteParcelable(&want);
454     data.WriteInt32(requestCode);
455     data.WriteInt32(callerInfo.uid);
456     data.WriteString(callerInfo.sourceDeviceId);
457     DistributedSchedService::AccountInfo accountInfo;
458     accountInfo.accountType = 0;
459     data.WriteInt32(accountInfo.accountType);
460     int32_t result = distributedSchedStub_->SendResultFromRemoteInner(data, reply);
461     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
462 
463     data.WriteParcelable(&want);
464     data.WriteInt32(requestCode);
465     data.WriteInt32(callerInfo.uid);
466     data.WriteString(callerInfo.sourceDeviceId);
467     data.WriteInt32(accountInfo.accountType);
468     data.WriteString(callerInfo.callerAppId);
469     int32_t resultCode = 0;
470     data.WriteInt32(resultCode);
471     result = distributedSchedStub_->SendResultFromRemoteInner(data, reply);
472     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
473 
474     data.WriteParcelable(&want);
475     data.WriteInt32(requestCode);
476     data.WriteInt32(callerInfo.uid);
477     data.WriteString(callerInfo.sourceDeviceId);
478     data.WriteInt32(accountInfo.accountType);
479     data.WriteString(callerInfo.callerAppId);
480     data.WriteInt32(resultCode);
481     nlohmann::json extraInfoJson;
482     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
483     std::string extraInfo = extraInfoJson.dump();
484     data.WriteString(extraInfo);
485     result = distributedSchedStub_->SendResultFromRemoteInner(data, reply);
486     EXPECT_EQ(result, ERR_NONE);
487     DTEST_LOG << "DistributedSchedStubTest SendResultFromRemoteInner_002 end" << std::endl;
488 }
489 
490 /**
491  * @tc.name: ContinueMissionInner_001
492  * @tc.desc: check ContinueMissionInner
493  * @tc.type: FUNC
494  */
495 HWTEST_F(DistributedSchedStubTest, ContinueMissionInner_001, TestSize.Level3)
496 {
497     DTEST_LOG << "DistributedSchedStubTest ContinueMissionInner_001 begin" << std::endl;
498     MessageParcel data;
499     MessageParcel reply;
500 
501     DistributedSchedUtil::MockPermission();
502     int32_t result = distributedSchedStub_->ContinueMissionInner(data, reply);
503     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
504     DTEST_LOG << "DistributedSchedStubTest ContinueMissionInner_001 end" << std::endl;
505 }
506 
507 /**
508  * @tc.name: ContinueMissionInner_002
509  * @tc.desc: check ContinueMissionInner
510  * @tc.type: FUNC
511  */
512 HWTEST_F(DistributedSchedStubTest, ContinueMissionInner_002, TestSize.Level3)
513 {
514     DTEST_LOG << "DistributedSchedStubTest ContinueMissionInner_002 begin" << std::endl;
515     MessageParcel data;
516     MessageParcel reply;
517 
518     int32_t result = distributedSchedStub_->ContinueMissionInner(data, reply);
519     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
520 
521     std::string srcDevId = "";
522     data.WriteString(srcDevId);
523     result = distributedSchedStub_->ContinueMissionInner(data, reply);
524     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
525 
526     data.WriteString(srcDevId);
527     std::string dstDevId = "";
528     data.WriteString(dstDevId);
529     result = distributedSchedStub_->ContinueMissionInner(data, reply);
530     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
531 
532     data.WriteString(srcDevId);
533     data.WriteString(dstDevId);
534     int32_t missionId = 0;
535     data.WriteInt32(missionId);
536     result = distributedSchedStub_->ContinueMissionInner(data, reply);
537     EXPECT_EQ(result, ERR_NULL_OBJECT);
538 
539     data.WriteString(srcDevId);
540     data.WriteString(dstDevId);
541     data.WriteInt32(missionId);
542     sptr<IRemoteObject> dsched = new DistributedSchedService();
543     data.WriteRemoteObject(dsched);
544     result = distributedSchedStub_->ContinueMissionInner(data, reply);
545     EXPECT_EQ(result, ERR_NULL_OBJECT);
546 
547     data.WriteString(srcDevId);
548     data.WriteString(dstDevId);
549     data.WriteInt32(missionId);
550     data.WriteRemoteObject(dsched);
551     WantParams wantParams = {};
552     data.WriteParcelable(&wantParams);
553     result = distributedSchedStub_->ContinueMissionInner(data, reply);
554     EXPECT_EQ(result, ERR_NONE);
555     DTEST_LOG << "DistributedSchedStubTest ContinueMissionInner_002 end" << std::endl;
556 }
557 
558 /**
559  * @tc.name:ContinueMissionOfBundleNameInner_003
560  * @tc.desc: call ContinueMissionOfBundleNameInner
561  * @tc.type: FUNC
562  * @tc.require: I7F8KH
563  */
564 HWTEST_F(DistributedSchedStubTest, ContinueMissionOfBundleNameInner_003, TestSize.Level3)
565 {
566     DTEST_LOG << "DistributedSchedStubTest ContinueMissionOfBundleNameInner_003 start" << std::endl;
567 
568     MessageParcel data;
569     MessageParcel reply;
570 
571     /**
572      * @tc.steps: step1. test ContinueMission when callback is nullptr;
573      */
574     std::string srcDevId = "srcDevId";
575     std::string dstDevId = "dstDevId";
576     std::string bundleName = "bundleName";
577     data.WriteString(srcDevId);
578     data.WriteString(dstDevId);
579     data.WriteString(bundleName);
580     int32_t result = distributedSchedStub_->ContinueMissionOfBundleNameInner(data, reply);
581     EXPECT_EQ(result, ERR_NULL_OBJECT);
582 
583     DTEST_LOG << "DistributedSchedStubTest ContinueMissionOfBundleNameInner_003 end" << std::endl;
584 }
585 
586 /**
587  * @tc.name: StartContinuationInner_001
588  * @tc.desc: check StartContinuationInner
589  * @tc.type: FUNC
590  */
591 HWTEST_F(DistributedSchedStubTest, StartContinuationInner_001, TestSize.Level3)
592 {
593     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_001 begin" << std::endl;
594     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
595     MessageParcel data;
596     MessageParcel reply;
597     MessageOption option;
598 
599     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
600     DistributedSchedUtil::MockPermission();
601     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
602     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
603     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_001 end" << std::endl;
604 }
605 
606 /**
607  * @tc.name: StartContinuationInner_002
608  * @tc.desc: check StartContinuationInner
609  * @tc.type: FUNC
610  */
611 HWTEST_F(DistributedSchedStubTest, StartContinuationInner_002, TestSize.Level3)
612 {
613     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_002 begin" << std::endl;
614     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
615     MessageParcel data;
616     MessageParcel reply;
617     MessageOption option;
618 
619     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
620     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
621     EXPECT_EQ(result, ERR_NULL_OBJECT);
622 
623     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
624     Want want;
625     data.WriteParcelable(&want);
626     int32_t missionId = 0;
627     data.WriteInt32(missionId);
628     int32_t callerUid = 0;
629     data.WriteInt32(callerUid);
630     int32_t status = 0;
631     data.WriteInt32(status);
632     uint32_t accessToken = GetSelfTokenID();
633     data.WriteUint32(accessToken);
634     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
635     EXPECT_EQ(result, ERR_NONE);
636     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_002 end" << std::endl;
637 }
638 
639 /**
640  * @tc.name: StartContinuationInner_003
641  * @tc.desc: check StartContinuationInner
642  * @tc.type: FUNC
643  */
644 HWTEST_F(DistributedSchedStubTest, StartContinuationInner_003, TestSize.Level3)
645 {
646     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_003 begin" << std::endl;
647     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
648     MessageParcel data;
649     MessageParcel reply;
650     MessageOption option;
651 
652     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
653     Want want;
654     data.WriteParcelable(&want);
655     int32_t missionId = 0;
656     data.WriteInt32(missionId);
657     int32_t callerUid = 0;
658     data.WriteInt32(callerUid);
659     int32_t status = 0;
660     data.WriteInt32(status);
661     uint32_t accessToken = 0;
662     data.WriteUint32(accessToken);
663     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
664     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
665     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_003 end" << std::endl;
666 }
667 
668 /**
669  * @tc.name: NotifyCompleteContinuationInner_001
670  * @tc.desc: check NotifyCompleteContinuationInner
671  * @tc.type: FUNC
672  */
673 HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_001, TestSize.Level3)
674 {
675     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_001 begin" << std::endl;
676     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION);
677     MessageParcel data;
678     MessageParcel reply;
679     MessageOption option;
680 
681     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
682     DistributedSchedUtil::MockPermission();
683     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
684     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
685     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_001 end" << std::endl;
686 }
687 
688 /**
689  * @tc.name: NotifyCompleteContinuationInner_002
690  * @tc.desc: check NotifyCompleteContinuationInner
691  * @tc.type: FUNC
692  */
693 HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_002, TestSize.Level3)
694 {
695     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_002 begin" << std::endl;
696     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION);
697     MessageParcel data;
698     MessageParcel reply;
699     MessageOption option;
700 
701     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
702     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
703     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
704 
705     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
706     std::u16string devId = u"192.168.43.100";
707     data.WriteString16(devId);
708     int32_t sessionId = 0;
709     data.WriteInt32(sessionId);
710     bool isSuccess = false;
711     data.WriteBool(isSuccess);
712     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
713     EXPECT_EQ(result, ERR_NONE);
714     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_002 end" << std::endl;
715 }
716 
717 /**
718  * @tc.name: NotifyContinuationResultFromRemoteInner_001
719  * @tc.desc: check NotifyContinuationResultFromRemoteInner
720  * @tc.type: FUNC
721  */
722 HWTEST_F(DistributedSchedStubTest, NotifyContinuationResultFromRemoteInner_001, TestSize.Level3)
723 {
724     DTEST_LOG << "DistributedSchedStubTest NotifyContinuationResultFromRemoteInner_001 begin" << std::endl;
725     MessageParcel data;
726     MessageParcel reply;
727 
728     int32_t sessionId = 0;
729     data.WriteInt32(sessionId);
730     bool continuationResult = false;
731     data.WriteBool(continuationResult);
732     int32_t result = distributedSchedStub_->NotifyContinuationResultFromRemoteInner(data, reply);
733     EXPECT_EQ(result, INVALID_REMOTE_PARAMETERS_ERR);
734     DTEST_LOG << "DistributedSchedStubTest NotifyContinuationResultFromRemoteInner_001 end" << std::endl;
735 }
736 
737 /**
738  * @tc.name: ConnectRemoteAbilityInner_001
739  * @tc.desc: check ConnectRemoteAbilityInner
740  * @tc.type: FUNC
741  */
742 HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_001, TestSize.Level3)
743 {
744     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_001 begin" << std::endl;
745     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
746     MessageParcel data;
747     MessageParcel reply;
748     MessageOption option;
749 
750     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
751     DistributedSchedUtil::MockPermission();
752     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
753     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
754     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_001 end" << std::endl;
755 }
756 
757 /**
758  * @tc.name: ConnectRemoteAbilityInner_002
759  * @tc.desc: check ConnectRemoteAbilityInner
760  * @tc.type: FUNC
761  */
762 HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_002, TestSize.Level3)
763 {
764     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_002 begin" << std::endl;
765     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
766     MessageParcel data;
767     MessageParcel reply;
768     MessageOption option;
769 
770     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
771     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
772     EXPECT_EQ(result, ERR_NULL_OBJECT);
773 
774     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
775     Want want;
776     data.WriteParcelable(&want);
777     int32_t callerUid = 0;
778     data.WriteInt32(callerUid);
779     int32_t callerPid = 0;
780     data.WriteInt32(callerPid);
781     uint32_t accessToken = 0;
782     data.WriteUint32(accessToken);
783     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
784     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
785     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_002 end" << std::endl;
786 }
787 
788 /**
789  * @tc.name: ConnectRemoteAbilityInner_003
790  * @tc.desc: check ConnectRemoteAbilityInner
791  * @tc.type: FUNC
792  */
793 HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_003, TestSize.Level3)
794 {
795     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_003 begin" << std::endl;
796     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
797     MessageParcel data;
798     MessageParcel reply;
799     MessageOption option;
800 
801     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
802     Want want;
803     data.WriteParcelable(&want);
804     int32_t callerUid = 0;
805     data.WriteInt32(callerUid);
806     int32_t callerPid = 0;
807     data.WriteInt32(callerPid);
808     uint32_t accessToken = GetSelfTokenID();
809     data.WriteUint32(accessToken);
810     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
811     EXPECT_EQ(result, ERR_NONE);
812     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_003 end" << std::endl;
813 }
814 
815 /**
816  * @tc.name: DisconnectRemoteAbilityInner_001
817  * @tc.desc: check DisconnectRemoteAbilityInner
818  * @tc.type: FUNC
819  */
820 HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_001, TestSize.Level3)
821 {
822     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_001 begin" << std::endl;
823     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
824     MessageParcel data;
825     MessageParcel reply;
826     MessageOption option;
827 
828     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
829     DistributedSchedUtil::MockPermission();
830     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
831     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
832     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_001 end" << std::endl;
833 }
834 
835 /**
836  * @tc.name: DisconnectRemoteAbilityInner_002
837  * @tc.desc: check DisconnectRemoteAbilityInner
838  * @tc.type: FUNC
839  */
840 HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_002, TestSize.Level3)
841 {
842     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_002 begin" << std::endl;
843     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
844     MessageParcel data;
845     MessageParcel reply;
846     MessageOption option;
847 
848     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
849     sptr<IRemoteObject> connect;
850     data.WriteRemoteObject(connect);
851     int32_t callerUid = 0;
852     data.WriteInt32(callerUid);
853     uint32_t accessToken = 0;
854     data.WriteUint32(accessToken);
855     int result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
856     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
857     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_002 end" << std::endl;
858 }
859 
860 /**
861  * @tc.name: DisconnectRemoteAbilityInner_003
862  * @tc.desc: check DisconnectRemoteAbilityInner
863  * @tc.type: FUNC
864  */
865 HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_003, TestSize.Level3)
866 {
867     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_003 begin" << std::endl;
868     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
869     MessageParcel data;
870     MessageParcel reply;
871     MessageOption option;
872 
873     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
874     sptr<IRemoteObject> connect;
875     data.WriteRemoteObject(connect);
876     int32_t callerUid = 0;
877     data.WriteInt32(callerUid);
878     uint32_t accessToken = GetSelfTokenID();
879     data.WriteUint32(accessToken);
880     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
881     EXPECT_EQ(result, ERR_NONE);
882     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_003 end" << std::endl;
883 }
884 
885 /**
886  * @tc.name: ConnectAbilityFromRemoteInner_001
887  * @tc.desc: check ConnectAbilityFromRemoteInner
888  * @tc.type: FUNC
889  */
890 HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_001, TestSize.Level3)
891 {
892     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_001 begin" << std::endl;
893     MessageParcel data;
894     MessageParcel reply;
895 
896     int32_t result = distributedSchedStub_->ConnectAbilityFromRemoteInner(data, reply);
897     EXPECT_EQ(result, ERR_NULL_OBJECT);
898 
899     Want want;
900     data.WriteParcelable(&want);
901     result = distributedSchedStub_->ConnectAbilityFromRemoteInner(data, reply);
902     EXPECT_EQ(result, ERR_NULL_OBJECT);
903 
904     data.WriteParcelable(&want);
905     AbilityInfo abilityInfo;
906     AppExecFwk::CompatibleAbilityInfo compatibleAbilityInfo;
907     abilityInfo.ConvertToCompatiableAbilityInfo(compatibleAbilityInfo);
908     data.WriteParcelable(&compatibleAbilityInfo);
909     sptr<IRemoteObject> connect;
910     data.WriteRemoteObject(connect);
911     CallerInfo callerInfo;
912     callerInfo.uid = 0;
913     data.WriteInt32(callerInfo.uid);
914     callerInfo.pid = 0;
915     data.WriteInt32(callerInfo.pid);
916     callerInfo.sourceDeviceId = "";
917     data.WriteString(callerInfo.sourceDeviceId);
918     DistributedSchedService::AccountInfo accountInfo;
919     accountInfo.accountType = 0;
920     data.WriteInt32(accountInfo.accountType);
921     callerInfo.callerAppId = "";
922     data.WriteString(callerInfo.callerAppId);
923     result = distributedSchedStub_->ConnectAbilityFromRemoteInner(data, reply);
924     EXPECT_EQ(result, ERR_NONE);
925     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_001 end" << std::endl;
926 }
927 
928 /**
929  * @tc.name: ConnectAbilityFromRemoteInner_002
930  * @tc.desc: check ConnectAbilityFromRemoteInner
931  * @tc.type: FUNC
932  */
933 HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_002, TestSize.Level3)
934 {
935     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_002 begin" << std::endl;
936     MessageParcel data;
937     MessageParcel reply;
938 
939     Want want;
940     data.WriteParcelable(&want);
941     AbilityInfo abilityInfo;
942     AppExecFwk::CompatibleAbilityInfo compatibleAbilityInfo;
943     abilityInfo.ConvertToCompatiableAbilityInfo(compatibleAbilityInfo);
944     data.WriteParcelable(&compatibleAbilityInfo);
945     sptr<IRemoteObject> connect;
946     data.WriteRemoteObject(connect);
947     CallerInfo callerInfo;
948     callerInfo.uid = 0;
949     data.WriteInt32(callerInfo.uid);
950     callerInfo.pid = 0;
951     data.WriteInt32(callerInfo.pid);
952     callerInfo.sourceDeviceId = "";
953     data.WriteString(callerInfo.sourceDeviceId);
954     DistributedSchedService::AccountInfo accountInfo;
955     accountInfo.accountType = 0;
956     data.WriteInt32(accountInfo.accountType);
957     data.WriteStringVector(accountInfo.groupIdList);
958     callerInfo.callerAppId = "";
959     data.WriteString(callerInfo.callerAppId);
960     nlohmann::json extraInfoJson;
961     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
962     std::string extraInfo = extraInfoJson.dump();
963     data.WriteString(extraInfo);
964     int32_t result = distributedSchedStub_->ConnectAbilityFromRemoteInner(data, reply);
965     EXPECT_EQ(result, ERR_NONE);
966     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_002 end" << std::endl;
967 }
968 
969 /**
970  * @tc.name: DisconnectAbilityFromRemoteInner_001
971  * @tc.desc: check DisconnectAbilityFromRemoteInner
972  * @tc.type: FUNC
973  */
974 HWTEST_F(DistributedSchedStubTest, DisconnectAbilityFromRemoteInner_001, TestSize.Level3)
975 {
976     DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteInner_001 begin" << std::endl;
977     MessageParcel data;
978     MessageParcel reply;
979 
980     int32_t uid = 0;
981     data.WriteInt32(uid);
982     std::string sourceDeviceId = "";
983     data.WriteString(sourceDeviceId);
984     int32_t result = distributedSchedStub_->DisconnectAbilityFromRemoteInner(data, reply);
985     EXPECT_EQ(result, ERR_NONE);
986     DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteInner_001 end" << std::endl;
987 }
988 
989 /**
990  * @tc.name: NotifyProcessDiedFromRemoteInner_001
991  * @tc.desc: check NotifyProcessDiedFromRemoteInner
992  * @tc.type: FUNC
993  */
994 HWTEST_F(DistributedSchedStubTest, NotifyProcessDiedFromRemoteInner_001, TestSize.Level3)
995 {
996     DTEST_LOG << "DistributedSchedStubTest NotifyProcessDiedFromRemoteInner_001 begin" << std::endl;
997     MessageParcel data;
998     MessageParcel reply;
999 
1000     int32_t uid = 0;
1001     data.WriteInt32(uid);
1002     int32_t pid = 0;
1003     data.WriteInt32(pid);
1004     std::string sourceDeviceId = "";
1005     data.WriteString(sourceDeviceId);
1006     int32_t result = distributedSchedStub_->NotifyProcessDiedFromRemoteInner(data, reply);
1007     EXPECT_EQ(result, ERR_NONE);
1008     DTEST_LOG << "DistributedSchedStubTest NotifyProcessDiedFromRemoteInner_001 end" << std::endl;
1009 }
1010 
1011 #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
1012 /**
1013  * @tc.name: GetMissionInfosInner_001
1014  * @tc.desc: check GetMissionInfosInner
1015  * @tc.type: FUNC
1016  */
1017 HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_001, TestSize.Level3)
1018 {
1019     DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_001 begin" << std::endl;
1020     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_MISSION_INFOS);
1021     MessageParcel data;
1022     MessageParcel reply;
1023     MessageOption option;
1024 
1025     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1026     DistributedSchedUtil::MockPermission();
1027     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1028     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1029     DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_001 end" << std::endl;
1030 }
1031 
1032 /**
1033  * @tc.name: GetMissionInfosInner_002
1034  * @tc.desc: check GetMissionInfosInner
1035  * @tc.type: FUNC
1036  */
1037 HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_002, TestSize.Level3)
1038 {
1039     DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_002 begin" << std::endl;
1040     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_MISSION_INFOS);
1041     MessageParcel data;
1042     MessageParcel reply;
1043     MessageOption option;
1044 
1045     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1046     std::u16string deviceId = u"192.168.43.100";
1047     data.WriteString16(deviceId);
1048     int32_t numMissions = 0;
1049     data.WriteInt32(numMissions);
1050     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1051     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
1052     DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_002 end" << std::endl;
1053 }
1054 
1055 /**
1056  * @tc.name: GetRemoteMissionSnapshotInfoInner_001
1057  * @tc.desc: check GetRemoteMissionSnapshotInfoInner
1058  * @tc.type: FUNC
1059  */
1060 HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_001, TestSize.Level3)
1061 {
1062     DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_001 begin" << std::endl;
1063     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO);
1064     MessageParcel data;
1065     MessageParcel reply;
1066     MessageOption option;
1067 
1068     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1069     DistributedSchedUtil::MockPermission();
1070     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1071     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1072     DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_001 end" << std::endl;
1073 }
1074 
1075 /**
1076  * @tc.name: GetRemoteMissionSnapshotInfoInner_002
1077  * @tc.desc: check GetRemoteMissionSnapshotInfoInner
1078  * @tc.type: FUNC
1079  */
1080 HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_002, TestSize.Level3)
1081 {
1082     DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_002 begin" << std::endl;
1083     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO);
1084     MessageParcel data;
1085     MessageParcel reply;
1086     MessageOption option;
1087 
1088     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1089     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1090     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1091 
1092     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1093     std::string networkId = "255.255.255.255";
1094     data.WriteString(networkId);
1095     int32_t missionId = -1;
1096     data.WriteInt32(missionId);
1097     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1098     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
1099 
1100     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1101     data.WriteString(networkId);
1102     missionId = 0;
1103     data.WriteInt32(missionId);
1104     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1105     EXPECT_EQ(result, ERR_NULL_OBJECT);
1106     DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_002 end" << std::endl;
1107 }
1108 
1109 /**
1110  * @tc.name: RegisterMissionListenerInner_001
1111  * @tc.desc: check RegisterMissionListenerInner
1112  * @tc.type: FUNC
1113  */
1114 HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_001, TestSize.Level3)
1115 {
1116     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_001 begin" << std::endl;
1117     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER);
1118     MessageParcel data;
1119     MessageParcel reply;
1120     MessageOption option;
1121 
1122     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1123     DistributedSchedUtil::MockPermission();
1124     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1125     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1126     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_001 end" << std::endl;
1127 }
1128 
1129 /**
1130  * @tc.name: RegisterMissionListenerInner_002
1131  * @tc.desc: check RegisterMissionListenerInner
1132  * @tc.type: FUNC
1133  */
1134 HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_002, TestSize.Level3)
1135 {
1136     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_002 begin" << std::endl;
1137     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER);
1138     MessageParcel data;
1139     MessageParcel reply;
1140     MessageOption option;
1141 
1142     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1143     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1144     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1145 
1146     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1147     std::u16string devId = u"192.168.43.100";
1148     data.WriteString16(devId);
1149     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1150     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1151 
1152     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1153     data.WriteString16(devId);
1154     sptr<IRemoteObject> missionChangedListener = new DistributedSchedService();
1155     data.WriteRemoteObject(missionChangedListener);
1156     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1157     EXPECT_EQ(result, ERR_NONE);
1158     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_002 end" << std::endl;
1159 }
1160 
1161 /**
1162  * @tc.name: RegisterMissionListenerInner_003
1163  * @tc.desc: check RegisterOnListenerInner
1164  * @tc.type: FUNC
1165  * @tc.require: I7F8KH
1166  */
1167 HWTEST_F(DistributedSchedStubTest, RegisterOnListenerInner_002, TestSize.Level3)
1168 {
1169     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_003 begin" << std::endl;
1170 
1171     MessageParcel data;
1172     MessageParcel reply;
1173 
1174     /**
1175      * @tc.steps: step1. test RegisterOnListenerInner when type is empty;
1176      */
1177     int32_t result = distributedSchedStub_->RegisterOnListenerInner(data, reply);
1178     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1179 
1180     /**
1181      * @tc.steps: step2. test RegisterOnListenerInner when type is not empty;
1182      */
1183     data.WriteString("type");
1184     result = distributedSchedStub_->RegisterOnListenerInner(data, reply);
1185     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1186 
1187     /**
1188      * @tc.steps: step3. test RegisterOnListenerInner when onListener is not empty;
1189      */
1190     data.WriteString("type");
1191     sptr<IRemoteObject> onListener = new DistributedSchedService();
1192     data.WriteRemoteObject(onListener);
1193     result = distributedSchedStub_->RegisterOnListenerInner(data, reply);
1194     EXPECT_EQ(result, ERR_OK);
1195 
1196     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_003 end" << std::endl;
1197 }
1198 
1199 /**
1200  * @tc.name: UnRegisterMissionListenerInner_001
1201  * @tc.desc: check UnRegisterMissionListenerInner
1202  * @tc.type: FUNC
1203  */
1204 HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_001, TestSize.Level3)
1205 {
1206     DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_001 begin" << std::endl;
1207     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER);
1208     MessageParcel data;
1209     MessageParcel reply;
1210     MessageOption option;
1211 
1212     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1213     DistributedSchedUtil::MockPermission();
1214     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1215     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1216     DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_001 end" << std::endl;
1217 }
1218 
1219 /**
1220  * @tc.name: UnRegisterMissionListenerInner_002
1221  * @tc.desc: check UnRegisterMissionListenerInner
1222  * @tc.type: FUNC
1223  */
1224 HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_002, TestSize.Level3)
1225 {
1226     DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_002 begin" << std::endl;
1227     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER);
1228     MessageParcel data;
1229     MessageParcel reply;
1230     MessageOption option;
1231 
1232     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1233     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1234     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1235 
1236     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1237     std::u16string devId = u"192.168.43.100";
1238     data.WriteString16(devId);
1239     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1240     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1241 
1242     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1243     data.WriteString16(devId);
1244     sptr<IRemoteObject> missionChangedListener = new DistributedSchedService();
1245     data.WriteRemoteObject(missionChangedListener);
1246     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1247     EXPECT_EQ(result, ERR_NONE);
1248     DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_002 end" << std::endl;
1249 }
1250 
1251 /**
1252  * @tc.name: StartSyncMissionsFromRemoteInner_001
1253  * @tc.desc: check StartSyncMissionsFromRemoteInner
1254  * @tc.type: FUNC
1255  */
1256 HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_001, TestSize.Level3)
1257 {
1258     DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_001 begin" << std::endl;
1259     MessageParcel data;
1260     MessageParcel reply;
1261 
1262     int32_t result = distributedSchedStub_->StartSyncMissionsFromRemoteInner(data, reply);
1263     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1264     DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_001 end" << std::endl;
1265 }
1266 
1267 /**
1268  * @tc.name: StartSyncMissionsFromRemoteInner_002
1269  * @tc.desc: check StartSyncMissionsFromRemoteInner
1270  * @tc.type: FUNC
1271  */
1272 HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_002, TestSize.Level3)
1273 {
1274     DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_002 begin" << std::endl;
1275     MessageParcel data;
1276     MessageParcel reply;
1277     CallerInfo callerInfo;
1278     CallerInfoMarshalling(callerInfo, data);
1279 
1280     DistributedSchedMissionManager::GetInstance().Init();
1281     int32_t result = distributedSchedStub_->StartSyncMissionsFromRemoteInner(data, reply);
1282     EXPECT_EQ(result, ERR_NONE);
1283     WaitHandlerTaskDone(DistributedSchedMissionManager::GetInstance().missionHandler_);
1284     DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_002 end" << std::endl;
1285 }
1286 
1287 /**
1288  * @tc.name: StopSyncRemoteMissionsInner_001
1289  * @tc.desc: check StopSyncRemoteMissionsInner
1290  * @tc.type: FUNC
1291  */
1292 HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_001, TestSize.Level3)
1293 {
1294     DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_001 begin" << std::endl;
1295     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_SYNC_MISSIONS);
1296     MessageParcel data;
1297     MessageParcel reply;
1298     MessageOption option;
1299 
1300     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1301     DistributedSchedUtil::MockPermission();
1302     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1303     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1304     DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_001 end" << std::endl;
1305 }
1306 
1307 /**
1308  * @tc.name: StopSyncRemoteMissionsInner_002
1309  * @tc.desc: check StopSyncRemoteMissionsInner
1310  * @tc.type: FUNC
1311  */
1312 HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_002, TestSize.Level3)
1313 {
1314     DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_002 begin" << std::endl;
1315     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_SYNC_MISSIONS);
1316     MessageParcel data;
1317     MessageParcel reply;
1318     MessageOption option;
1319 
1320     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1321     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1322     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1323 
1324     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1325     std::u16string deviceId = u"192.168.43.100";
1326     data.WriteString16(deviceId);
1327     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1328     EXPECT_EQ(result, ERR_NONE);
1329     DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_002 end" << std::endl;
1330 }
1331 
1332 /**
1333  * @tc.name: StopSyncMissionsFromRemoteInner_001
1334  * @tc.desc: check StopSyncMissionsFromRemoteInner
1335  * @tc.type: FUNC
1336  */
1337 HWTEST_F(DistributedSchedStubTest, StopSyncMissionsFromRemoteInner_001, TestSize.Level3)
1338 {
1339     DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_001 begin" << std::endl;
1340     MessageParcel data;
1341     MessageParcel reply;
1342 
1343     int32_t result = distributedSchedStub_->StopSyncMissionsFromRemoteInner(data, reply);
1344     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1345     DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_001 end" << std::endl;
1346 }
1347 
1348 /**
1349  * @tc.name: StopSyncMissionsFromRemoteInner_002
1350  * @tc.desc: check StopSyncMissionsFromRemoteInner
1351  * @tc.type: FUNC
1352  */
1353 HWTEST_F(DistributedSchedStubTest, StopSyncMissionsFromRemoteInner_002, TestSize.Level3)
1354 {
1355     DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_002 begin" << std::endl;
1356     MessageParcel data;
1357     MessageParcel reply;
1358     CallerInfo callerInfo;
1359     CallerInfoMarshalling(callerInfo, data);
1360 
1361     DistributedSchedMissionManager::GetInstance().Init();
1362     int32_t result = distributedSchedStub_->StopSyncMissionsFromRemoteInner(data, reply);
1363     EXPECT_NE(result, ERR_FLATTEN_OBJECT);
1364     WaitHandlerTaskDone(DistributedSchedMissionManager::GetInstance().missionHandler_);
1365     DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_002 end" << std::endl;
1366 }
1367 
1368 /**
1369  * @tc.name: NotifyMissionsChangedFromRemoteInner_001
1370  * @tc.desc: check NotifyMissionsChangedFromRemoteInner
1371  * @tc.type: FUNC
1372  */
1373 HWTEST_F(DistributedSchedStubTest, NotifyMissionsChangedFromRemoteInner_001, TestSize.Level3)
1374 {
1375     DTEST_LOG << "DistributedSchedStubTest NotifyMissionsChangedFromRemoteInner_001 begin" << std::endl;
1376     MessageParcel data;
1377     MessageParcel reply;
1378 
1379     int32_t version = 0;
1380     data.WriteInt32(version);
1381     int32_t result = distributedSchedStub_->NotifyMissionsChangedFromRemoteInner(data, reply);
1382     EXPECT_EQ(result, ERR_NONE);
1383     DTEST_LOG << "DistributedSchedStubTest NotifyMissionsChangedFromRemoteInner_001 end" << std::endl;
1384 }
1385 
1386 /**
1387  * @tc.name: StartSyncRemoteMissionsInner_001
1388  * @tc.desc: check StartSyncRemoteMissionsInner
1389  * @tc.type: FUNC
1390  */
1391 HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_001, TestSize.Level3)
1392 {
1393     DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_001 begin" << std::endl;
1394     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_SYNC_MISSIONS);
1395     MessageParcel data;
1396     MessageParcel reply;
1397     MessageOption option;
1398 
1399     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1400     DistributedSchedUtil::MockPermission();
1401     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1402     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1403     DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_001 end" << std::endl;
1404 }
1405 
1406 /**
1407  * @tc.name: StartSyncRemoteMissionsInner_002
1408  * @tc.desc: check StartSyncRemoteMissionsInner
1409  * @tc.type: FUNC
1410  */
1411 HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_002, TestSize.Level3)
1412 {
1413     DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_002 begin" << std::endl;
1414     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_SYNC_MISSIONS);
1415     MessageParcel data;
1416     MessageParcel reply;
1417     MessageOption option;
1418 
1419     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1420     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1421     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1422 
1423     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1424     std::u16string deviceId = u"192.168.43.100";
1425     data.WriteString16(deviceId);
1426     bool fixConflict = false;
1427     data.WriteBool(fixConflict);
1428     int64_t tag = 0;
1429     data.WriteInt64(tag);
1430     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1431     EXPECT_EQ(result, ERR_NONE);
1432     DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_002 end" << std::endl;
1433 }
1434 
1435 /**
1436  * @tc.name: SetMissionContinueStateInner_001
1437  * @tc.desc: check SetMissionContinueStateInner
1438  * @tc.type: FUNC
1439  */
1440 HWTEST_F(DistributedSchedStubTest, SetMissionContinueStateInner_001, TestSize.Level3)
1441 {
1442     DTEST_LOG << "DistributedSchedStubTest SetMissionContinueStateInner_001 begin" << std::endl;
1443     MessageParcel data;
1444     MessageParcel reply;
1445 
1446     int32_t missionId = 0;
1447     int32_t state = 0;
1448     data.WriteInt32(missionId);
1449     data.WriteInt32(state);
1450     int32_t result = distributedSchedStub_->SetMissionContinueStateInner(data, reply);
1451     EXPECT_EQ(result, ERR_NONE);
1452     DTEST_LOG << "DistributedSchedStubTest SetMissionContinueStateInner_001 end" << std::endl;
1453 }
1454 #endif
1455 
1456 /**
1457  * @tc.name: CallerInfoUnmarshalling_001
1458  * @tc.desc: check CallerInfoUnmarshalling
1459  * @tc.type: FUNC
1460  */
1461 HWTEST_F(DistributedSchedStubTest, CallerInfoUnmarshalling_001, TestSize.Level3)
1462 {
1463     DTEST_LOG << "DistributedSchedStubTest CallerInfoUnmarshalling_001 begin" << std::endl;
1464     MessageParcel data;
1465     int32_t uid = 0;
1466     data.WriteInt32(uid);
1467     int32_t pid = 0;
1468     data.WriteInt32(pid);
1469     int32_t callerType = 0;
1470     data.WriteInt32(callerType);
1471     std::string sourceDeviceId = "";
1472     data.WriteString(sourceDeviceId);
1473     int32_t duid = 0;
1474     data.WriteInt32(duid);
1475     std::string callerAppId = "test";
1476     data.WriteString(callerAppId);
1477     int32_t version = 0;
1478     data.WriteInt32(version);
1479     CallerInfo callerInfo;
1480     bool result = distributedSchedStub_->CallerInfoUnmarshalling(callerInfo, data);
1481     EXPECT_TRUE(result);
1482     DTEST_LOG << "DistributedSchedStubTest CallerInfoUnmarshalling_001 end" << std::endl;
1483 }
1484 
1485 /**
1486  * @tc.name: StartRemoteAbilityByCallInner_001
1487  * @tc.desc: check StartRemoteAbilityByCallInner
1488  * @tc.type: FUNC
1489  */
1490 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_001, TestSize.Level3)
1491 {
1492     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_001 begin" << std::endl;
1493     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
1494     MessageParcel data;
1495     MessageParcel reply;
1496     MessageOption option;
1497 
1498     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1499     DistributedSchedUtil::MockPermission();
1500     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1501     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1502     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_001 end" << std::endl;
1503 }
1504 
1505 /**
1506  * @tc.name: StartRemoteAbilityByCallInner_002
1507  * @tc.desc: check StartRemoteAbilityByCallInner
1508  * @tc.type: FUNC
1509  */
1510 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_002, TestSize.Level3)
1511 {
1512     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_002 begin" << std::endl;
1513     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
1514     MessageParcel data;
1515     MessageParcel reply;
1516     MessageOption option;
1517 
1518     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1519     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1520     EXPECT_EQ(result, ERR_NULL_OBJECT);
1521 
1522     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1523     Want want;
1524     data.WriteParcelable(&want);
1525     sptr<IRemoteObject> connect;
1526     data.WriteRemoteObject(connect);
1527     int32_t callerUid = 0;
1528     data.WriteInt32(callerUid);
1529     int32_t callerPid = 0;
1530     data.WriteInt32(callerPid);
1531     uint32_t accessToken = 0;
1532     data.WriteUint32(accessToken);
1533     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1534     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1535     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_002 end" << std::endl;
1536 }
1537 
1538 /**
1539  * @tc.name: StartRemoteAbilityByCallInner_003
1540  * @tc.desc: check StartRemoteAbilityByCallInner
1541  * @tc.type: FUNC
1542  */
1543 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_003, TestSize.Level3)
1544 {
1545     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_003 begin" << std::endl;
1546     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
1547     MessageParcel data;
1548     MessageParcel reply;
1549     MessageOption option;
1550 
1551     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1552     Want want;
1553     data.WriteParcelable(&want);
1554     sptr<IRemoteObject> connect;
1555     data.WriteRemoteObject(connect);
1556     int32_t callerUid = 0;
1557     data.WriteInt32(callerUid);
1558     int32_t callerPid = 0;
1559     data.WriteInt32(callerPid);
1560     uint32_t accessToken = GetSelfTokenID();
1561     data.WriteUint32(accessToken);
1562     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1563     EXPECT_EQ(result, ERR_NONE);
1564     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_003 end" << std::endl;
1565 }
1566 
1567 /**
1568  * @tc.name: ReleaseRemoteAbilityInner_001
1569  * @tc.desc: check ReleaseRemoteAbilityInner
1570  * @tc.type: FUNC
1571  */
1572 HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_001, TestSize.Level3)
1573 {
1574     DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_001 begin" << std::endl;
1575     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY);
1576     MessageParcel data;
1577     MessageParcel reply;
1578     MessageOption option;
1579 
1580     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1581     DistributedSchedUtil::MockPermission();
1582     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1583     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1584     DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_001 end" << std::endl;
1585 }
1586 
1587 /**
1588  * @tc.name: ReleaseRemoteAbilityInner_002
1589  * @tc.desc: check ReleaseRemoteAbilityInner
1590  * @tc.type: FUNC
1591  */
1592 HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_002, TestSize.Level3)
1593 {
1594     DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_002 begin" << std::endl;
1595     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY);
1596     MessageParcel data;
1597     MessageParcel reply;
1598     MessageOption option;
1599 
1600     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1601     sptr<IRemoteObject> connect;
1602     data.WriteRemoteObject(connect);
1603     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1604     EXPECT_EQ(result, ERR_INVALID_VALUE);
1605 
1606     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1607     data.WriteRemoteObject(connect);
1608     ElementName element;
1609     data.WriteParcelable(&element);
1610     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1611     EXPECT_EQ(result, ERR_NONE);
1612     DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_002 end" << std::endl;
1613 }
1614 
1615 /**
1616  * @tc.name: StartAbilityByCallFromRemoteInner_001
1617  * @tc.desc: check StartAbilityByCallFromRemoteInner
1618  * @tc.type: FUNC
1619  */
1620 HWTEST_F(DistributedSchedStubTest, StartAbilityByCallFromRemoteInner_001, TestSize.Level3)
1621 {
1622     DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_001 begin" << std::endl;
1623     MessageParcel data;
1624     MessageParcel reply;
1625 
1626     sptr<IRemoteObject> connect;
1627     data.WriteRemoteObject(connect);
1628     CallerInfo callerInfo;
1629     callerInfo.uid = 0;
1630     data.WriteInt32(callerInfo.uid);
1631     callerInfo.pid = 0;
1632     data.WriteInt32(callerInfo.pid);
1633     callerInfo.sourceDeviceId = "";
1634     data.WriteString(callerInfo.sourceDeviceId);
1635     DistributedSchedService::AccountInfo accountInfo;
1636     accountInfo.accountType = 0;
1637     data.WriteInt32(accountInfo.accountType);
1638     data.WriteStringVector(accountInfo.groupIdList);
1639     callerInfo.callerAppId = "";
1640     data.WriteString(callerInfo.callerAppId);
1641     int32_t result = distributedSchedStub_->StartAbilityByCallFromRemoteInner(data, reply);
1642     EXPECT_EQ(result, ERR_NULL_OBJECT);
1643 
1644     data.WriteRemoteObject(connect);
1645     data.WriteInt32(callerInfo.uid);
1646     data.WriteInt32(callerInfo.pid);
1647     data.WriteString(callerInfo.sourceDeviceId);
1648     data.WriteInt32(accountInfo.accountType);
1649     data.WriteStringVector(accountInfo.groupIdList);
1650     data.WriteString(callerInfo.callerAppId);
1651     nlohmann::json extraInfoJson;
1652     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
1653     std::string extraInfo = extraInfoJson.dump();
1654     data.WriteString(extraInfo);
1655     result = distributedSchedStub_->StartAbilityByCallFromRemoteInner(data, reply);
1656     EXPECT_EQ(result, ERR_NULL_OBJECT);
1657     DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_001 end" << std::endl;
1658 }
1659 
1660 /**
1661  * @tc.name: StartAbilityByCallFromRemoteInner_002
1662  * @tc.desc: check StartAbilityByCallFromRemoteInner
1663  * @tc.type: FUNC
1664  */
1665 HWTEST_F(DistributedSchedStubTest, StartAbilityByCallFromRemoteInner_002, TestSize.Level3)
1666 {
1667     DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_002 begin" << std::endl;
1668     MessageParcel data;
1669     MessageParcel reply;
1670 
1671     sptr<IRemoteObject> connect;
1672     data.WriteRemoteObject(connect);
1673     CallerInfo callerInfo;
1674     callerInfo.uid = 0;
1675     data.WriteInt32(callerInfo.uid);
1676     callerInfo.pid = 0;
1677     data.WriteInt32(callerInfo.pid);
1678     callerInfo.sourceDeviceId = "";
1679     data.WriteString(callerInfo.sourceDeviceId);
1680     DistributedSchedService::AccountInfo accountInfo;
1681     accountInfo.accountType = 0;
1682     data.WriteInt32(accountInfo.accountType);
1683     data.WriteStringVector(accountInfo.groupIdList);
1684     callerInfo.callerAppId = "";
1685     data.WriteString(callerInfo.callerAppId);
1686     nlohmann::json extraInfoJson;
1687     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
1688     std::string extraInfo = extraInfoJson.dump();
1689     data.WriteString(extraInfo);
1690     Want want;
1691     data.WriteParcelable(&want);
1692     int32_t result = distributedSchedStub_->StartAbilityByCallFromRemoteInner(data, reply);
1693     EXPECT_EQ(result, ERR_NONE);
1694     DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_002 end" << std::endl;
1695 }
1696 
1697 /**
1698  * @tc.name: ReleaseAbilityFromRemoteInner_001
1699  * @tc.desc: check ReleaseAbilityFromRemoteInner
1700  * @tc.type: FUNC
1701  */
1702 HWTEST_F(DistributedSchedStubTest, ReleaseAbilityFromRemoteInner_001, TestSize.Level3)
1703 {
1704     DTEST_LOG << "DistributedSchedStubTest ReleaseAbilityFromRemoteInner_001 begin" << std::endl;
1705     MessageParcel data;
1706     MessageParcel reply;
1707 
1708     sptr<IRemoteObject> connect;
1709     data.WriteRemoteObject(connect);
1710     int32_t result = distributedSchedStub_->ReleaseAbilityFromRemoteInner(data, reply);
1711     EXPECT_EQ(result, ERR_INVALID_VALUE);
1712 
1713     data.WriteRemoteObject(connect);
1714     ElementName element;
1715     data.WriteParcelable(&element);
1716     CallerInfo callerInfo;
1717     callerInfo.sourceDeviceId = "";
1718     data.WriteString(callerInfo.sourceDeviceId);
1719     nlohmann::json extraInfoJson;
1720     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
1721     std::string extraInfo = extraInfoJson.dump();
1722     data.WriteString(extraInfo);
1723     result = distributedSchedStub_->ReleaseAbilityFromRemoteInner(data, reply);
1724     EXPECT_EQ(result, ERR_NONE);
1725     DTEST_LOG << "DistributedSchedStubTest ReleaseAbilityFromRemoteInner_001 end" << std::endl;
1726 }
1727 
1728 #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
1729 /**
1730  * @tc.name: StartRemoteShareFormInner_001
1731  * @tc.desc: check StartRemoteShareFormInner
1732  * @tc.type: FUNC
1733  */
1734 HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_001, TestSize.Level3)
1735 {
1736     DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_001 begin" << std::endl;
1737     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM);
1738     MessageParcel data;
1739     MessageParcel reply;
1740     MessageOption option;
1741 
1742     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1743     DistributedSchedUtil::MockPermission();
1744     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1745     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1746     DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_001 end" << std::endl;
1747 }
1748 
1749 /**
1750  * @tc.name: StartRemoteShareFormInner_002
1751  * @tc.desc: check StartRemoteShareFormInner
1752  * @tc.type: FUNC
1753  */
1754 HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_002, TestSize.Level3)
1755 {
1756     DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_002 begin" << std::endl;
1757     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM);
1758     MessageParcel data;
1759     MessageParcel reply;
1760     MessageOption option;
1761 
1762     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1763     std::string deviceId = "";
1764     data.WriteString(deviceId);
1765     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1766     EXPECT_EQ(result, ERR_NONE);
1767 
1768     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1769     data.WriteString(deviceId);
1770     FormShareInfo formShareInfo;
1771     data.WriteParcelable(&formShareInfo);
1772     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1773     EXPECT_EQ(result, ERR_NONE);
1774     DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_002 end" << std::endl;
1775 }
1776 
1777 /**
1778  * @tc.name: StartShareFormFromRemoteInner_001
1779  * @tc.desc: check StartShareFormFromRemoteInner
1780  * @tc.type: FUNC
1781  */
1782 HWTEST_F(DistributedSchedStubTest, StartShareFormFromRemoteInner_001, TestSize.Level3)
1783 {
1784     DTEST_LOG << "DistributedSchedStubTest StartShareFormFromRemoteInner_001 begin" << std::endl;
1785     MessageParcel data;
1786     MessageParcel reply;
1787 
1788     std::string deviceId = "";
1789     data.WriteString(deviceId);
1790     int32_t result = distributedSchedStub_->StartShareFormFromRemoteInner(data, reply);
1791     EXPECT_EQ(result, ERR_NONE);
1792 
1793     data.WriteString(deviceId);
1794     FormShareInfo formShareInfo;
1795     data.WriteParcelable(&formShareInfo);
1796     result = distributedSchedStub_->StartShareFormFromRemoteInner(data, reply);
1797     EXPECT_EQ(result, ERR_NONE);
1798     DTEST_LOG << "DistributedSchedStubTest StartShareFormFromRemoteInner_001 end" << std::endl;
1799 }
1800 #endif
1801 
1802 /**
1803  * @tc.name: StartRemoteFreeInstallInner_001
1804  * @tc.desc: check StartRemoteFreeInstallInner
1805  * @tc.type: FUNC
1806  */
1807 HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_001, TestSize.Level3)
1808 {
1809     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_001 begin" << std::endl;
1810     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
1811     MessageParcel data;
1812     MessageParcel reply;
1813     MessageOption option;
1814 
1815     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1816     DistributedSchedUtil::MockPermission();
1817     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1818     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1819     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_001 end" << std::endl;
1820 }
1821 
1822 /**
1823  * @tc.name: StartRemoteFreeInstallInner_002
1824  * @tc.desc: check StartRemoteFreeInstallInner
1825  * @tc.type: FUNC
1826  */
1827 HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_002, TestSize.Level3)
1828 {
1829     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_002 begin" << std::endl;
1830     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
1831     MessageParcel data;
1832     MessageParcel reply;
1833     MessageOption option;
1834 
1835     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1836     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1837     EXPECT_EQ(result, ERR_NULL_OBJECT);
1838 
1839     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1840     Want want;
1841     data.WriteParcelable(&want);
1842     int32_t callerUid = 0;
1843     data.WriteInt32(callerUid);
1844     int32_t requestCode = 0;
1845     data.WriteInt32(requestCode);
1846     uint32_t accessToken = 0;
1847     data.WriteUint32(accessToken);
1848     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1849     EXPECT_EQ(result, ERR_NULL_OBJECT);
1850 
1851     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1852     data.WriteParcelable(&want);
1853     data.WriteInt32(callerUid);
1854     data.WriteInt32(requestCode);
1855     data.WriteUint32(accessToken);
1856     sptr<IRemoteObject> callback = new DistributedSchedService();
1857     data.WriteRemoteObject(callback);
1858     result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1859     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1860     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_002 end" << std::endl;
1861 }
1862 
1863 /**
1864  * @tc.name: StartRemoteFreeInstallInner_003
1865  * @tc.desc: check StartRemoteFreeInstallInner
1866  * @tc.type: FUNC
1867  */
1868 HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_003, TestSize.Level3)
1869 {
1870     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_003 begin" << std::endl;
1871     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
1872     MessageParcel data;
1873     MessageParcel reply;
1874     MessageOption option;
1875 
1876     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1877     Want want;
1878     data.WriteParcelable(&want);
1879     int32_t callerUid = 0;
1880     data.WriteInt32(callerUid);
1881     int32_t requestCode = 0;
1882     data.WriteInt32(requestCode);
1883     uint32_t accessToken = GetSelfTokenID();
1884     data.WriteUint32(accessToken);
1885     sptr<IRemoteObject> callback = new DistributedSchedService();
1886     data.WriteRemoteObject(callback);
1887     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
1888     EXPECT_EQ(result, ERR_NONE);
1889     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_003 end" << std::endl;
1890 }
1891 
1892 /**
1893  * @tc.name: StartFreeInstallFromRemoteInner_001
1894  * @tc.desc: check StartFreeInstallFromRemoteInner
1895  * @tc.type: FUNC
1896  */
1897 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_001, TestSize.Level3)
1898 {
1899     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_001 begin" << std::endl;
1900     MessageParcel data;
1901     MessageParcel reply;
1902 
1903     int32_t result = distributedSchedStub_->StartFreeInstallFromRemoteInner(data, reply);
1904     EXPECT_EQ(result, ERR_NULL_OBJECT);
1905     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_001 end" << std::endl;
1906 }
1907 
1908 /**
1909  * @tc.name: StartFreeInstallFromRemoteInner_002
1910  * @tc.desc: check StartFreeInstallFromRemoteInner
1911  * @tc.type: FUNC
1912  */
1913 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_002, TestSize.Level3)
1914 {
1915     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_002 begin" << std::endl;
1916     MessageParcel data;
1917     MessageParcel reply;
1918     Want want;
1919     data.WriteParcelable(&want);
1920 
1921     int32_t result = distributedSchedStub_->StartFreeInstallFromRemoteInner(data, reply);
1922     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1923     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_002 end" << std::endl;
1924 }
1925 
1926 /**
1927  * @tc.name: StartFreeInstallFromRemoteInner_003
1928  * @tc.desc: check StartFreeInstallFromRemoteInner
1929  * @tc.type: FUNC
1930  */
1931 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_003, TestSize.Level3)
1932 {
1933     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_003 begin" << std::endl;
1934     MessageParcel data;
1935     MessageParcel reply;
1936     Want want;
1937     CallerInfo callerInfo;
1938     DistributedSchedService::AccountInfo accountInfo;
1939     int64_t taskId = 0;
1940     Want cmpWant;
1941     std::string extraInfo = "extraInfo";
1942     data.WriteParcelable(&want);
1943     FreeInstallInfoMarshalling(callerInfo, accountInfo, taskId, data);
1944     data.WriteParcelable(&cmpWant);
1945     data.WriteString(extraInfo);
1946 
1947     int32_t result = distributedSchedStub_->StartFreeInstallFromRemoteInner(data, reply);
1948     EXPECT_EQ(result, ERR_NONE);
1949     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_003 end" << std::endl;
1950 }
1951 
1952 /**
1953  * @tc.name: StartFreeInstallFromRemoteInner_004
1954  * @tc.desc: check StartFreeInstallFromRemoteInner
1955  * @tc.type: FUNC
1956  */
1957 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_004, TestSize.Level3)
1958 {
1959     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_004 begin" << std::endl;
1960     MessageParcel data;
1961     MessageParcel reply;
1962     Want want;
1963     CallerInfo callerInfo;
1964     DistributedSchedService::AccountInfo accountInfo;
1965     int64_t taskId = 0;
1966     Want cmpWant;
1967     std::string extraInfo = "{\"accessTokenID\": 0}";
1968     data.WriteParcelable(&want);
1969     FreeInstallInfoMarshalling(callerInfo, accountInfo, taskId, data);
1970     data.WriteParcelable(&cmpWant);
1971     data.WriteString(extraInfo);
1972 
1973     int32_t result = distributedSchedStub_->StartFreeInstallFromRemoteInner(data, reply);
1974     EXPECT_EQ(result, ERR_NONE);
1975     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_004 end" << std::endl;
1976 }
1977 
1978 /**
1979  * @tc.name: StartFreeInstallFromRemoteInner_005
1980  * @tc.desc: check StartFreeInstallFromRemoteInner
1981  * @tc.type: FUNC
1982  */
1983 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_005, TestSize.Level3)
1984 {
1985     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_005 begin" << std::endl;
1986     MessageParcel data;
1987     MessageParcel reply;
1988     Want want;
1989     CallerInfo callerInfo;
1990     DistributedSchedService::AccountInfo accountInfo;
1991     int64_t taskId = 0;
1992     Want cmpWant;
1993     std::string extraInfo = "{\"requestCode\": 0, \"accessTokenID\": 0}";
1994     data.WriteParcelable(&want);
1995     FreeInstallInfoMarshalling(callerInfo, accountInfo, taskId, data);
1996     data.WriteParcelable(&cmpWant);
1997     data.WriteString(extraInfo);
1998 
1999     int32_t result = distributedSchedStub_->StartFreeInstallFromRemoteInner(data, reply);
2000     EXPECT_EQ(result, ERR_NONE);
2001     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_005 end" << std::endl;
2002 }
2003 
2004 /**
2005  * @tc.name: NotifyCompleteFreeInstallFromRemoteInner_001
2006  * @tc.desc: check NotifyCompleteFreeInstallFromRemoteInner
2007  * @tc.type: FUNC
2008  */
2009 HWTEST_F(DistributedSchedStubTest, NotifyCompleteFreeInstallFromRemoteInner_001, TestSize.Level3)
2010 {
2011     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteFreeInstallFromRemoteInner_001 begin" << std::endl;
2012     MessageParcel data;
2013     MessageParcel reply;
2014 
2015     int32_t result = distributedSchedStub_->NotifyCompleteFreeInstallFromRemoteInner(data, reply);
2016     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
2017 
2018     int64_t taskId = 0;
2019     data.WriteInt64(taskId);
2020     int32_t resultCode = 0;
2021     data.WriteInt32(resultCode);
2022     result = distributedSchedStub_->NotifyCompleteFreeInstallFromRemoteInner(data, reply);
2023     EXPECT_EQ(result, ERR_NONE);
2024     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteFreeInstallFromRemoteInner_001 end" << std::endl;
2025 }
2026 
2027 /**
2028  * @tc.name: StopRemoteExtensionAbilityInner_001
2029  * @tc.desc: check StopRemoteExtensionAbilityInner
2030  * @tc.type: FUNC
2031  */
2032 HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_001, TestSize.Level1)
2033 {
2034     DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_001 begin" << std::endl;
2035     const char* processName = "testCase";
2036     const char* permissionState[] = {
2037         "ohos.permission.ACCESS_SERVICE_DM"
2038     };
2039     Want want;
2040     want.SetElementName("test.test.test", "Ability");
2041     int32_t callerUid = 0;
2042     uint32_t accessToken = 0;
2043     int32_t serviceType = 0;
2044     MessageParcel reply;
2045 
2046     MessageParcel dataFirst;
2047     DistributedSchedUtil::MockProcessAndPermission(processName, permissionState, 1);
2048     auto result = distributedSchedStub_->StopRemoteExtensionAbilityInner(dataFirst, reply);
2049     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
2050 
2051     DistributedSchedUtil::MockProcessAndPermission(FOUNDATION_PROCESS_NAME, permissionState, 1);
2052     MessageParcel dataSecond;
2053     result = distributedSchedStub_->StopRemoteExtensionAbilityInner(dataSecond, reply);
2054     EXPECT_EQ(result, ERR_NULL_OBJECT);
2055 
2056     DistributedSchedUtil::MockProcessAndPermission(FOUNDATION_PROCESS_NAME, permissionState, 1);
2057 
2058     MessageParcel dataThird;
2059     dataThird.WriteParcelable(&want);
2060     dataThird.WriteInt32(callerUid);
2061     dataThird.WriteUint32(accessToken);
2062     dataThird.WriteInt32(serviceType);
2063     result = distributedSchedStub_->StopRemoteExtensionAbilityInner(dataThird, reply);
2064     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
2065     DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_001 end" << std::endl;
2066 }
2067 
2068 /**
2069  * @tc.name: StopExtensionAbilityFromRemoteInner_001
2070  * @tc.desc: check StopExtensionAbilityFromRemoteInner
2071  * @tc.type: FUNC
2072  */
2073 HWTEST_F(DistributedSchedStubTest, StopExtensionAbilityFromRemoteInner_001, TestSize.Level1)
2074 {
2075     DTEST_LOG << "DistributedSchedStubTest StopExtensionAbilityFromRemoteInner_001 begin" << std::endl;
2076     Want want;
2077     want.SetElementName("test.test.test", "Ability");
2078     int32_t callerUid = 0;
2079     int32_t serviceType = 0;
2080     std::string deviceId = "1234567890abcdefghijklmnopqrstuvwxyz";
2081     std::vector<std::string> list = {
2082         "test1",
2083         "test2"
2084     };
2085     std::string appId = "1234567890abcdefghijklmnopqrstuvwxyz";
2086     std::string extraInfo = "{ \"accessTokenID\": 1989 }";
2087     std::string extraInfoEmptr = "";
2088     MessageParcel reply;
2089 
2090     MessageParcel dataFirst;
2091     auto result = distributedSchedStub_->StopExtensionAbilityFromRemoteInner(dataFirst, reply);
2092     EXPECT_EQ(result, ERR_NULL_OBJECT);
2093 
2094     MessageParcel dataSecond;
2095     dataSecond.WriteParcelable(&want);
2096     dataSecond.WriteInt32(serviceType);
2097     dataSecond.WriteInt32(callerUid);
2098     dataSecond.WriteString(deviceId);
2099     dataSecond.WriteStringVector(list);
2100     dataSecond.WriteString(appId);
2101     dataSecond.WriteString(extraInfo);
2102     result = distributedSchedStub_->StopExtensionAbilityFromRemoteInner(dataSecond, reply);
2103     EXPECT_EQ(result, ERR_NONE);
2104 
2105     MessageParcel dataThird;
2106     dataThird.WriteParcelable(&want);
2107     dataThird.WriteInt32(serviceType);
2108     dataThird.WriteInt32(callerUid);
2109     dataThird.WriteString(deviceId);
2110     dataThird.WriteStringVector(list);
2111     dataThird.WriteString(appId);
2112     dataThird.WriteString(extraInfoEmptr);
2113     result = distributedSchedStub_->StopExtensionAbilityFromRemoteInner(dataThird, reply);
2114     EXPECT_EQ(result, ERR_NONE);
2115     DTEST_LOG << "DistributedSchedStubTest StopExtensionAbilityFromRemoteInner_001 end" << std::endl;
2116 }
2117 
2118 /**
2119  * @tc.name: NotifyStateChangedFromRemoteInner_001
2120  * @tc.desc: check NotifyStateChangedFromRemoteInner
2121  * @tc.type: FUNC
2122  * @tc.require: I6VDBO
2123  */
2124 HWTEST_F(DistributedSchedStubTest, NotifyStateChangedFromRemoteInner_001, TestSize.Level1)
2125 {
2126     DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_001 begin" << std::endl;
2127     MessageParcel data;
2128     MessageParcel reply;
2129     int32_t abilityState = 0;
2130     data.WriteInt32(abilityState);
2131     int32_t missionId = 0;
2132     data.WriteInt32(missionId);
2133     ElementName element;
2134     data.WriteParcelable(&element);
2135 
2136     int32_t result = distributedSchedStub_->NotifyStateChangedFromRemoteInner(data, reply);
2137     EXPECT_EQ(result, ERR_NONE);
2138     DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_001 end" << std::endl;
2139 }
2140 
2141 /**
2142  * @tc.name: NotifyStateChangedFromRemoteInner_002
2143  * @tc.desc: check NotifyStateChangedFromRemoteInner
2144  * @tc.type: FUNC
2145  * @tc.require: I6VDBO
2146  */
2147 HWTEST_F(DistributedSchedStubTest, NotifyStateChangedFromRemoteInner_002, TestSize.Level1)
2148 {
2149     DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_002 begin" << std::endl;
2150 
2151     nlohmann::json extraInfoJson;
2152     CallerInfo callerInfo;
2153     distributedSchedStub_->SaveExtraInfo(extraInfoJson, callerInfo);
2154 
2155     nlohmann::json extraInfoJson1;
2156     extraInfoJson[DMS_VERSION_ID] = "4";
2157     CallerInfo callerInfo1;
2158     distributedSchedStub_->SaveExtraInfo(extraInfoJson1, callerInfo1);
2159 
2160     nlohmann::json extraInfoJson2;
2161     extraInfoJson[DMS_VERSION_ID] = 4;
2162     CallerInfo callerInfo2;
2163     distributedSchedStub_->SaveExtraInfo(extraInfoJson2, callerInfo2);
2164 
2165     MessageParcel data;
2166     MessageParcel reply;
2167 
2168     int32_t abilityState = 0;
2169     data.WriteInt32(abilityState);
2170     int32_t missionId = 0;
2171     data.WriteInt32(missionId);
2172     int32_t result = distributedSchedStub_->NotifyStateChangedFromRemoteInner(data, reply);
2173     EXPECT_EQ(result, ERR_INVALID_VALUE);
2174     DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_002 end" << std::endl;
2175 }
2176 
2177 /**
2178  * @tc.name: StopRemoteExtensionAbilityInner_002
2179  * @tc.desc: check StopRemoteExtensionAbilityInner
2180  * @tc.type: FUNC
2181  * @tc.require: I6YLV1
2182  */
2183 HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_002, TestSize.Level1)
2184 {
2185     DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_002 begin" << std::endl;
2186 
2187     nlohmann::json extraInfoJson;
2188     CallerInfo callerInfo;
2189     distributedSchedStub_->SaveExtraInfo(extraInfoJson, callerInfo);
2190 
2191     nlohmann::json extraInfoJson1;
2192     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
2193     CallerInfo callerInfo1;
2194     distributedSchedStub_->SaveExtraInfo(extraInfoJson1, callerInfo1);
2195 
2196     nlohmann::json extraInfoJson2;
2197     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = "4";
2198     CallerInfo callerInfo2;
2199     distributedSchedStub_->SaveExtraInfo(extraInfoJson2, callerInfo2);
2200 
2201     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_REMOTE_EXTERNSION_ABILITY);
2202     MessageParcel data;
2203     MessageParcel reply;
2204     MessageOption option;
2205 
2206     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
2207     Want want;
2208     data.WriteParcelable(&want);
2209     int32_t callingUid = 0;
2210     data.WriteInt32(callingUid);
2211     uint32_t accessToken = GetSelfTokenID();
2212     data.WriteUint32(accessToken);
2213     int32_t serviceType = 0;
2214     data.WriteInt32(serviceType);
2215     int32_t result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
2216     EXPECT_EQ(result, ERR_NONE);
2217     DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_002 end" << std::endl;
2218 }
2219 }
2220 }