• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #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_test_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 "multi_user_manager.h"
28 #include "parcel_helper.h"
29 #include "test_log.h"
30 #include "token_setproc.h"
31 
32 using namespace testing;
33 using namespace testing::ext;
34 using namespace OHOS::AAFwk;
35 using namespace OHOS::AppExecFwk;
36 
37 namespace OHOS {
38 namespace DistributedSchedule {
39 namespace {
40 const std::u16string DMS_STUB_INTERFACE_TOKEN = u"ohos.distributedschedule.accessToken";
41 const std::u16string MOCK_INVALID_DESCRIPTOR = u"invalid descriptor";
42 const std::string EXTRO_INFO_JSON_KEY_ACCESS_TOKEN = "accessTokenID";
43 const std::string EXTRO_INFO_JSON_KEY_REQUEST_CODE = "requestCode";
44 const std::string DMS_VERSION_ID = "dmsVersion";
45 const std::string DMS_UID_SPEC_BUNDLE_NAME = "dmsCallerUidBundleName";
46 const std::string CMPT_PARAM_FREEINSTALL_BUNDLENAMES = "ohos.extra.param.key.allowedBundles";
47 constexpr const char* FOUNDATION_PROCESS_NAME = "foundation";
48 constexpr int32_t MAX_WAIT_TIME = 5000;
49 const char *PERMS[] = {
50     "ohos.permission.DISTRIBUTED_DATASYNC"
51 };
52 }
53 
SetUpTestCase()54 void DistributedSchedStubTest::SetUpTestCase()
55 {
56     DTEST_LOG << "DistributedSchedStubTest::SetUpTestCase" << std::endl;
57 }
58 
TearDownTestCase()59 void DistributedSchedStubTest::TearDownTestCase()
60 {
61     DTEST_LOG << "DistributedSchedStubTest::TearDownTestCase" << std::endl;
62 }
63 
TearDown()64 void DistributedSchedStubTest::TearDown()
65 {
66     DTEST_LOG << "DistributedSchedStubTest::TearDown" << std::endl;
67 }
68 
SetUp()69 void DistributedSchedStubTest::SetUp()
70 {
71     DTEST_LOG << "DistributedSchedStubTest::SetUp" << std::endl;
72     DistributedSchedUtil::MockProcessAndPermission(FOUNDATION_PROCESS_NAME, PERMS, 1);
73 }
74 
75 static bool g_isForeground = true;
76 
IsCallerForeground(int32_t callingUid)77 bool MultiUserManager::IsCallerForeground(int32_t callingUid)
78 {
79     return g_isForeground;
80 }
81 
WaitHandlerTaskDone(const std::shared_ptr<AppExecFwk::EventHandler> & handler)82 void DistributedSchedStubTest::WaitHandlerTaskDone(const std::shared_ptr<AppExecFwk::EventHandler> &handler)
83 {
84     DTEST_LOG << "DistributedSchedStubTest::WaitHandlerTaskDone" << std::endl;
85     // Wait until all asyn tasks are completed before exiting the test suite
86     isTaskDone_ = false;
87     auto taskDoneNotifyTask = [this]() {
88         std::lock_guard<std::mutex> autoLock(taskDoneLock_);
89         isTaskDone_ = true;
90         taskDoneCondition_.notify_all();
91     };
92     if (handler != nullptr) {
93         handler->PostTask(taskDoneNotifyTask);
94     }
95     std::unique_lock<std::mutex> lock(taskDoneLock_);
96     taskDoneCondition_.wait_for(lock, std::chrono::milliseconds(MAX_WAIT_TIME),
97         [&] () { return isTaskDone_;});
98 }
99 
CallerInfoMarshalling(const CallerInfo & callerInfo,MessageParcel & data)100 void DistributedSchedStubTest::CallerInfoMarshalling(const CallerInfo& callerInfo, MessageParcel& data)
101 {
102     data.WriteInt32(callerInfo.uid);
103     data.WriteInt32(callerInfo.pid);
104     data.WriteInt32(callerInfo.callerType);
105     data.WriteString(callerInfo.sourceDeviceId);
106     data.WriteInt32(callerInfo.duid);
107     data.WriteString(callerInfo.callerAppId);
108     data.WriteInt32(callerInfo.dmsVersion);
109 }
110 
FreeInstallInfoMarshalling(const CallerInfo & callerInfo,const DistributedSchedService::AccountInfo accountInfo,const int64_t taskId,MessageParcel & data)111 void DistributedSchedStubTest::FreeInstallInfoMarshalling(const CallerInfo& callerInfo,
112     const DistributedSchedService::AccountInfo accountInfo, const int64_t taskId, MessageParcel& data)
113 {
114     data.WriteInt32(callerInfo.uid);
115     data.WriteString(callerInfo.sourceDeviceId);
116     data.WriteInt32(accountInfo.accountType);
117     data.WriteStringVector(accountInfo.groupIdList);
118     data.WriteString(callerInfo.callerAppId);
119     data.WriteInt64(taskId);
120 }
121 
122 /**
123  * @tc.name: OnRemoteRequest_001
124  * @tc.desc: check OnRemoteRequest
125  * @tc.type: FUNC
126  */
127 HWTEST_F(DistributedSchedStubTest, OnRemoteRequest_001, TestSize.Level3)
128 {
129     DTEST_LOG << "DistributedSchedStubTest OnRemoteRequest_001 begin" << std::endl;
130     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
131     MessageParcel data;
132     MessageParcel reply;
133     MessageOption option;
134 
135     data.WriteInterfaceToken(MOCK_INVALID_DESCRIPTOR);
136     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
137     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
138     DTEST_LOG << "DistributedSchedStubTest OnRemoteRequest_001 end" << std::endl;
139 }
140 
141 /**
142  * @tc.name: StartRemoteAbilityInner_001
143  * @tc.desc: check StartRemoteAbilityInner
144  * @tc.type: FUNC
145  */
146 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_001, TestSize.Level3)
147 {
148     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_001 begin" << std::endl;
149     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
150     MessageParcel data;
151     MessageParcel reply;
152     MessageOption option;
153 
154     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
155     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
156     EXPECT_EQ(result, ERR_NULL_OBJECT);
157     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_001 end" << std::endl;
158 }
159 
160 /**
161  * @tc.name: StartRemoteAbilityInner_002
162  * @tc.desc: check StartRemoteAbilityInner
163  * @tc.type: FUNC
164  */
165 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_002, TestSize.Level3)
166 {
167     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_002 begin" << std::endl;
168     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
169     MessageParcel data;
170     MessageParcel reply;
171     MessageOption option;
172 
173     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
174     Want want;
175     data.WriteParcelable(&want);
176     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
177     EXPECT_NE(result, ERR_NONE);
178 
179     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
180     data.WriteParcelable(&want);
181     int32_t callingUid = 0;
182     data.WriteInt32(callingUid);
183     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
184     EXPECT_NE(result, ERR_NONE);
185 
186     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
187     data.WriteParcelable(&want);
188     data.WriteInt32(callingUid);
189     int32_t requestCode = 0;
190     data.WriteInt32(requestCode);
191     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
192     EXPECT_NE(result, ERR_NONE);
193 
194     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
195     data.WriteParcelable(&want);
196     data.WriteInt32(callingUid);
197     data.WriteInt32(requestCode);
198     uint32_t accessToken = 0;
199     data.WriteUint32(accessToken);
200     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
201     EXPECT_EQ(result, ERR_NONE);
202     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_002 end" << std::endl;
203 }
204 
205 /**
206  * @tc.name: StartRemoteAbilityInner_003
207  * @tc.desc: check StartRemoteAbilityInner
208  * @tc.type: FUNC
209  */
210 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_003, TestSize.Level3)
211 {
212     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_003 begin" << std::endl;
213     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
214     MessageParcel data;
215     MessageParcel reply;
216     MessageOption option;
217 
218     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
219     Want want;
220     data.WriteParcelable(&want);
221     int32_t callingUid = 0;
222     data.WriteInt32(callingUid);
223     int32_t requestCode = 0;
224     data.WriteInt32(requestCode);
225     uint32_t accessToken = GetSelfTokenID();
226     data.WriteUint32(accessToken);
227     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
228     EXPECT_EQ(result, ERR_NONE);
229     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_003 end" << std::endl;
230 }
231 
232 /**
233  * @tc.name: StartRemoteAbilityInner_004
234  * @tc.desc: check StartRemoteAbilityInner
235  * @tc.type: FUNC
236  * @tc.require: I70WDT
237  */
238 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_004, TestSize.Level3)
239 {
240     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_004 begin" << std::endl;
241     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY);
242     MessageParcel data;
243     MessageParcel reply;
244     MessageOption option;
245 
246     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
247     DistributedSchedUtil::MockPermission();
248     int32_t ret = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
249 
250     Want want;
251     std::string eventName;
252     int32_t result = 0;
253     int32_t uid = -1;
254     DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().StartAbilityFromRemoteInner(data, reply);
271     EXPECT_EQ(result, ERR_NULL_OBJECT);
272 
273     Want want;
274     data.WriteParcelable(&want);
275     result = DistributedSchedService::GetInstance().StartAbilityFromRemoteInner(data, reply);
276     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
277 
278     data.WriteParcelable(&want);
279     AbilityInfo abilityInfo;
280     AppExecFwk::CompatibleAbilityInfo compatibleAbilityInfo;
281     abilityInfo.ConvertToCompatiableAbilityInfo(compatibleAbilityInfo);
282     data.WriteParcelable(&compatibleAbilityInfo);
283     result = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().SendResultFromRemoteInner(data, reply);
405     EXPECT_EQ(result, ERR_NULL_OBJECT);
406 
407     Want want;
408     data.WriteParcelable(&want);
409     result = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().ContinueMissionInner(data, reply);
519     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
520 
521     std::string srcDevId = "";
522     data.WriteString(srcDevId);
523     result = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().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 = DistributedSchedService::GetInstance().ContinueMissionInner(data, reply);
554     EXPECT_EQ(result, ERR_NULL_OBJECT);
555     DTEST_LOG << "DistributedSchedStubTest ContinueMissionInner_002 end" << std::endl;
556 }
557 
558 /**
559  * @tc.name: CheckPermission_001
560  * @tc.desc: check CheckPermission
561  * @tc.type: FUNC
562  */
563 HWTEST_F(DistributedSchedStubTest, CheckPermission_001, TestSize.Level3)
564 {
565     DTEST_LOG << "DistributedSchedStubTest CheckPermission_001 begin" << std::endl;
566     auto result = DistributedSchedService::GetInstance().CheckPermission(true);
567     EXPECT_EQ(result, true);
568     DTEST_LOG << "DistributedSchedStubTest CheckPermission_001 end" << std::endl;
569 }
570 
571 /**
572  * @tc.name:ContinueMissionOfBundleNameInner_003
573  * @tc.desc: call ContinueMissionOfBundleNameInner
574  * @tc.type: FUNC
575  * @tc.require: I7F8KH
576  */
577 HWTEST_F(DistributedSchedStubTest, ContinueMissionOfBundleNameInner_003, TestSize.Level3)
578 {
579     DTEST_LOG << "DistributedSchedStubTest ContinueMissionOfBundleNameInner_003 start" << std::endl;
580 
581     MessageParcel data;
582     MessageParcel reply;
583 
584     /**
585      * @tc.steps: step1. test ContinueMission when callback is nullptr;
586      */
587     std::string srcDevId = "srcDevId";
588     std::string dstDevId = "dstDevId";
589     std::string bundleName = "bundleName";
590     data.WriteString(srcDevId);
591     data.WriteString(dstDevId);
592     data.WriteString(bundleName);
593     int32_t result = DistributedSchedService::GetInstance().ContinueMissionOfBundleNameInner(data, reply);
594     EXPECT_EQ(result, ERR_NULL_OBJECT);
595 
596     DTEST_LOG << "DistributedSchedStubTest ContinueMissionOfBundleNameInner_003 end" << std::endl;
597 }
598 
599 /**
600  * @tc.name: StartContinuationInner_001
601  * @tc.desc: check StartContinuationInner
602  * @tc.type: FUNC
603  */
604 HWTEST_F(DistributedSchedStubTest, StartContinuationInner_001, TestSize.Level3)
605 {
606     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_001 begin" << std::endl;
607     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
608     MessageParcel data;
609     MessageParcel reply;
610     MessageOption option;
611 
612     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
613     DistributedSchedUtil::MockPermission();
614     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
615     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
616     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_001 end" << std::endl;
617 }
618 
619 /**
620  * @tc.name: StartContinuationInner_002
621  * @tc.desc: check StartContinuationInner
622  * @tc.type: FUNC
623  */
624 HWTEST_F(DistributedSchedStubTest, StartContinuationInner_002, TestSize.Level3)
625 {
626     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_002 begin" << std::endl;
627     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
628     MessageParcel data;
629     MessageParcel reply;
630     MessageOption option;
631 
632     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
633     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
634     EXPECT_EQ(result, ERR_NULL_OBJECT);
635 
636     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
637     Want want;
638     data.WriteParcelable(&want);
639     int32_t missionId = 0;
640     data.WriteInt32(missionId);
641     int32_t callerUid = 0;
642     data.WriteInt32(callerUid);
643     int32_t status = 0;
644     data.WriteInt32(status);
645     uint32_t accessToken = GetSelfTokenID();
646     data.WriteUint32(accessToken);
647     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
648     EXPECT_EQ(result, ERR_NONE);
649     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_002 end" << std::endl;
650 }
651 
652 /**
653  * @tc.name: StartContinuationInner_003
654  * @tc.desc: check StartContinuationInner
655  * @tc.type: FUNC
656  */
657 HWTEST_F(DistributedSchedStubTest, StartContinuationInner_003, TestSize.Level3)
658 {
659     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_003 begin" << std::endl;
660     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_CONTINUATION);
661     MessageParcel data;
662     MessageParcel reply;
663     MessageOption option;
664 
665     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
666     Want want;
667     data.WriteParcelable(&want);
668     int32_t missionId = 0;
669     data.WriteInt32(missionId);
670     int32_t callerUid = 0;
671     data.WriteInt32(callerUid);
672     int32_t status = 0;
673     data.WriteInt32(status);
674     uint32_t accessToken = 0;
675     data.WriteUint32(accessToken);
676     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
677     EXPECT_EQ(result, ERR_NONE);
678     DTEST_LOG << "DistributedSchedStubTest StartContinuationInner_003 end" << std::endl;
679 }
680 
681 /**
682  * @tc.name: NotifyCompleteContinuationInner_001
683  * @tc.desc: check NotifyCompleteContinuationInner
684  * @tc.type: FUNC
685  */
686 HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_001, TestSize.Level3)
687 {
688     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_001 begin" << std::endl;
689     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION);
690     MessageParcel data;
691     MessageParcel reply;
692     MessageOption option;
693 
694     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
695     DistributedSchedUtil::MockPermission();
696     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
697     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
698     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_001 end" << std::endl;
699 }
700 
701 /**
702  * @tc.name: NotifyCompleteContinuationInner_002
703  * @tc.desc: check NotifyCompleteContinuationInner
704  * @tc.type: FUNC
705  */
706 HWTEST_F(DistributedSchedStubTest, NotifyCompleteContinuationInner_002, TestSize.Level3)
707 {
708     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_002 begin" << std::endl;
709     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::NOTIFY_COMPLETE_CONTINUATION);
710     MessageParcel data;
711     MessageParcel reply;
712     MessageOption option;
713 
714     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
715     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
716     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
717 
718     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
719     std::u16string devId = u"192.168.43.100";
720     data.WriteString16(devId);
721     int32_t sessionId = 0;
722     data.WriteInt32(sessionId);
723     bool isSuccess = false;
724     data.WriteBool(isSuccess);
725     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
726     EXPECT_EQ(result, ERR_NONE);
727     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteContinuationInner_002 end" << std::endl;
728 }
729 
730 /**
731  * @tc.name: NotifyContinuationResultFromRemoteInner_001
732  * @tc.desc: check NotifyContinuationResultFromRemoteInner
733  * @tc.type: FUNC
734  */
735 HWTEST_F(DistributedSchedStubTest, NotifyContinuationResultFromRemoteInner_001, TestSize.Level3)
736 {
737     DTEST_LOG << "DistributedSchedStubTest NotifyContinuationResultFromRemoteInner_001 begin" << std::endl;
738     MessageParcel data;
739     MessageParcel reply;
740 
741     int32_t sessionId = 0;
742     data.WriteInt32(sessionId);
743     bool continuationResult = false;
744     data.WriteBool(continuationResult);
745     std::string info(DMS_VERSION_ID);
746     data.WriteString(info.c_str());
747     int32_t result = DistributedSchedService::GetInstance().NotifyContinuationResultFromRemoteInner(data, reply);
748     EXPECT_EQ(result, INVALID_REMOTE_PARAMETERS_ERR);
749     DTEST_LOG << "DistributedSchedStubTest NotifyContinuationResultFromRemoteInner_001 end" << std::endl;
750 }
751 
752 /**
753  * @tc.name: ConnectRemoteAbilityInner_001
754  * @tc.desc: check ConnectRemoteAbilityInner
755  * @tc.type: FUNC
756  */
757 HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_001, TestSize.Level3)
758 {
759     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_001 begin" << std::endl;
760     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
761     MessageParcel data;
762     MessageParcel reply;
763     MessageOption option;
764 
765     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
766     DistributedSchedUtil::MockPermission();
767     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
768     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
769     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_001 end" << std::endl;
770 }
771 
772 /**
773  * @tc.name: ConnectRemoteAbilityInner_002
774  * @tc.desc: check ConnectRemoteAbilityInner
775  * @tc.type: FUNC
776  */
777 HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_002, TestSize.Level3)
778 {
779     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_002 begin" << std::endl;
780     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
781     MessageParcel data;
782     MessageParcel reply;
783     MessageOption option;
784 
785     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
786     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
787     EXPECT_EQ(result, ERR_NULL_OBJECT);
788 
789     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
790     Want want;
791     data.WriteParcelable(&want);
792     int32_t callerUid = 0;
793     data.WriteInt32(callerUid);
794     int32_t callerPid = 0;
795     data.WriteInt32(callerPid);
796     uint32_t accessToken = 0;
797     data.WriteUint32(accessToken);
798     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
799     EXPECT_EQ(result, ERR_NONE);
800     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_002 end" << std::endl;
801 }
802 
803 /**
804  * @tc.name: ConnectRemoteAbilityInner_003
805  * @tc.desc: check ConnectRemoteAbilityInner
806  * @tc.type: FUNC
807  */
808 HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_003, TestSize.Level3)
809 {
810     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_003 begin" << std::endl;
811     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::CONNECT_REMOTE_ABILITY);
812     MessageParcel data;
813     MessageParcel reply;
814     MessageOption option;
815 
816     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
817     Want want;
818     data.WriteParcelable(&want);
819     int32_t callerUid = 0;
820     data.WriteInt32(callerUid);
821     int32_t callerPid = 0;
822     data.WriteInt32(callerPid);
823     uint32_t accessToken = GetSelfTokenID();
824     data.WriteUint32(accessToken);
825     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
826     EXPECT_EQ(result, ERR_NONE);
827     DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_003 end" << std::endl;
828 }
829 
830 /**
831  * @tc.name: DisconnectRemoteAbilityInner_001
832  * @tc.desc: check DisconnectRemoteAbilityInner
833  * @tc.type: FUNC
834  */
835 HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_001, TestSize.Level3)
836 {
837     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_001 begin" << std::endl;
838     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
839     MessageParcel data;
840     MessageParcel reply;
841     MessageOption option;
842 
843     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
844     DistributedSchedUtil::MockPermission();
845     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
846     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
847     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_001 end" << std::endl;
848 }
849 
850 /**
851  * @tc.name: DisconnectRemoteAbilityInner_002
852  * @tc.desc: check DisconnectRemoteAbilityInner
853  * @tc.type: FUNC
854  */
855 HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_002, TestSize.Level3)
856 {
857     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_002 begin" << std::endl;
858     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
859     MessageParcel data;
860     MessageParcel reply;
861     MessageOption option;
862 
863     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
864     sptr<IRemoteObject> connect = nullptr;
865     data.WriteRemoteObject(connect);
866     int32_t callerUid = 0;
867     data.WriteInt32(callerUid);
868     uint32_t accessToken = 0;
869     data.WriteUint32(accessToken);
870     int result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
871     EXPECT_EQ(result, ERR_NONE);
872     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_002 end" << std::endl;
873 }
874 
875 /**
876  * @tc.name: DisconnectRemoteAbilityInner_003
877  * @tc.desc: check DisconnectRemoteAbilityInner
878  * @tc.type: FUNC
879  */
880 HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_003, TestSize.Level3)
881 {
882     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_003 begin" << std::endl;
883     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::DISCONNECT_REMOTE_ABILITY);
884     MessageParcel data;
885     MessageParcel reply;
886     MessageOption option;
887 
888     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
889     sptr<IRemoteObject> connect = nullptr;
890     data.WriteRemoteObject(connect);
891     int32_t callerUid = 0;
892     data.WriteInt32(callerUid);
893     uint32_t accessToken = GetSelfTokenID();
894     data.WriteUint32(accessToken);
895     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
896     EXPECT_EQ(result, ERR_NONE);
897     DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_003 end" << std::endl;
898 }
899 
900 /**
901  * @tc.name: ConnectAbilityFromRemoteInner_001
902  * @tc.desc: check ConnectAbilityFromRemoteInner
903  * @tc.type: FUNC
904  */
905 HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_001, TestSize.Level3)
906 {
907     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_001 begin" << std::endl;
908     MessageParcel data;
909     MessageParcel reply;
910 
911     int32_t result = DistributedSchedService::GetInstance().ConnectAbilityFromRemoteInner(data, reply);
912     EXPECT_EQ(result, ERR_NULL_OBJECT);
913 
914     Want want;
915     data.WriteParcelable(&want);
916     result = DistributedSchedService::GetInstance().ConnectAbilityFromRemoteInner(data, reply);
917     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
918 
919     data.WriteParcelable(&want);
920     AbilityInfo abilityInfo;
921     AppExecFwk::CompatibleAbilityInfo compatibleAbilityInfo;
922     abilityInfo.ConvertToCompatiableAbilityInfo(compatibleAbilityInfo);
923     data.WriteParcelable(&compatibleAbilityInfo);
924     sptr<IRemoteObject> connect = nullptr;
925     data.WriteRemoteObject(connect);
926     CallerInfo callerInfo;
927     callerInfo.uid = 0;
928     data.WriteInt32(callerInfo.uid);
929     callerInfo.pid = 0;
930     data.WriteInt32(callerInfo.pid);
931     callerInfo.sourceDeviceId = "";
932     data.WriteString(callerInfo.sourceDeviceId);
933     DistributedSchedService::AccountInfo accountInfo;
934     accountInfo.accountType = 0;
935     data.WriteInt32(accountInfo.accountType);
936     callerInfo.callerAppId = "";
937     data.WriteString(callerInfo.callerAppId);
938     result = DistributedSchedService::GetInstance().ConnectAbilityFromRemoteInner(data, reply);
939     EXPECT_EQ(result, ERR_NONE);
940     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_001 end" << std::endl;
941 }
942 
943 /**
944  * @tc.name: ConnectAbilityFromRemoteInner_002
945  * @tc.desc: check ConnectAbilityFromRemoteInner
946  * @tc.type: FUNC
947  */
948 HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_002, TestSize.Level3)
949 {
950     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_002 begin" << std::endl;
951     MessageParcel data;
952     MessageParcel reply;
953 
954     Want want;
955     data.WriteParcelable(&want);
956     AbilityInfo abilityInfo;
957     AppExecFwk::CompatibleAbilityInfo compatibleAbilityInfo;
958     abilityInfo.ConvertToCompatiableAbilityInfo(compatibleAbilityInfo);
959     data.WriteParcelable(&compatibleAbilityInfo);
960     sptr<IRemoteObject> connect = nullptr;
961     data.WriteRemoteObject(connect);
962     CallerInfo callerInfo;
963     callerInfo.uid = 0;
964     data.WriteInt32(callerInfo.uid);
965     callerInfo.pid = 0;
966     data.WriteInt32(callerInfo.pid);
967     callerInfo.sourceDeviceId = "";
968     data.WriteString(callerInfo.sourceDeviceId);
969     DistributedSchedService::AccountInfo accountInfo;
970     accountInfo.accountType = 0;
971     data.WriteInt32(accountInfo.accountType);
972     data.WriteStringVector(accountInfo.groupIdList);
973     callerInfo.callerAppId = "";
974     data.WriteString(callerInfo.callerAppId);
975     nlohmann::json extraInfoJson;
976     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
977     std::string extraInfo = extraInfoJson.dump();
978     data.WriteString(extraInfo);
979     int32_t result = DistributedSchedService::GetInstance().ConnectAbilityFromRemoteInner(data, reply);
980     EXPECT_EQ(result, ERR_NONE);
981     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteInner_002 end" << std::endl;
982 }
983 
984 /**
985  * @tc.name: DisconnectAbilityFromRemoteInner_001
986  * @tc.desc: check DisconnectAbilityFromRemoteInner
987  * @tc.type: FUNC
988  */
989 HWTEST_F(DistributedSchedStubTest, DisconnectAbilityFromRemoteInner_001, TestSize.Level3)
990 {
991     DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteInner_001 begin" << std::endl;
992     MessageParcel data;
993     MessageParcel reply;
994 
995     int32_t uid = 0;
996     data.WriteInt32(uid);
997     std::string sourceDeviceId = "";
998     data.WriteString(sourceDeviceId);
999     int32_t result = DistributedSchedService::GetInstance().DisconnectAbilityFromRemoteInner(data, reply);
1000     EXPECT_EQ(result, ERR_NONE);
1001     DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteInner_001 end" << std::endl;
1002 }
1003 
1004 /**
1005  * @tc.name: NotifyProcessDiedFromRemoteInner_001
1006  * @tc.desc: check NotifyProcessDiedFromRemoteInner
1007  * @tc.type: FUNC
1008  */
1009 HWTEST_F(DistributedSchedStubTest, NotifyProcessDiedFromRemoteInner_001, TestSize.Level3)
1010 {
1011     DTEST_LOG << "DistributedSchedStubTest NotifyProcessDiedFromRemoteInner_001 begin" << std::endl;
1012     MessageParcel data;
1013     MessageParcel reply;
1014 
1015     int32_t uid = 0;
1016     data.WriteInt32(uid);
1017     int32_t pid = 0;
1018     data.WriteInt32(pid);
1019     std::string sourceDeviceId = "";
1020     data.WriteString(sourceDeviceId);
1021     int32_t result = DistributedSchedService::GetInstance().NotifyProcessDiedFromRemoteInner(data, reply);
1022     EXPECT_EQ(result, ERR_NONE);
1023     DTEST_LOG << "DistributedSchedStubTest NotifyProcessDiedFromRemoteInner_001 end" << std::endl;
1024 }
1025 
1026 #ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
1027 /**
1028  * @tc.name: GetMissionInfosInner_001
1029  * @tc.desc: check GetMissionInfosInner
1030  * @tc.type: FUNC
1031  */
1032 HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_001, TestSize.Level3)
1033 {
1034     DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_001 begin" << std::endl;
1035     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_MISSION_INFOS);
1036     MessageParcel data;
1037     MessageParcel reply;
1038     MessageOption option;
1039 
1040     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1041     DistributedSchedUtil::MockPermission();
1042     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1043     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1044     DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_001 end" << std::endl;
1045 }
1046 
1047 /**
1048  * @tc.name: GetMissionInfosInner_002
1049  * @tc.desc: check GetMissionInfosInner
1050  * @tc.type: FUNC
1051  */
1052 HWTEST_F(DistributedSchedStubTest, GetMissionInfosInner_002, TestSize.Level3)
1053 {
1054     DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_002 begin" << std::endl;
1055     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_MISSION_INFOS);
1056     MessageParcel data;
1057     MessageParcel reply;
1058     MessageOption option;
1059 
1060     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1061     std::u16string deviceId = u"192.168.43.100";
1062     data.WriteString16(deviceId);
1063     int32_t numMissions = 0;
1064     data.WriteInt32(numMissions);
1065     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1066     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
1067     DTEST_LOG << "DistributedSchedStubTest GetMissionInfosInner_002 end" << std::endl;
1068 }
1069 
1070 /**
1071  * @tc.name: GetRemoteMissionSnapshotInfoInner_001
1072  * @tc.desc: check GetRemoteMissionSnapshotInfoInner
1073  * @tc.type: FUNC
1074  */
1075 HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_001, TestSize.Level3)
1076 {
1077     DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_001 begin" << std::endl;
1078     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO);
1079     MessageParcel data;
1080     MessageParcel reply;
1081     MessageOption option;
1082 
1083     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1084     DistributedSchedUtil::MockPermission();
1085     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1086     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1087     DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_001 end" << std::endl;
1088 }
1089 
1090 /**
1091  * @tc.name: GetRemoteMissionSnapshotInfoInner_002
1092  * @tc.desc: check GetRemoteMissionSnapshotInfoInner
1093  * @tc.type: FUNC
1094  */
1095 HWTEST_F(DistributedSchedStubTest, GetRemoteMissionSnapshotInfoInner_002, TestSize.Level3)
1096 {
1097     DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_002 begin" << std::endl;
1098     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::GET_REMOTE_MISSION_SNAPSHOT_INFO);
1099     MessageParcel data;
1100     MessageParcel reply;
1101     MessageOption option;
1102 
1103     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1104     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1105     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1106 
1107     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1108     std::string networkId = "255.255.255.255";
1109     data.WriteString(networkId);
1110     int32_t missionId = -1;
1111     data.WriteInt32(missionId);
1112     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1113     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
1114 
1115     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1116     data.WriteString(networkId);
1117     missionId = 0;
1118     data.WriteInt32(missionId);
1119     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1120     EXPECT_EQ(result, ERR_NULL_OBJECT);
1121     DTEST_LOG << "DistributedSchedStubTest GetRemoteMissionSnapshotInfoInner_002 end" << std::endl;
1122 }
1123 
1124 /**
1125  * @tc.name: RegisterMissionListenerInner_001
1126  * @tc.desc: check RegisterMissionListenerInner
1127  * @tc.type: FUNC
1128  */
1129 HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_001, TestSize.Level3)
1130 {
1131     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_001 begin" << std::endl;
1132     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER);
1133     MessageParcel data;
1134     MessageParcel reply;
1135     MessageOption option;
1136 
1137     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1138     DistributedSchedUtil::MockPermission();
1139     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1140     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1141     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_001 end" << std::endl;
1142 }
1143 
1144 /**
1145  * @tc.name: RegisterMissionListenerInner_002
1146  * @tc.desc: check RegisterMissionListenerInner
1147  * @tc.type: FUNC
1148  */
1149 HWTEST_F(DistributedSchedStubTest, RegisterMissionListenerInner_002, TestSize.Level3)
1150 {
1151     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_002 begin" << std::endl;
1152     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::REGISTER_MISSION_LISTENER);
1153     MessageParcel data;
1154     MessageParcel reply;
1155     MessageOption option;
1156 
1157     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1158     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1159     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
1160 
1161     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1162     std::u16string devId = u"192.168.43.100";
1163     data.WriteString16(devId);
1164     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1165     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1166 
1167     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1168     data.WriteString16(devId);
1169     sptr<IRemoteObject> missionChangedListener(new DistributedSchedService());
1170     data.WriteRemoteObject(missionChangedListener);
1171     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1172     EXPECT_EQ(result, ERR_NONE);
1173     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_002 end" << std::endl;
1174 }
1175 
1176 /**
1177  * @tc.name: RegisterMissionListenerInner_003
1178  * @tc.desc: check RegisterOnListenerInner
1179  * @tc.type: FUNC
1180  * @tc.require: I7F8KH
1181  */
1182 HWTEST_F(DistributedSchedStubTest, RegisterOnListenerInner_002, TestSize.Level3)
1183 {
1184     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_003 begin" << std::endl;
1185 
1186 
1187     MessageParcel data;
1188     MessageParcel reply;
1189 
1190     /**
1191      * @tc.steps: step1. test RegisterOnListenerInner when type is empty;
1192      */
1193     int32_t result = DistributedSchedService::GetInstance().RegisterOnListenerInner(data, reply);
1194     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1195 
1196     /**
1197      * @tc.steps: step2. test RegisterOnListenerInner when type is not empty;
1198      */
1199     data.WriteString("type");
1200     result = DistributedSchedService::GetInstance().RegisterOnListenerInner(data, reply);
1201     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1202 
1203     /**
1204      * @tc.steps: step3. test RegisterOnListenerInner when onListener is not empty;
1205      */
1206     data.WriteString("type");
1207     sptr<IRemoteObject> onListener(new DistributedSchedService());
1208     data.WriteRemoteObject(onListener);
1209     result = DistributedSchedService::GetInstance().RegisterOnListenerInner(data, reply);
1210     EXPECT_EQ(result, ERR_OK);
1211 
1212     DTEST_LOG << "DistributedSchedStubTest RegisterMissionListenerInner_003 end" << std::endl;
1213 }
1214 
1215 /**
1216  * @tc.name: UnRegisterMissionListenerInner_001
1217  * @tc.desc: check UnRegisterMissionListenerInner
1218  * @tc.type: FUNC
1219  */
1220 HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_001, TestSize.Level3)
1221 {
1222     DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_001 begin" << std::endl;
1223     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER);
1224     MessageParcel data;
1225     MessageParcel reply;
1226     MessageOption option;
1227 
1228     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1229     DistributedSchedUtil::MockPermission();
1230     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1231     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1232     DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_001 end" << std::endl;
1233 }
1234 
1235 /**
1236  * @tc.name: UnRegisterMissionListenerInner_002
1237  * @tc.desc: check UnRegisterMissionListenerInner
1238  * @tc.type: FUNC
1239  */
1240 HWTEST_F(DistributedSchedStubTest, UnRegisterMissionListenerInner_002, TestSize.Level3)
1241 {
1242     DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_002 begin" << std::endl;
1243     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::UNREGISTER_MISSION_LISTENER);
1244     MessageParcel data;
1245     MessageParcel reply;
1246     MessageOption option;
1247 
1248     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1249     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1250     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
1251 
1252     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1253     std::u16string devId = u"192.168.43.100";
1254     data.WriteString16(devId);
1255     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1256     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1257 
1258     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1259     data.WriteString16(devId);
1260     sptr<IRemoteObject> missionChangedListener(new DistributedSchedService());
1261     data.WriteRemoteObject(missionChangedListener);
1262     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1263     EXPECT_EQ(result, ERR_NONE);
1264     DTEST_LOG << "DistributedSchedStubTest UnRegisterMissionListenerInner_002 end" << std::endl;
1265 }
1266 
1267 /**
1268  * @tc.name: StartSyncMissionsFromRemoteInner_001
1269  * @tc.desc: check StartSyncMissionsFromRemoteInner
1270  * @tc.type: FUNC
1271  */
1272 HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_001, TestSize.Level3)
1273 {
1274     DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_001 begin" << std::endl;
1275     MessageParcel data;
1276     MessageParcel reply;
1277 
1278     int32_t result = DistributedSchedService::GetInstance().StartSyncMissionsFromRemoteInner(data, reply);
1279     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1280     DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_001 end" << std::endl;
1281 }
1282 
1283 /**
1284  * @tc.name: StartSyncMissionsFromRemoteInner_002
1285  * @tc.desc: check StartSyncMissionsFromRemoteInner
1286  * @tc.type: FUNC
1287  */
1288 HWTEST_F(DistributedSchedStubTest, StartSyncMissionsFromRemoteInner_002, TestSize.Level3)
1289 {
1290     DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_002 begin" << std::endl;
1291     DistributedSchedUtil::MockManageMissions();
1292     MessageParcel data;
1293     MessageParcel reply;
1294     CallerInfo callerInfo;
1295     CallerInfoMarshalling(callerInfo, data);
1296 
1297     DistributedSchedMissionManager::GetInstance().Init();
1298     int32_t result = DistributedSchedService::GetInstance().StartSyncMissionsFromRemoteInner(data, reply);
1299     EXPECT_EQ(result, ERR_NONE);
1300     WaitHandlerTaskDone(DistributedSchedMissionManager::GetInstance().missionHandler_);
1301     DTEST_LOG << "DistributedSchedStubTest StartSyncMissionsFromRemoteInner_002 end" << std::endl;
1302 }
1303 
1304 /**
1305  * @tc.name: StopSyncRemoteMissionsInner_001
1306  * @tc.desc: check StopSyncRemoteMissionsInner
1307  * @tc.type: FUNC
1308  */
1309 HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_001, TestSize.Level3)
1310 {
1311     DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_001 begin" << std::endl;
1312     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_SYNC_MISSIONS);
1313     MessageParcel data;
1314     MessageParcel reply;
1315     MessageOption option;
1316 
1317     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1318     DistributedSchedUtil::MockPermission();
1319     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1320     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1321     DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_001 end" << std::endl;
1322 }
1323 
1324 /**
1325  * @tc.name: StopSyncRemoteMissionsInner_002
1326  * @tc.desc: check StopSyncRemoteMissionsInner
1327  * @tc.type: FUNC
1328  */
1329 HWTEST_F(DistributedSchedStubTest, StopSyncRemoteMissionsInner_002, TestSize.Level3)
1330 {
1331     DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_002 begin" << std::endl;
1332     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_SYNC_MISSIONS);
1333     MessageParcel data;
1334     MessageParcel reply;
1335     MessageOption option;
1336 
1337     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1338     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1339     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
1340 
1341     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1342     std::u16string deviceId = u"192.168.43.100";
1343     data.WriteString16(deviceId);
1344     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1345     EXPECT_EQ(result, ERR_NONE);
1346     DTEST_LOG << "DistributedSchedStubTest StopSyncRemoteMissionsInner_002 end" << std::endl;
1347 }
1348 
1349 /**
1350  * @tc.name: StopSyncMissionsFromRemoteInner_001
1351  * @tc.desc: check StopSyncMissionsFromRemoteInner
1352  * @tc.type: FUNC
1353  */
1354 HWTEST_F(DistributedSchedStubTest, StopSyncMissionsFromRemoteInner_001, TestSize.Level3)
1355 {
1356     DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_001 begin" << std::endl;
1357     MessageParcel data;
1358     MessageParcel reply;
1359 
1360     int32_t result = DistributedSchedService::GetInstance().StopSyncMissionsFromRemoteInner(data, reply);
1361     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1362     DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_001 end" << std::endl;
1363 }
1364 
1365 /**
1366  * @tc.name: StopSyncMissionsFromRemoteInner_002
1367  * @tc.desc: check StopSyncMissionsFromRemoteInner
1368  * @tc.type: FUNC
1369  */
1370 HWTEST_F(DistributedSchedStubTest, StopSyncMissionsFromRemoteInner_002, TestSize.Level3)
1371 {
1372     DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_002 begin" << std::endl;
1373     MessageParcel data;
1374     MessageParcel reply;
1375     CallerInfo callerInfo;
1376     CallerInfoMarshalling(callerInfo, data);
1377 
1378     DistributedSchedMissionManager::GetInstance().Init();
1379     int32_t result = DistributedSchedService::GetInstance().StopSyncMissionsFromRemoteInner(data, reply);
1380     EXPECT_NE(result, ERR_FLATTEN_OBJECT);
1381     WaitHandlerTaskDone(DistributedSchedMissionManager::GetInstance().missionHandler_);
1382     DTEST_LOG << "DistributedSchedStubTest StopSyncMissionsFromRemoteInner_002 end" << std::endl;
1383 }
1384 
1385 /**
1386  * @tc.name: NotifyMissionsChangedFromRemoteInner_001
1387  * @tc.desc: check NotifyMissionsChangedFromRemoteInner
1388  * @tc.type: FUNC
1389  */
1390 HWTEST_F(DistributedSchedStubTest, NotifyMissionsChangedFromRemoteInner_001, TestSize.Level3)
1391 {
1392     DTEST_LOG << "DistributedSchedStubTest NotifyMissionsChangedFromRemoteInner_001 begin" << std::endl;
1393     MessageParcel data;
1394     MessageParcel reply;
1395 
1396     int32_t version = 0;
1397     data.WriteInt32(version);
1398     int32_t result = DistributedSchedService::GetInstance().NotifyMissionsChangedFromRemoteInner(data, reply);
1399     EXPECT_EQ(result, ERR_NONE);
1400     DTEST_LOG << "DistributedSchedStubTest NotifyMissionsChangedFromRemoteInner_001 end" << std::endl;
1401 }
1402 
1403 /**
1404  * @tc.name: StartSyncRemoteMissionsInner_001
1405  * @tc.desc: check StartSyncRemoteMissionsInner
1406  * @tc.type: FUNC
1407  */
1408 HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_001, TestSize.Level3)
1409 {
1410     DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_001 begin" << std::endl;
1411     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_SYNC_MISSIONS);
1412     MessageParcel data;
1413     MessageParcel reply;
1414     MessageOption option;
1415 
1416     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1417     DistributedSchedUtil::MockPermission();
1418     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1419     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1420     DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_001 end" << std::endl;
1421 }
1422 
1423 /**
1424  * @tc.name: StartSyncRemoteMissionsInner_002
1425  * @tc.desc: check StartSyncRemoteMissionsInner
1426  * @tc.type: FUNC
1427  */
1428 HWTEST_F(DistributedSchedStubTest, StartSyncRemoteMissionsInner_002, TestSize.Level3)
1429 {
1430     DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_002 begin" << std::endl;
1431     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_SYNC_MISSIONS);
1432     MessageParcel data;
1433     MessageParcel reply;
1434     MessageOption option;
1435 
1436     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1437     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1438     EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
1439 
1440     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1441     std::u16string deviceId = u"192.168.43.100";
1442     data.WriteString16(deviceId);
1443     bool fixConflict = false;
1444     data.WriteBool(fixConflict);
1445     int64_t tag = 0;
1446     data.WriteInt64(tag);
1447     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1448     EXPECT_EQ(result, ERR_NONE);
1449     DTEST_LOG << "DistributedSchedStubTest StartSyncRemoteMissionsInner_002 end" << std::endl;
1450 }
1451 
1452 /**
1453  * @tc.name: SetMissionContinueStateInner_001
1454  * @tc.desc: check SetMissionContinueStateInner
1455  * @tc.type: FUNC
1456  */
1457 HWTEST_F(DistributedSchedStubTest, SetMissionContinueStateInner_001, TestSize.Level3)
1458 {
1459     DTEST_LOG << "DistributedSchedStubTest SetMissionContinueStateInner_001 begin" << std::endl;
1460     MessageParcel data;
1461     MessageParcel reply;
1462 
1463     int32_t missionId = 0;
1464     int32_t state = 0;
1465     int32_t callingUid = 0;
1466     data.WriteInt32(missionId);
1467     data.WriteInt32(state);
1468     data.WriteInt32(callingUid);
1469     int32_t result = DistributedSchedService::GetInstance().SetMissionContinueStateInner(data, reply);
1470     EXPECT_EQ(result, ERR_NONE);
1471     DTEST_LOG << "DistributedSchedStubTest SetMissionContinueStateInner_001 end" << std::endl;
1472 }
1473 #endif
1474 
1475 /**
1476  * @tc.name: CallerInfoUnmarshalling_001
1477  * @tc.desc: check CallerInfoUnmarshalling
1478  * @tc.type: FUNC
1479  */
1480 HWTEST_F(DistributedSchedStubTest, CallerInfoUnmarshalling_001, TestSize.Level3)
1481 {
1482     DTEST_LOG << "DistributedSchedStubTest CallerInfoUnmarshalling_001 begin" << std::endl;
1483     MessageParcel data;
1484     int32_t uid = 0;
1485     data.WriteInt32(uid);
1486     int32_t pid = 0;
1487     data.WriteInt32(pid);
1488     int32_t callerType = 0;
1489     data.WriteInt32(callerType);
1490     std::string sourceDeviceId = "";
1491     data.WriteString(sourceDeviceId);
1492     int32_t duid = 0;
1493     data.WriteInt32(duid);
1494     std::string callerAppId = "test";
1495     data.WriteString(callerAppId);
1496     int32_t version = 0;
1497     data.WriteInt32(version);
1498     CallerInfo callerInfo;
1499     bool result = DistributedSchedService::GetInstance().CallerInfoUnmarshalling(callerInfo, data);
1500     EXPECT_TRUE(result);
1501     DTEST_LOG << "DistributedSchedStubTest CallerInfoUnmarshalling_001 end" << std::endl;
1502 }
1503 
1504 /**
1505  * @tc.name: StartRemoteAbilityByCallInner_001
1506  * @tc.desc: check StartRemoteAbilityByCallInner
1507  * @tc.type: FUNC
1508  */
1509 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_001, TestSize.Level3)
1510 {
1511     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_001 begin" << std::endl;
1512     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
1513     MessageParcel data;
1514     MessageParcel reply;
1515     MessageOption option;
1516 
1517     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1518     DistributedSchedUtil::MockPermission();
1519     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1520     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1521     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_001 end" << std::endl;
1522 }
1523 
1524 /**
1525  * @tc.name: StartRemoteAbilityByCallInner_002
1526  * @tc.desc: check StartRemoteAbilityByCallInner
1527  * @tc.type: FUNC
1528  */
1529 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_002, TestSize.Level3)
1530 {
1531     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_002 begin" << std::endl;
1532     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
1533     MessageParcel data;
1534     MessageParcel reply;
1535     MessageOption option;
1536 
1537     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1538     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1539     EXPECT_EQ(result, ERR_NULL_OBJECT);
1540 
1541     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1542     Want want;
1543     data.WriteParcelable(&want);
1544     sptr<IRemoteObject> connect = nullptr;
1545     data.WriteRemoteObject(connect);
1546     int32_t callerUid = 0;
1547     data.WriteInt32(callerUid);
1548     int32_t callerPid = 0;
1549     data.WriteInt32(callerPid);
1550     uint32_t accessToken = 0;
1551     data.WriteUint32(accessToken);
1552     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1553     EXPECT_EQ(result, ERR_NONE);
1554     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_002 end" << std::endl;
1555 }
1556 
1557 /**
1558  * @tc.name: StartRemoteAbilityByCallInner_003
1559  * @tc.desc: check StartRemoteAbilityByCallInner
1560  * @tc.type: FUNC
1561  */
1562 HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_003, TestSize.Level3)
1563 {
1564     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_003 begin" << std::endl;
1565     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_ABILITY_BY_CALL);
1566     MessageParcel data;
1567     MessageParcel reply;
1568     MessageOption option;
1569 
1570     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1571     Want want;
1572     data.WriteParcelable(&want);
1573     sptr<IRemoteObject> connect = nullptr;
1574     data.WriteRemoteObject(connect);
1575     int32_t callerUid = 0;
1576     data.WriteInt32(callerUid);
1577     int32_t callerPid = 0;
1578     data.WriteInt32(callerPid);
1579     uint32_t accessToken = GetSelfTokenID();
1580     data.WriteUint32(accessToken);
1581     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1582     EXPECT_EQ(result, ERR_NONE);
1583     DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_003 end" << std::endl;
1584 }
1585 
1586 /**
1587  * @tc.name: ReleaseRemoteAbilityInner_001
1588  * @tc.desc: check ReleaseRemoteAbilityInner
1589  * @tc.type: FUNC
1590  */
1591 HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_001, TestSize.Level3)
1592 {
1593     DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_001 begin" << std::endl;
1594     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY);
1595     MessageParcel data;
1596     MessageParcel reply;
1597     MessageOption option;
1598 
1599     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1600     DistributedSchedUtil::MockPermission();
1601     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1602     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1603     DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_001 end" << std::endl;
1604 }
1605 
1606 /**
1607  * @tc.name: ReleaseRemoteAbilityInner_002
1608  * @tc.desc: check ReleaseRemoteAbilityInner
1609  * @tc.type: FUNC
1610  */
1611 HWTEST_F(DistributedSchedStubTest, ReleaseRemoteAbilityInner_002, TestSize.Level3)
1612 {
1613     DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_002 begin" << std::endl;
1614     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::RELEASE_REMOTE_ABILITY);
1615     MessageParcel data;
1616     MessageParcel reply;
1617     MessageOption option;
1618 
1619     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1620     sptr<IRemoteObject> connect = nullptr;
1621     data.WriteRemoteObject(connect);
1622     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1623     EXPECT_EQ(result, ERR_INVALID_VALUE);
1624 
1625     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1626     data.WriteRemoteObject(connect);
1627     ElementName element;
1628     data.WriteParcelable(&element);
1629     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1630     EXPECT_EQ(result, ERR_NONE);
1631     DTEST_LOG << "DistributedSchedStubTest ReleaseRemoteAbilityInner_002 end" << std::endl;
1632 }
1633 
1634 /**
1635  * @tc.name: StartAbilityByCallFromRemoteInner_001
1636  * @tc.desc: check StartAbilityByCallFromRemoteInner
1637  * @tc.type: FUNC
1638  */
1639 HWTEST_F(DistributedSchedStubTest, StartAbilityByCallFromRemoteInner_001, TestSize.Level3)
1640 {
1641     DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_001 begin" << std::endl;
1642     MessageParcel data;
1643     MessageParcel reply;
1644 
1645     sptr<IRemoteObject> connect = nullptr;
1646     data.WriteRemoteObject(connect);
1647     CallerInfo callerInfo;
1648     callerInfo.uid = 0;
1649     data.WriteInt32(callerInfo.uid);
1650     callerInfo.pid = 0;
1651     data.WriteInt32(callerInfo.pid);
1652     callerInfo.sourceDeviceId = "";
1653     data.WriteString(callerInfo.sourceDeviceId);
1654     DistributedSchedService::AccountInfo accountInfo;
1655     accountInfo.accountType = 0;
1656     data.WriteInt32(accountInfo.accountType);
1657     data.WriteStringVector(accountInfo.groupIdList);
1658     callerInfo.callerAppId = "";
1659     data.WriteString(callerInfo.callerAppId);
1660     int32_t result = DistributedSchedService::GetInstance().StartAbilityByCallFromRemoteInner(data, reply);
1661     EXPECT_EQ(result, ERR_NULL_OBJECT);
1662 
1663     data.WriteRemoteObject(connect);
1664     data.WriteInt32(callerInfo.uid);
1665     data.WriteInt32(callerInfo.pid);
1666     data.WriteString(callerInfo.sourceDeviceId);
1667     data.WriteInt32(accountInfo.accountType);
1668     data.WriteStringVector(accountInfo.groupIdList);
1669     data.WriteString(callerInfo.callerAppId);
1670     nlohmann::json extraInfoJson;
1671     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
1672     std::string extraInfo = extraInfoJson.dump();
1673     data.WriteString(extraInfo);
1674     result = DistributedSchedService::GetInstance().StartAbilityByCallFromRemoteInner(data, reply);
1675     EXPECT_EQ(result, ERR_NULL_OBJECT);
1676     DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_001 end" << std::endl;
1677 }
1678 
1679 /**
1680  * @tc.name: StartAbilityByCallFromRemoteInner_002
1681  * @tc.desc: check StartAbilityByCallFromRemoteInner
1682  * @tc.type: FUNC
1683  */
1684 HWTEST_F(DistributedSchedStubTest, StartAbilityByCallFromRemoteInner_002, TestSize.Level3)
1685 {
1686     DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_002 begin" << std::endl;
1687     MessageParcel data;
1688     MessageParcel reply;
1689 
1690     sptr<IRemoteObject> connect = nullptr;
1691     data.WriteRemoteObject(connect);
1692     CallerInfo callerInfo;
1693     callerInfo.uid = 0;
1694     data.WriteInt32(callerInfo.uid);
1695     callerInfo.pid = 0;
1696     data.WriteInt32(callerInfo.pid);
1697     callerInfo.sourceDeviceId = "";
1698     data.WriteString(callerInfo.sourceDeviceId);
1699     DistributedSchedService::AccountInfo accountInfo;
1700     accountInfo.accountType = 0;
1701     data.WriteInt32(accountInfo.accountType);
1702     data.WriteStringVector(accountInfo.groupIdList);
1703     callerInfo.callerAppId = "";
1704     data.WriteString(callerInfo.callerAppId);
1705     nlohmann::json extraInfoJson;
1706     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
1707     std::string extraInfo = extraInfoJson.dump();
1708     data.WriteString(extraInfo);
1709     Want want;
1710     data.WriteParcelable(&want);
1711     int32_t result = DistributedSchedService::GetInstance().StartAbilityByCallFromRemoteInner(data, reply);
1712     EXPECT_EQ(result, ERR_NONE);
1713     DTEST_LOG << "DistributedSchedStubTest StartAbilityByCallFromRemoteInner_002 end" << std::endl;
1714 }
1715 
1716 /**
1717  * @tc.name: ReleaseAbilityFromRemoteInner_001
1718  * @tc.desc: check ReleaseAbilityFromRemoteInner
1719  * @tc.type: FUNC
1720  */
1721 HWTEST_F(DistributedSchedStubTest, ReleaseAbilityFromRemoteInner_001, TestSize.Level3)
1722 {
1723     DTEST_LOG << "DistributedSchedStubTest ReleaseAbilityFromRemoteInner_001 begin" << std::endl;
1724     MessageParcel data;
1725     MessageParcel reply;
1726 
1727     sptr<IRemoteObject> connect = nullptr;
1728     data.WriteRemoteObject(connect);
1729     int32_t result = DistributedSchedService::GetInstance().ReleaseAbilityFromRemoteInner(data, reply);
1730     EXPECT_EQ(result, ERR_INVALID_VALUE);
1731 
1732     data.WriteRemoteObject(connect);
1733     ElementName element;
1734     data.WriteParcelable(&element);
1735     CallerInfo callerInfo;
1736     callerInfo.sourceDeviceId = "";
1737     data.WriteString(callerInfo.sourceDeviceId);
1738     nlohmann::json extraInfoJson;
1739     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
1740     std::string extraInfo = extraInfoJson.dump();
1741     data.WriteString(extraInfo);
1742     result = DistributedSchedService::GetInstance().ReleaseAbilityFromRemoteInner(data, reply);
1743     EXPECT_EQ(result, ERR_NONE);
1744     DTEST_LOG << "DistributedSchedStubTest ReleaseAbilityFromRemoteInner_001 end" << std::endl;
1745 }
1746 
1747 #ifdef SUPPORT_DISTRIBUTED_FORM_SHARE
1748 /**
1749  * @tc.name: StartRemoteShareFormInner_001
1750  * @tc.desc: check StartRemoteShareFormInner
1751  * @tc.type: FUNC
1752  */
1753 HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_001, TestSize.Level3)
1754 {
1755     DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_001 begin" << std::endl;
1756     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM);
1757     MessageParcel data;
1758     MessageParcel reply;
1759     MessageOption option;
1760 
1761     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1762     DistributedSchedUtil::MockPermission();
1763     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1764     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1765     DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_001 end" << std::endl;
1766 }
1767 
1768 /**
1769  * @tc.name: StartRemoteShareFormInner_002
1770  * @tc.desc: check StartRemoteShareFormInner
1771  * @tc.type: FUNC
1772  */
1773 HWTEST_F(DistributedSchedStubTest, StartRemoteShareFormInner_002, TestSize.Level3)
1774 {
1775     DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_002 begin" << std::endl;
1776     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_SHARE_FORM);
1777     MessageParcel data;
1778     MessageParcel reply;
1779     MessageOption option;
1780 
1781     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1782     std::string deviceId = "";
1783     data.WriteString(deviceId);
1784     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1785     EXPECT_EQ(result, ERR_NONE);
1786 
1787     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1788     data.WriteString(deviceId);
1789     FormShareInfo formShareInfo;
1790     data.WriteParcelable(&formShareInfo);
1791     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1792     EXPECT_EQ(result, ERR_NONE);
1793     DTEST_LOG << "DistributedSchedStubTest StartRemoteShareFormInner_002 end" << std::endl;
1794 }
1795 
1796 /**
1797  * @tc.name: StartShareFormFromRemoteInner_001
1798  * @tc.desc: check StartShareFormFromRemoteInner
1799  * @tc.type: FUNC
1800  */
1801 HWTEST_F(DistributedSchedStubTest, StartShareFormFromRemoteInner_001, TestSize.Level3)
1802 {
1803     DTEST_LOG << "DistributedSchedStubTest StartShareFormFromRemoteInner_001 begin" << std::endl;
1804     MessageParcel data;
1805     MessageParcel reply;
1806 
1807     std::string deviceId = "";
1808     data.WriteString(deviceId);
1809     int32_t result = DistributedSchedService::GetInstance().StartShareFormFromRemoteInner(data, reply);
1810     EXPECT_EQ(result, ERR_NONE);
1811 
1812     data.WriteString(deviceId);
1813     FormShareInfo formShareInfo;
1814     data.WriteParcelable(&formShareInfo);
1815     result = DistributedSchedService::GetInstance().StartShareFormFromRemoteInner(data, reply);
1816     EXPECT_EQ(result, ERR_NONE);
1817     DTEST_LOG << "DistributedSchedStubTest StartShareFormFromRemoteInner_001 end" << std::endl;
1818 }
1819 #endif
1820 
1821 /**
1822  * @tc.name: StartRemoteFreeInstallInner_001
1823  * @tc.desc: check StartRemoteFreeInstallInner
1824  * @tc.type: FUNC
1825  */
1826 HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_001, TestSize.Level3)
1827 {
1828     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_001 begin" << std::endl;
1829     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
1830     MessageParcel data;
1831     MessageParcel reply;
1832     MessageOption option;
1833 
1834     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1835     DistributedSchedUtil::MockPermission();
1836     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1837     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
1838     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_001 end" << std::endl;
1839 }
1840 
1841 /**
1842  * @tc.name: StartRemoteFreeInstallInner_002
1843  * @tc.desc: check StartRemoteFreeInstallInner
1844  * @tc.type: FUNC
1845  */
1846 HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_002, TestSize.Level3)
1847 {
1848     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_002 begin" << std::endl;
1849     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
1850     MessageParcel data;
1851     MessageParcel reply;
1852     MessageOption option;
1853 
1854     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1855     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1856     EXPECT_EQ(result, ERR_NULL_OBJECT);
1857 
1858     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1859     Want want;
1860     data.WriteParcelable(&want);
1861     int32_t callerUid = 0;
1862     data.WriteInt32(callerUid);
1863     int32_t requestCode = 0;
1864     data.WriteInt32(requestCode);
1865     uint32_t accessToken = 0;
1866     data.WriteUint32(accessToken);
1867     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1868     EXPECT_EQ(result, ERR_NULL_OBJECT);
1869 
1870     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1871     data.WriteParcelable(&want);
1872     data.WriteInt32(callerUid);
1873     data.WriteInt32(requestCode);
1874     data.WriteUint32(accessToken);
1875     sptr<IRemoteObject> callback(new DistributedSchedService());
1876     data.WriteRemoteObject(callback);
1877     result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1878     EXPECT_EQ(result, ERR_NONE);
1879     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_002 end" << std::endl;
1880 }
1881 
1882 /**
1883  * @tc.name: StartRemoteFreeInstallInner_003
1884  * @tc.desc: check StartRemoteFreeInstallInner
1885  * @tc.type: FUNC
1886  */
1887 HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_003, TestSize.Level3)
1888 {
1889     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_003 begin" << std::endl;
1890     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::START_REMOTE_FREE_INSTALL);
1891     MessageParcel data;
1892     MessageParcel reply;
1893     MessageOption option;
1894 
1895     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
1896     Want want;
1897     data.WriteParcelable(&want);
1898     int32_t callerUid = 0;
1899     data.WriteInt32(callerUid);
1900     int32_t requestCode = 0;
1901     data.WriteInt32(requestCode);
1902     uint32_t accessToken = GetSelfTokenID();
1903     data.WriteUint32(accessToken);
1904     sptr<IRemoteObject> callback(new DistributedSchedService());
1905     data.WriteRemoteObject(callback);
1906     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
1907     EXPECT_EQ(result, ERR_NONE);
1908     DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_003 end" << std::endl;
1909 }
1910 
1911 /**
1912  * @tc.name: StartFreeInstallFromRemoteInner_001
1913  * @tc.desc: check StartFreeInstallFromRemoteInner
1914  * @tc.type: FUNC
1915  */
1916 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_001, TestSize.Level3)
1917 {
1918     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_001 begin" << std::endl;
1919     MessageParcel data;
1920     MessageParcel reply;
1921 
1922     int32_t result = DistributedSchedService::GetInstance().StartFreeInstallFromRemoteInner(data, reply);
1923     EXPECT_EQ(result, ERR_NULL_OBJECT);
1924     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_001 end" << std::endl;
1925 }
1926 
1927 /**
1928  * @tc.name: StartFreeInstallFromRemoteInner_002
1929  * @tc.desc: check StartFreeInstallFromRemoteInner
1930  * @tc.type: FUNC
1931  */
1932 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_002, TestSize.Level3)
1933 {
1934     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_002 begin" << std::endl;
1935     MessageParcel data;
1936     MessageParcel reply;
1937     Want want;
1938     data.WriteParcelable(&want);
1939 
1940     int32_t result = DistributedSchedService::GetInstance().StartFreeInstallFromRemoteInner(data, reply);
1941     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
1942     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_002 end" << std::endl;
1943 }
1944 
1945 /**
1946  * @tc.name: StartFreeInstallFromRemoteInner_003
1947  * @tc.desc: check StartFreeInstallFromRemoteInner
1948  * @tc.type: FUNC
1949  */
1950 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_003, TestSize.Level3)
1951 {
1952     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_003 begin" << std::endl;
1953     MessageParcel data;
1954     MessageParcel reply;
1955     Want want;
1956     CallerInfo callerInfo;
1957     DistributedSchedService::AccountInfo accountInfo;
1958     int64_t taskId = 0;
1959     Want cmpWant;
1960     std::string extraInfo = "extraInfo";
1961     data.WriteParcelable(&want);
1962     FreeInstallInfoMarshalling(callerInfo, accountInfo, taskId, data);
1963     data.WriteParcelable(&cmpWant);
1964     data.WriteString(extraInfo);
1965 
1966     int32_t result = DistributedSchedService::GetInstance().StartFreeInstallFromRemoteInner(data, reply);
1967     EXPECT_EQ(result, ERR_NONE);
1968     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_003 end" << std::endl;
1969 }
1970 
1971 /**
1972  * @tc.name: StartFreeInstallFromRemoteInner_004
1973  * @tc.desc: check StartFreeInstallFromRemoteInner
1974  * @tc.type: FUNC
1975  */
1976 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_004, TestSize.Level3)
1977 {
1978     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_004 begin" << std::endl;
1979     MessageParcel data;
1980     MessageParcel reply;
1981     Want want;
1982     CallerInfo callerInfo;
1983     DistributedSchedService::AccountInfo accountInfo;
1984     int64_t taskId = 0;
1985     Want cmpWant;
1986     std::string extraInfo = "{\"accessTokenID\": 0}";
1987     data.WriteParcelable(&want);
1988     FreeInstallInfoMarshalling(callerInfo, accountInfo, taskId, data);
1989     data.WriteParcelable(&cmpWant);
1990     data.WriteString(extraInfo);
1991 
1992     int32_t result = DistributedSchedService::GetInstance().StartFreeInstallFromRemoteInner(data, reply);
1993     EXPECT_EQ(result, ERR_NONE);
1994     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_004 end" << std::endl;
1995 }
1996 
1997 /**
1998  * @tc.name: StartFreeInstallFromRemoteInner_005
1999  * @tc.desc: check StartFreeInstallFromRemoteInner
2000  * @tc.type: FUNC
2001  */
2002 HWTEST_F(DistributedSchedStubTest, StartFreeInstallFromRemoteInner_005, TestSize.Level3)
2003 {
2004     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_005 begin" << std::endl;
2005     MessageParcel data;
2006     MessageParcel reply;
2007     Want want;
2008     CallerInfo callerInfo;
2009     DistributedSchedService::AccountInfo accountInfo;
2010     int64_t taskId = 0;
2011     Want cmpWant;
2012     std::string extraInfo = "{\"requestCode\": 0, \"accessTokenID\": 0}";
2013     data.WriteParcelable(&want);
2014     FreeInstallInfoMarshalling(callerInfo, accountInfo, taskId, data);
2015     data.WriteParcelable(&cmpWant);
2016     data.WriteString(extraInfo);
2017 
2018     int32_t result = DistributedSchedService::GetInstance().StartFreeInstallFromRemoteInner(data, reply);
2019     EXPECT_EQ(result, ERR_NONE);
2020     DTEST_LOG << "DistributedSchedStubTest StartFreeInstallFromRemoteInner_005 end" << std::endl;
2021 }
2022 
2023 /**
2024  * @tc.name: NotifyCompleteFreeInstallFromRemoteInner_001
2025  * @tc.desc: check NotifyCompleteFreeInstallFromRemoteInner
2026  * @tc.type: FUNC
2027  */
2028 HWTEST_F(DistributedSchedStubTest, NotifyCompleteFreeInstallFromRemoteInner_001, TestSize.Level3)
2029 {
2030     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteFreeInstallFromRemoteInner_001 begin" << std::endl;
2031     MessageParcel data;
2032     MessageParcel reply;
2033 
2034     int32_t result = DistributedSchedService::GetInstance().NotifyCompleteFreeInstallFromRemoteInner(data, reply);
2035     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
2036 
2037     int64_t taskId = 0;
2038     data.WriteInt64(taskId);
2039     int32_t resultCode = 0;
2040     data.WriteInt32(resultCode);
2041     result = DistributedSchedService::GetInstance().NotifyCompleteFreeInstallFromRemoteInner(data, reply);
2042     EXPECT_EQ(result, ERR_NONE);
2043     DTEST_LOG << "DistributedSchedStubTest NotifyCompleteFreeInstallFromRemoteInner_001 end" << std::endl;
2044 }
2045 
2046 /**
2047  * @tc.name: StopRemoteExtensionAbilityInner_001
2048  * @tc.desc: check StopRemoteExtensionAbilityInner
2049  * @tc.type: FUNC
2050  */
2051 HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_001, TestSize.Level1)
2052 {
2053     DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_001 begin" << std::endl;
2054     const char* processName = "testCase";
2055     const char* permissionState[] = {
2056         "ohos.permission.ACCESS_SERVICE_DM"
2057     };
2058     Want want;
2059     want.SetElementName("test.test.test", "Ability");
2060     int32_t callerUid = 0;
2061     uint32_t accessToken = 0;
2062     int32_t serviceType = 0;
2063     MessageParcel reply;
2064 
2065     MessageParcel dataFirst;
2066     DistributedSchedUtil::MockProcessAndPermission(processName, permissionState, 1);
2067     auto result = DistributedSchedService::GetInstance().StopRemoteExtensionAbilityInner(dataFirst, reply);
2068     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
2069 
2070     DistributedSchedUtil::MockProcessAndPermission(FOUNDATION_PROCESS_NAME, permissionState, 1);
2071     MessageParcel dataSecond;
2072     result = DistributedSchedService::GetInstance().StopRemoteExtensionAbilityInner(dataSecond, reply);
2073     EXPECT_EQ(result, ERR_NULL_OBJECT);
2074 
2075     DistributedSchedUtil::MockProcessAndPermission(FOUNDATION_PROCESS_NAME, permissionState, 1);
2076 
2077     MessageParcel dataThird;
2078     dataThird.WriteParcelable(&want);
2079     dataThird.WriteInt32(callerUid);
2080     dataThird.WriteUint32(accessToken);
2081     dataThird.WriteInt32(serviceType);
2082     result = DistributedSchedService::GetInstance().StopRemoteExtensionAbilityInner(dataThird, reply);
2083     EXPECT_EQ(result, ERR_NONE);
2084     DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_001 end" << std::endl;
2085 }
2086 
2087 /**
2088  * @tc.name: StopExtensionAbilityFromRemoteInner_001
2089  * @tc.desc: check StopExtensionAbilityFromRemoteInner
2090  * @tc.type: FUNC
2091  */
2092 HWTEST_F(DistributedSchedStubTest, StopExtensionAbilityFromRemoteInner_001, TestSize.Level1)
2093 {
2094     DTEST_LOG << "DistributedSchedStubTest StopExtensionAbilityFromRemoteInner_001 begin" << std::endl;
2095     Want want;
2096     want.SetElementName("test.test.test", "Ability");
2097     int32_t callerUid = 0;
2098     int32_t serviceType = 0;
2099     std::string deviceId = "1234567890abcdefghijklmnopqrstuvwxyz";
2100     std::vector<std::string> list = {
2101         "test1",
2102         "test2"
2103     };
2104     std::string appId = "1234567890abcdefghijklmnopqrstuvwxyz";
2105     std::string extraInfo = "{ \"accessTokenID\": 1989 }";
2106     std::string extraInfoEmptr = "";
2107     MessageParcel reply;
2108 
2109     MessageParcel dataFirst;
2110     auto result = DistributedSchedService::GetInstance().StopExtensionAbilityFromRemoteInner(dataFirst, reply);
2111     EXPECT_EQ(result, ERR_NULL_OBJECT);
2112 
2113     MessageParcel dataSecond;
2114     dataSecond.WriteParcelable(&want);
2115     dataSecond.WriteInt32(serviceType);
2116     dataSecond.WriteInt32(callerUid);
2117     dataSecond.WriteString(deviceId);
2118     dataSecond.WriteStringVector(list);
2119     dataSecond.WriteString(appId);
2120     dataSecond.WriteString(extraInfo);
2121     result = DistributedSchedService::GetInstance().StopExtensionAbilityFromRemoteInner(dataSecond, reply);
2122     EXPECT_EQ(result, ERR_NONE);
2123 
2124     MessageParcel dataThird;
2125     dataThird.WriteParcelable(&want);
2126     dataThird.WriteInt32(serviceType);
2127     dataThird.WriteInt32(callerUid);
2128     dataThird.WriteString(deviceId);
2129     dataThird.WriteStringVector(list);
2130     dataThird.WriteString(appId);
2131     dataThird.WriteString(extraInfoEmptr);
2132     result = DistributedSchedService::GetInstance().StopExtensionAbilityFromRemoteInner(dataThird, reply);
2133     EXPECT_EQ(result, ERR_NONE);
2134     DTEST_LOG << "DistributedSchedStubTest StopExtensionAbilityFromRemoteInner_001 end" << std::endl;
2135 }
2136 
2137 /**
2138  * @tc.name: NotifyStateChangedFromRemoteInner_001
2139  * @tc.desc: check NotifyStateChangedFromRemoteInner
2140  * @tc.type: FUNC
2141  * @tc.require: I6VDBO
2142  */
2143 HWTEST_F(DistributedSchedStubTest, NotifyStateChangedFromRemoteInner_001, TestSize.Level1)
2144 {
2145     DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_001 begin" << std::endl;
2146     MessageParcel data;
2147     MessageParcel reply;
2148     int32_t abilityState = 0;
2149     data.WriteInt32(abilityState);
2150     int32_t missionId = 0;
2151     data.WriteInt32(missionId);
2152     ElementName element;
2153     data.WriteParcelable(&element);
2154 
2155     int32_t result = DistributedSchedService::GetInstance().NotifyStateChangedFromRemoteInner(data, reply);
2156     EXPECT_EQ(result, ERR_NONE);
2157     DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_001 end" << std::endl;
2158 }
2159 
2160 /**
2161  * @tc.name: NotifyStateChangedFromRemoteInner_002
2162  * @tc.desc: check NotifyStateChangedFromRemoteInner
2163  * @tc.type: FUNC
2164  * @tc.require: I6VDBO
2165  */
2166 HWTEST_F(DistributedSchedStubTest, NotifyStateChangedFromRemoteInner_002, TestSize.Level1)
2167 {
2168     DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_002 begin" << std::endl;
2169 
2170     nlohmann::json extraInfoJson;
2171     CallerInfo callerInfo;
2172     IDistributedSched::AccountInfo accountInfo;
2173     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
2174 
2175     nlohmann::json extraInfoJson1;
2176     extraInfoJson[DMS_VERSION_ID] = "4";
2177     CallerInfo callerInfo1;
2178     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson1, callerInfo1, accountInfo);
2179 
2180     nlohmann::json extraInfoJson2;
2181     extraInfoJson[DMS_VERSION_ID] = 4;
2182     CallerInfo callerInfo2;
2183     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson2, callerInfo2, accountInfo);
2184 
2185     MessageParcel data;
2186     MessageParcel reply;
2187 
2188     int32_t abilityState = 0;
2189     data.WriteInt32(abilityState);
2190     int32_t missionId = 0;
2191     data.WriteInt32(missionId);
2192     int32_t result = DistributedSchedService::GetInstance().NotifyStateChangedFromRemoteInner(data, reply);
2193     EXPECT_EQ(result, ERR_INVALID_VALUE);
2194     DTEST_LOG << "DistributedSchedStubTest NotifyStateChangedFromRemoteInner_002 end" << std::endl;
2195 }
2196 
2197 /**
2198  * @tc.name: StopRemoteExtensionAbilityInner_002
2199  * @tc.desc: check StopRemoteExtensionAbilityInner
2200  * @tc.type: FUNC
2201  * @tc.require: I6YLV1
2202  */
2203 HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_002, TestSize.Level1)
2204 {
2205     DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_002 begin" << std::endl;
2206 
2207     nlohmann::json extraInfoJson;
2208     CallerInfo callerInfo;
2209     IDistributedSched::AccountInfo accountInfo;
2210     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
2211 
2212     nlohmann::json extraInfoJson1;
2213     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 0;
2214     CallerInfo callerInfo1;
2215     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson1, callerInfo1, accountInfo);
2216 
2217     nlohmann::json extraInfoJson2;
2218     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = "4";
2219     CallerInfo callerInfo2;
2220     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson2, callerInfo2, accountInfo);
2221 
2222     int32_t code = static_cast<uint32_t>(IDSchedInterfaceCode::STOP_REMOTE_EXTERNSION_ABILITY);
2223     MessageParcel data;
2224     MessageParcel reply;
2225     MessageOption option;
2226 
2227     data.WriteInterfaceToken(DMS_STUB_INTERFACE_TOKEN);
2228     Want want;
2229     data.WriteParcelable(&want);
2230     int32_t callingUid = 0;
2231     data.WriteInt32(callingUid);
2232     uint32_t accessToken = GetSelfTokenID();
2233     data.WriteUint32(accessToken);
2234     int32_t serviceType = 0;
2235     data.WriteInt32(serviceType);
2236     int32_t result = DistributedSchedService::GetInstance().OnRemoteRequest(code, data, reply, option);
2237     EXPECT_EQ(result, ERR_NONE);
2238     DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_002 end" << std::endl;
2239 }
2240 
2241 /**
2242  * @tc.name: IsRemoteInstall_001
2243  * @tc.desc: check IsRemoteInstall
2244  * @tc.type: FUNC
2245  */
2246 HWTEST_F(DistributedSchedStubTest, IsRemoteInstall_001, TestSize.Level1)
2247 {
2248     DTEST_LOG << "DistributedSchedStubTest IsRemoteInstall_001 begin" << std::endl;
2249     std::string networkId = "networkId";
2250     std::string bundleName = "bundleName";
2251     bool result = DistributedSchedService::GetInstance().IsRemoteInstall(networkId, bundleName);
2252     EXPECT_EQ(result, false);
2253     DTEST_LOG << "DistributedSchedStubTest IsRemoteInstall_001 end" << std::endl;
2254 }
2255 
2256 /**
2257  * @tc.name: RegisterOffListenerInner_001
2258  * @tc.desc: check RegisterOffListenerInner
2259  * @tc.type: FUNC
2260  */
2261 HWTEST_F(DistributedSchedStubTest, RegisterOffListenerInner_001, TestSize.Level1)
2262 {
2263     DTEST_LOG << "DistributedSchedStubTest RegisterOffListenerInner_001 begin" << std::endl;
2264     MessageParcel data;
2265     MessageParcel reply;
2266     int32_t ret = DistributedSchedService::GetInstance().RegisterOffListenerInner(data, reply);
2267     EXPECT_EQ(ret, ERR_FLATTEN_OBJECT);
2268 
2269     data.WriteString("type");
2270     ret = DistributedSchedService::GetInstance().RegisterOffListenerInner(data, reply);
2271     EXPECT_EQ(ret, ERR_FLATTEN_OBJECT);
2272 
2273     data.WriteString("type");
2274     sptr<IRemoteObject> onListener(new DistributedSchedService());
2275     data.WriteRemoteObject(onListener);
2276     ret = DistributedSchedService::GetInstance().RegisterOffListenerInner(data, reply);
2277     EXPECT_EQ(ret, ERR_OK);
2278     DTEST_LOG << "DistributedSchedStubTest RegisterOffListenerInner_001 end" << std::endl;
2279 }
2280 
2281 /**
2282  * @tc.name: IsUsingQos_001
2283  * @tc.desc: check IsUsingQos
2284  * @tc.type: FUNC
2285  */
2286 HWTEST_F(DistributedSchedStubTest, IsUsingQos_001, TestSize.Level1)
2287 {
2288     DTEST_LOG << "DistributedSchedStubTest IsUsingQos_001 begin" << std::endl;
2289     std::string remoteDeviceId = "remoteDeviceId";
2290     bool result = DistributedSchedService::GetInstance().IsUsingQos(remoteDeviceId);
2291     EXPECT_EQ(result, true);
2292 
2293     remoteDeviceId = "";
2294     result = DistributedSchedService::GetInstance().IsUsingQos(remoteDeviceId);
2295     EXPECT_EQ(result, false);
2296     DTEST_LOG << "DistributedSchedStubTest IsUsingQos_001 end" << std::endl;
2297 }
2298 
2299 /**
2300  * @tc.name: NotifyDSchedEventResultFromRemoteInner_001
2301  * @tc.desc: check NotifyDSchedEventResultFromRemoteInner
2302  * @tc.type: FUNC
2303  */
2304 HWTEST_F(DistributedSchedStubTest, NotifyDSchedEventResultFromRemoteInner_001, TestSize.Level1)
2305 {
2306     DTEST_LOG << "DistributedSchedStubTest NotifyDSchedEventResultFromRemoteInner_001 begin" << std::endl;
2307     MessageParcel data;
2308     MessageParcel reply;
2309     int32_t result = DistributedSchedService::GetInstance().NotifyDSchedEventResultFromRemoteInner(data, reply);
2310     EXPECT_NE(result, ERR_NULL_OBJECT);
2311     DTEST_LOG << "DistributedSchedStubTest NotifyDSchedEventResultFromRemoteInner_001 end" << std::endl;
2312 }
2313 
2314 /**
2315  * @tc.name: CollabMissionInner_001
2316  * @tc.desc: check CollabMissionInner
2317  * @tc.type: FUNC
2318  */
2319 HWTEST_F(DistributedSchedStubTest, CollabMissionInner_001, TestSize.Level1)
2320 {
2321     DTEST_LOG << "DistributedSchedStubTest CollabMissionInner_001 begin" << std::endl;
2322     MessageParcel data;
2323     MessageParcel reply;
2324     int32_t result = DistributedSchedService::GetInstance().CollabMissionInner(data, reply);
2325     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
2326 
2327     int32_t collabSessionId = 0;
2328     data.WriteInt32(collabSessionId);
2329     result = DistributedSchedService::GetInstance().CollabMissionInner(data, reply);
2330     EXPECT_EQ(result, ERR_FLATTEN_OBJECT);
2331 
2332     std::string srcSocketName = "socketName";
2333     data.WriteInt32(collabSessionId);
2334     data.WriteString(srcSocketName);
2335     result = DistributedSchedService::GetInstance().CollabMissionInner(data, reply);
2336     EXPECT_EQ(result, ERR_NULL_OBJECT);
2337 
2338     data.WriteInt32(collabSessionId);
2339     data.WriteString(srcSocketName);
2340     CollabMessage msg;
2341     data.WriteParcelable(&msg);
2342     result = DistributedSchedService::GetInstance().CollabMissionInner(data, reply);
2343     EXPECT_EQ(result, ERR_NULL_OBJECT);
2344 
2345     data.WriteInt32(collabSessionId);
2346     data.WriteString(srcSocketName);
2347     data.WriteParcelable(&msg);
2348     CollabMessage msg1;
2349     data.WriteParcelable(&msg1);
2350     result = DistributedSchedService::GetInstance().CollabMissionInner(data, reply);
2351     EXPECT_EQ(result, ERR_NULL_OBJECT);
2352     DTEST_LOG << "DistributedSchedStubTest CollabMissionInner_001 end" << std::endl;
2353 }
2354 
2355 /**
2356  * @tc.name: NotifyRejectReason_001
2357  * @tc.desc: check NotifyRejectReason
2358  * @tc.type: FUNC
2359  */
2360 HWTEST_F(DistributedSchedStubTest, NotifyRejectReason_001, TestSize.Level1)
2361 {
2362     DTEST_LOG << "DistributedSchedStubTest NotifyRejectReason_001 begin" << std::endl;
2363     MessageParcel data;
2364     MessageParcel reply;
2365     int32_t result = DistributedSchedService::GetInstance().NotifyRejectReason(data, reply);
2366     EXPECT_EQ(result, ERR_NONE);
2367     DTEST_LOG << "DistributedSchedStubTest CollabMissionInner_001 end" << std::endl;
2368 }
2369 
2370 /**
2371  * @tc.name: NotifyStartAbilityResultInner_001
2372  * @tc.desc: check NotifyStartAbilityResultInner
2373  * @tc.type: FUNC
2374  */
2375 HWTEST_F(DistributedSchedStubTest, NotifyStartAbilityResultInner_001, TestSize.Level1)
2376 {
2377     DTEST_LOG << "DistributedSchedStubTest NotifyStartAbilityResultInner_001 begin" << std::endl;
2378     MessageParcel data;
2379     MessageParcel reply;
2380     int32_t result = DistributedSchedService::GetInstance().NotifyStartAbilityResultInner(data, reply);
2381     EXPECT_EQ(result, ERR_NONE);
2382     DTEST_LOG << "DistributedSchedStubTest NotifyStartAbilityResultInner_001 end" << std::endl;
2383 }
2384 
2385 /**
2386  * @tc.name: NotifyCollabPrepareResultInner_001
2387  * @tc.desc: check NotifyCollabPrepareResultInner
2388  * @tc.type: FUNC
2389  */
2390 HWTEST_F(DistributedSchedStubTest, NotifyCollabPrepareResultInner_001, TestSize.Level1)
2391 {
2392     DTEST_LOG << "DistributedSchedStubTest NotifyCollabPrepareResultInner_001 begin" << std::endl;
2393     MessageParcel data;
2394     MessageParcel reply;
2395     int32_t result = DistributedSchedService::GetInstance().NotifyCollabPrepareResultInner(data, reply);
2396     EXPECT_EQ(result, ERR_NULL_OBJECT);
2397     DTEST_LOG << "DistributedSchedStubTest NotifyCollabPrepareResultInner_001 end" << std::endl;
2398 }
2399 
2400 /**
2401  * @tc.name: NotifyCloseCollabSessionInner_001
2402  * @tc.desc: check NotifyCloseCollabSessionInner
2403  * @tc.type: FUNC
2404  */
2405 HWTEST_F(DistributedSchedStubTest, NotifyCloseCollabSessionInner_001, TestSize.Level1)
2406 {
2407     DTEST_LOG << "DistributedSchedStubTest NotifyCloseCollabSessionInner_001 begin" << std::endl;
2408     MessageParcel data;
2409     MessageParcel reply;
2410     int32_t result = DistributedSchedService::GetInstance().NotifyCloseCollabSessionInner(data, reply);
2411     EXPECT_EQ(result, ERR_NONE);
2412     DTEST_LOG << "DistributedSchedStubTest NotifyCloseCollabSessionInner_001 end" << std::endl;
2413 }
2414 
2415 /**
2416  * @tc.name: IsNewCollabVersion_001
2417  * @tc.desc: check IsNewCollabVersion
2418  * @tc.type: FUNC
2419  */
2420 HWTEST_F(DistributedSchedStubTest, IsNewCollabVersion_001, TestSize.Level1)
2421 {
2422     DTEST_LOG << "DistributedSchedStubTest IsNewCollabVersion_001 begin" << std::endl;
2423     MessageParcel data;
2424     MessageParcel reply;
2425     auto rlt = DistributedSchedService::GetInstance().IsNewCollabVersion("");
2426     EXPECT_EQ(rlt, false);
2427 
2428     std::string remoteDeviceId = "remoteDeviceId";
2429     rlt = DistributedSchedService::GetInstance().IsNewCollabVersion(remoteDeviceId);
2430     EXPECT_EQ(rlt, true);
2431     DTEST_LOG << "DistributedSchedStubTest IsNewCollabVersion_001 end" << std::endl;
2432 }
2433 
2434 /**
2435  * @tc.name: SaveExtraInfo_001
2436  * @tc.desc: check SaveExtraInfo
2437  * @tc.type: FUNC
2438  */
2439 HWTEST_F(DistributedSchedStubTest, SaveExtraInfo_001, TestSize.Level1)
2440 {
2441     DTEST_LOG << "DistributedSchedStubTest SaveExtraInfo_001 begin" << std::endl;
2442     nlohmann::json extraInfoJson;
2443     CallerInfo callerInfo;
2444     AccountInfo accountInfo;
2445     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
2446     EXPECT_TRUE(accountInfo.activeAccountId.empty());
2447 
2448     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = "test";
2449     extraInfoJson[DMS_VERSION_ID] = 1;
2450     extraInfoJson[DMS_UID_SPEC_BUNDLE_NAME] = 1;
2451     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = 1;
2452     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = "test";
2453     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
2454     EXPECT_TRUE(accountInfo.activeAccountId.empty());
2455 
2456     extraInfoJson[EXTRO_INFO_JSON_KEY_ACCESS_TOKEN] = 1u;
2457     extraInfoJson[DMS_VERSION_ID] = "dmService";
2458     extraInfoJson[DMS_UID_SPEC_BUNDLE_NAME] = "bundleName";
2459     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = "test";
2460     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = 999;
2461     DistributedSchedService::GetInstance().SaveExtraInfo(extraInfoJson, callerInfo, accountInfo);
2462     EXPECT_EQ(callerInfo.accessToken, 1u);
2463     EXPECT_EQ(callerInfo.extraInfoJson[DMS_VERSION_ID], extraInfoJson[DMS_VERSION_ID]);
2464     EXPECT_EQ(callerInfo.extraInfoJson[DMS_UID_SPEC_BUNDLE_NAME],
2465         extraInfoJson[DMS_UID_SPEC_BUNDLE_NAME]);
2466     EXPECT_EQ(accountInfo.activeAccountId, extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID]);
2467     EXPECT_EQ(accountInfo.userId, extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID]);
2468     DTEST_LOG << "DistributedSchedStubTest SaveExtraInfo_001 end" << std::endl;
2469 }
2470 
2471 /**
2472  * @tc.name: SaveSendResultExtraInfo_001
2473  * @tc.desc: check SaveSendResultExtraInfo
2474  * @tc.type: FUNC
2475  */
2476 HWTEST_F(DistributedSchedStubTest, SaveSendResultExtraInfo_001, TestSize.Level1)
2477 {
2478     DTEST_LOG << "DistributedSchedStubTest SaveSendResultExtraInfo_001 begin" << std::endl;
2479     nlohmann::json extraInfoJson;
2480     CallerInfo callerInfo;
2481     AccountInfo accountInfo;
2482     DistributedSchedService::GetInstance().SaveSendResultExtraInfo(extraInfoJson, callerInfo, accountInfo);
2483     EXPECT_TRUE(accountInfo.activeAccountId.empty());
2484 
2485     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = 1;
2486     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = "test";
2487     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_CALLER_INFO_EX] = 1;
2488     DistributedSchedService::GetInstance().SaveSendResultExtraInfo(extraInfoJson, callerInfo, accountInfo);
2489     EXPECT_TRUE(accountInfo.activeAccountId.empty());
2490 
2491     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_CALLER_INFO_EX] = "";
2492     DistributedSchedService::GetInstance().SaveSendResultExtraInfo(extraInfoJson, callerInfo, accountInfo);
2493     EXPECT_TRUE(accountInfo.activeAccountId.empty());
2494 
2495     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_ACCOUNT_ID] = "test";
2496     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_USERID_ID] = 999;
2497     nlohmann::json temp;
2498     temp["name"] = "John Doe";
2499     temp["age"] = 30;
2500     extraInfoJson[Constants::EXTRO_INFO_JSON_KEY_CALLER_INFO_EX] = temp.dump();
2501     DistributedSchedService::GetInstance().SaveSendResultExtraInfo(extraInfoJson, callerInfo, accountInfo);
2502     EXPECT_EQ(accountInfo.activeAccountId, "test");
2503     EXPECT_EQ(accountInfo.userId, 999);
2504     EXPECT_EQ(callerInfo.extraInfoJson, temp);
2505     DTEST_LOG << "DistributedSchedStubTest SaveSendResultExtraInfo_001 end" << std::endl;
2506 }
2507 
2508 #ifdef DMSFWK_INTERACTIVE_ADAPTER
2509 /**
2510  * @tc.name: StartAbilityFromRemoteAdapterInner_001
2511  * @tc.desc: check StartAbilityFromRemoteAdapterInner
2512  * @tc.type: FUNC
2513  */
2514 HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteAdapterInner_001, TestSize.Level1)
2515 {
2516     DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteAdapterInner_001 begin" << std::endl;
2517     MessageParcel data;
2518     MessageParcel reply;
2519     int32_t result = DistributedSchedService::GetInstance().StartAbilityFromRemoteAdapterInner(data, reply);
2520     EXPECT_NE(result, DMS_PERMISSION_DENIED);
2521     DTEST_LOG << "DistributedSchedStubTest StartAbilityFromRemoteAdapterInner_001 end" << std::endl;
2522 }
2523 
2524 /**
2525  * @tc.name: StopAbilityFromRemoteAdapterInner_001
2526  * @tc.desc: check StopAbilityFromRemoteAdapterInner
2527  * @tc.type: FUNC
2528  */
2529 HWTEST_F(DistributedSchedStubTest, StopAbilityFromRemoteAdapterInner_001, TestSize.Level1)
2530 {
2531     DTEST_LOG << "DistributedSchedStubTest StopAbilityFromRemoteAdapterInner_001 begin" << std::endl;
2532     MessageParcel data;
2533     MessageParcel reply;
2534     int32_t result = DistributedSchedService::GetInstance().StopAbilityFromRemoteAdapterInner(data, reply);
2535     EXPECT_NE(result, DMS_PERMISSION_DENIED);
2536     DTEST_LOG << "DistributedSchedStubTest StopAbilityFromRemoteAdapterInner_001 end" << std::endl;
2537 }
2538 
2539 /**
2540  * @tc.name: ConnectAbilityFromRemoteAdapterInner_001
2541  * @tc.desc: check ConnectAbilityFromRemoteAdapterInner
2542  * @tc.type: FUNC
2543  */
2544 HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteAdapterInner_001, TestSize.Level1)
2545 {
2546     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteAdapterInner_001 begin" << std::endl;
2547     MessageParcel data;
2548     MessageParcel reply;
2549     int32_t result = DistributedSchedService::GetInstance().ConnectAbilityFromRemoteAdapterInner(data, reply);
2550     EXPECT_NE(result, DMS_PERMISSION_DENIED);
2551     DTEST_LOG << "DistributedSchedStubTest ConnectAbilityFromRemoteAdapterInner_001 end" << std::endl;
2552 }
2553 
2554 /**
2555  * @tc.name: DisconnectAbilityFromRemoteAdapterInner_001
2556  * @tc.desc: check DisconnectAbilityFromRemoteAdapterInner
2557  * @tc.type: FUNC
2558  */
2559 HWTEST_F(DistributedSchedStubTest, DisconnectAbilityFromRemoteAdapterInner_001, TestSize.Level1)
2560 {
2561     DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteAdapterInner_001 begin" << std::endl;
2562     MessageParcel data;
2563     MessageParcel reply;
2564     int32_t result = DistributedSchedService::GetInstance().DisconnectAbilityFromRemoteAdapterInner(data, reply);
2565     EXPECT_NE(result, DMS_PERMISSION_DENIED);
2566     DTEST_LOG << "DistributedSchedStubTest DisconnectAbilityFromRemoteAdapterInner_001 end" << std::endl;
2567 }
2568 
2569 /**
2570  * @tc.name: NotifyAbilityLifecycleChangedFromRemoteAdapterInner_001
2571  * @tc.desc: check NotifyAbilityLifecycleChangedFromRemoteAdapterInner
2572  * @tc.type: FUNC
2573  */
2574 HWTEST_F(DistributedSchedStubTest, NotifyAbilityLifecycleChangedFromRemoteAdapterInner_001, TestSize.Level1)
2575 {
2576     DTEST_LOG << "DistributedSchedStubTest NotifyAbilityLifecycleChangedFromRemoteAdapterInner_001 begin" << std::endl;
2577     MessageParcel data;
2578     MessageParcel reply;
2579     int32_t result = DistributedSchedService::GetInstance().NotifyAbilityLifecycleChangedFromRemoteAdapterInner(
2580         data, reply);
2581     EXPECT_NE(result, DMS_PERMISSION_DENIED);
2582     DTEST_LOG << "DistributedSchedStubTest NotifyAbilityLifecycleChangedFromRemoteAdapterInner_001 end" << std::endl;
2583 }
2584 
2585 /**
2586  * @tc.name: ConnectDExtensionFromRemoteInner_001
2587  * @tc.desc: check ConnectDExtensionFromRemoteInner
2588  * @tc.type: FUNC
2589  */
2590 HWTEST_F(DistributedSchedStubTest, ConnectDExtensionFromRemoteInner_001, TestSize.Level1)
2591 {
2592     DTEST_LOG << "DistributedSchedStubTest ConnectDExtensionFromRemoteInner_001 begin" << std::endl;
2593     MessageParcel data;
2594     MessageParcel reply;
2595     int32_t result = DistributedSchedService::GetInstance().ConnectDExtensionFromRemoteInner(data, reply);
2596     EXPECT_EQ(result, ERR_INVALID_DATA);
2597     DTEST_LOG << "DistributedSchedStubTest ConnectDExtensionFromRemoteInner_001 begin" << std::endl;
2598 }
2599 
2600 /**
2601  * @tc.name: ConnectDExtensionFromRemoteInner_002
2602  * @tc.desc: check ConnectDExtensionFromRemoteInner
2603  * @tc.type: FUNC
2604  */
2605 HWTEST_F(DistributedSchedStubTest, ConnectDExtensionFromRemoteInner_002, TestSize.Level1)
2606 {
2607     DTEST_LOG << "DistributedSchedStubTest ConnectDExtensionFromRemoteInner_002 begin" << std::endl;
2608     MessageParcel data;
2609     MessageParcel reply;
2610     DExtSourceInfo sourceInfo("device123", "network123", "bundleName", "moduleName", "abilityName");
2611     DExtSinkInfo sinkInfo(-1, 1234, "bundleName", "moduleName", "abilityName", "serviceName"); // Invalid userId
2612     DExtConnectInfo connectInfo(sourceInfo, sinkInfo, "validToken", "delegatee");
2613 
2614     data.WriteParcelable(&connectInfo);
2615     int32_t result = DistributedSchedService::GetInstance().ConnectDExtensionFromRemoteInner(data, reply);
2616     EXPECT_EQ(result, DMS_PERMISSION_DENIED);
2617 
2618     DTEST_LOG << " DistributedSchedStubTest ConnectDExtensionFromRemoteInner_002 end" << std::endl;
2619 }
2620 #endif
2621 }
2622 }