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