• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "dsched_continue_manager_test.h"
17 
18 #include "datetime_ex.h"
19 
20 #include "dtbschedmgr_device_info_storage.h"
21 #include "distributed_sched_test_util.h"
22 #include "mission/dsched_sync_e2e.h"
23 #include "test_log.h"
24 #include "mock_distributed_sched.h"
25 
26 using namespace testing;
27 using namespace testing::ext;
28 using namespace OHOS::DistributedHardware;
29 
30 namespace OHOS {
31 namespace DistributedSchedule {
32 
33 static bool g_mockDbs = false;
34 
35 namespace {
36     const std::string LOCAL_DEVICEID = "localdeviceid";
37     const std::string REMOTE_DEVICEID = "remotedeviceid";
38     const std::string CONTINUETYPE = "continueType";
39     const std::string BASEDIR = "/data/service/el1/public/database/DistributedSchedule";
40     constexpr int32_t MISSION_ID = 1;
41     constexpr size_t SIZE = 10;
42     const int32_t WAITTIME = 2000;
43     const std::string BUNDLE_NAME = "com.ohos.permissionmanager";
44 }
45 
GetDistributedBundleInfo(const std::string & networkId,const uint16_t & bundleNameId,DmsBundleInfo & distributeBundleInfo)46 bool DmsBmStorage::GetDistributedBundleInfo(const std::string &networkId,
47     const uint16_t &bundleNameId, DmsBundleInfo &distributeBundleInfo)
48 {
49     return g_mockDbs;
50 }
51 
SetUpTestCase()52 void DSchedContinueManagerTest::SetUpTestCase()
53 {
54     mkdir(BASEDIR.c_str(), (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH));
55     const std::string pkgName = "DBinderBus_PermissionTest" + std::to_string(getprocpid());
56     std::shared_ptr<DmInitCallback> initCallback_ = std::make_shared<DeviceInitCallBack>();
57     DeviceManager::GetInstance().InitDeviceManager(pkgName, initCallback_);
58     dmsStoreMock = std::make_shared<MockDmsMgrDeviceInfoStore>();
59     DmsMgrDeviceInfoStore::dmsStore = dmsStoreMock;
60     DTEST_LOG << "DSchedContinueManagerTest::SetUpTestCase" << std::endl;
61 }
62 
TearDownTestCase()63 void DSchedContinueManagerTest::TearDownTestCase()
64 {
65     (void)remove(BASEDIR.c_str());
66     DmsMgrDeviceInfoStore::dmsStore = nullptr;
67     dmsStoreMock = nullptr;
68     DTEST_LOG << "DSchedContinueManagerTest::TearDownTestCase" << std::endl;
69 }
70 
TearDown()71 void DSchedContinueManagerTest::TearDown()
72 {
73     usleep(WAITTIME);
74     DTEST_LOG << "DSchedContinueManagerTest::TearDown" << std::endl;
75 }
76 
SetUp()77 void DSchedContinueManagerTest::SetUp()
78 {
79     usleep(WAITTIME);
80     g_mockDbs = false;
81     DTEST_LOG << "DSchedContinueManagerTest::SetUp" << std::endl;
82 }
83 
OnRemoteDied()84 void DSchedContinueManagerTest::DeviceInitCallBack::OnRemoteDied()
85 {
86 }
87 
GetDSchedService() const88 sptr<IRemoteObject> DSchedContinueManagerTest::GetDSchedService() const
89 {
90     sptr<IRemoteObject> dsched(new MockDistributedSched());
91     return dsched;
92 }
93 
CreateObject()94 std::shared_ptr<DSchedContinue> DSchedContinueManagerTest::CreateObject()
95 {
96     int32_t subServiceType = 0;
97     int32_t direction = 0;
98     sptr<IRemoteObject> callback = nullptr;
99     DSchedContinueInfo continueInfo;
100     std::shared_ptr<DSchedContinue> dContinue = std::make_shared<DSchedContinue>(subServiceType, direction,
101         callback, continueInfo);
102     dContinue->Init();
103     return dContinue;
104 }
105 
106 /**
107  * @tc.name: Init_001
108  * @tc.desc: test Init func
109  * @tc.type: FUNC
110  */
111 HWTEST_F(DSchedContinueManagerTest, Init_001, TestSize.Level3)
112 {
113     DTEST_LOG << "DSchedContinueManagerTest Init_001 begin" << std::endl;
114     DSchedContinueManager::GetInstance().Init();
115     std::shared_ptr<OHOS::AppExecFwk::EventHandler> eventHandler =
116         DSchedContinueManager::GetInstance().eventHandler_;
117     EXPECT_NE(eventHandler, nullptr);
118     DTEST_LOG << "DSchedContinueManagerTest Init_001 end" << std::endl;
119 }
120 
121 /**
122  * @tc.name: Init_002
123  * @tc.desc: test Init func
124  * @tc.type: FUNC
125  */
126     HWTEST_F(DSchedContinueManagerTest, Init_002, TestSize.Level3)
127 {
128     DTEST_LOG << "DSchedContinueManagerTest Init_002 begin" << std::endl;
129     std::vector<std::thread> threads;
130     for (int i = 0; i < 10; ++i) {
__anon38a417fd0202() 131         threads.emplace_back(std::thread([]() {
132             DSchedContinueManager::GetInstance().Init();
133         }));
134     }
135     for (auto &item: threads) {
136         if (item.joinable()) {
137             item.join();
138         }
139     }
140     std::shared_ptr<OHOS::AppExecFwk::EventHandler> eventHandler =
141             DSchedContinueManager::GetInstance().eventHandler_;
142     EXPECT_NE(eventHandler, nullptr);
143     DTEST_LOG << "DSchedContinueManagerTest Init_002 end" << std::endl;
144 }
145 
146 /**
147  * @tc.name: ContinueMission_001
148  * @tc.desc: test ContinueMission func
149  * @tc.type: FUNC
150  */
151 HWTEST_F(DSchedContinueManagerTest, ContinueMission_001, TestSize.Level3)
152 {
153     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_001 begin" << std::endl;
154     auto callback = GetDSchedService();
155     OHOS::AAFwk::WantParams wantParams;
156     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
157     int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
158         callback, wantParams);
159     EXPECT_EQ(ret, OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET);
160     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_001 end" << std::endl;
161 }
162 
163 /**
164  * @tc.name: ContinueMission_002
165  * @tc.desc: test ContinueMission func
166  * @tc.type: FUNC
167  */
168 HWTEST_F(DSchedContinueManagerTest, ContinueMission_002, TestSize.Level3)
169 {
170     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_002 begin" << std::endl;
171     OHOS::AAFwk::WantParams wantParams;
172     auto callback = GetDSchedService();
173     DSchedContinueManager::GetInstance().HandleContinueMission("", REMOTE_DEVICEID, MISSION_ID, callback, wantParams);
174     DSchedContinueManager::GetInstance().HandleContinueMission(LOCAL_DEVICEID, "", MISSION_ID, callback, wantParams);
175     DSchedContinueManager::GetInstance().HandleContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
176         nullptr, wantParams);
177 
178     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true)).WillOnce(Return(true));
179     DSchedContinueManager::GetInstance().HandleContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
180         callback, wantParams);
181 
182     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(false));
183     DSchedContinueManager::GetInstance().HandleContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
184         callback, wantParams);
185 
186     int32_t ret = DSchedContinueManager::GetInstance().ContinueMission("", REMOTE_DEVICEID, MISSION_ID,
187         callback, wantParams);
188     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
189 
190     ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, "", MISSION_ID,
191         nullptr, wantParams);
192     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
193 
194     ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
195         nullptr, wantParams);
196     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
197     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_002 end" << std::endl;
198 }
199 
200 /**
201  * @tc.name: ContinueMission_003
202  * @tc.desc: test ContinueMission func
203  * @tc.type: FUNC
204  */
205 HWTEST_F(DSchedContinueManagerTest, ContinueMission_003, TestSize.Level3)
206 {
207     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_003 begin" << std::endl;
208     DistributedSchedUtil::MockPermission();
209     OHOS::AAFwk::WantParams wantParams;
210     int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(
211         DSchedContinueInfo("", BUNDLE_NAME, "", BUNDLE_NAME, CONTINUETYPE),
212         nullptr, wantParams);
213     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
214 
215     ret = DSchedContinueManager::GetInstance().ContinueMission(
216         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, "", BUNDLE_NAME, CONTINUETYPE),
217         nullptr, wantParams);
218     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
219 
220     ret = DSchedContinueManager::GetInstance().ContinueMission(
221         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
222         nullptr, wantParams);
223     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
224 
225     auto callback = GetDSchedService();
226     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
227     ret = DSchedContinueManager::GetInstance().ContinueMission(
228         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
229         callback, wantParams);
230     EXPECT_EQ(ret, OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET);
231 
232     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(LOCAL_DEVICEID), Return(true)));
233     ret = DSchedContinueManager::GetInstance().ContinueMission(
234         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
235         callback, wantParams);
236     EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
237 
238     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(REMOTE_DEVICEID), Return(true)));
239     ret = DSchedContinueManager::GetInstance().ContinueMission(
240         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
241         callback, wantParams);
242     EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
243     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_003 end" << std::endl;
244 }
245 
246 /**
247  * @tc.name: HandleContinueMission_001
248  * @tc.desc: test HandleContinueMission func
249  * @tc.type: FUNC
250  */
251 HWTEST_F(DSchedContinueManagerTest, HandleContinueMission_001, TestSize.Level3)
252 {
253     DTEST_LOG << "DSchedContinueManagerTest HandleContinueMission_001 begin" << std::endl;
254     OHOS::AAFwk::WantParams wantParams;
255     auto callback = GetDSchedService();
256     DSchedContinueManager::GetInstance().HandleContinueMission(
257         DSchedContinueInfo("", BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
258         callback, wantParams);
259     DSchedContinueManager::GetInstance().HandleContinueMission(
260         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, "", BUNDLE_NAME, CONTINUETYPE),
261         callback, wantParams);
262     DSchedContinueManager::GetInstance().HandleContinueMission(
263         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
264         nullptr, wantParams);
265 
266     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
267     DSchedContinueManager::GetInstance().HandleContinueMission(
268         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
269         callback, wantParams);
270     DTEST_LOG << "DSchedContinueManagerTest HandleContinueMission_001 end" << std::endl;
271 }
272 
273 /**
274  * @tc.name: SetTimeOut_001
275  * @tc.desc: test SetTimeOut func
276  * @tc.type: FUNC
277  */
278 HWTEST_F(DSchedContinueManagerTest, SetTimeOut_001, TestSize.Level3)
279 {
280     DTEST_LOG << "DSchedContinueManagerTest SetTimeOut_001 begin" << std::endl;
281     DSchedContinueInfo info;
282     int32_t timeout = 0;
283     DSchedContinueManager::GetInstance().continues_.clear();
284     DSchedContinueManager::GetInstance().SetTimeOut(info, timeout);
285     EXPECT_EQ(DSchedContinueManager::GetInstance().continues_.empty(), true);
286     DTEST_LOG << "DSchedContinueManagerTest SetTimeOut_001 end" << std::endl;
287 }
288 
289 /**
290  * @tc.name: StartContinuation_001
291  * @tc.desc: test StartContinuation func
292  * @tc.type: FUNC
293  */
294 HWTEST_F(DSchedContinueManagerTest, StartContinuation_001, TestSize.Level3)
295 {
296     DTEST_LOG << "DSchedContinueManagerTest StartContinuation_001 begin" << std::endl;
297     OHOS::AAFwk::Want want;
298     int32_t missionId = 0;
299     int32_t callerUid = 0;
300     int32_t status = 0;
301     uint32_t accessToken = 0;
302     int32_t ret1 = DSchedContinueManager::GetInstance().StartContinuation(want, missionId,
303         callerUid, status, accessToken);
304     EXPECT_EQ(ret1, INVALID_REMOTE_PARAMETERS_ERR);
305     DTEST_LOG << "DSchedContinueManagerTest StartContinuation_001 end" << std::endl;
306 }
307 
308 /**
309  * @tc.name: CheckContinuationLimit_001
310  * @tc.desc: test CheckContinuationLimit func
311  * @tc.type: FUNC
312  */
313 HWTEST_F(DSchedContinueManagerTest, CheckContinuationLimit_001, TestSize.Level3)
314 {
315     DTEST_LOG << "DSchedContinueManagerTest CheckContinuationLimit_001 begin" << std::endl;
316     int32_t direction = 0;
317     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
318     int32_t ret = DSchedContinueManager::GetInstance().CheckContinuationLimit(LOCAL_DEVICEID, REMOTE_DEVICEID,
319         direction);
320     EXPECT_EQ(ret, OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET);
321     DTEST_LOG << "DSchedContinueManagerTest CheckContinuationLimit_001 end" << std::endl;
322 }
323 
324 /**
325  * @tc.name: GetContinueInfo_001
326  * @tc.desc: test GetContinueInfo func
327  * @tc.type: FUNC
328  */
329 HWTEST_F(DSchedContinueManagerTest, GetContinueInfo_001, TestSize.Level3)
330 {
331     DTEST_LOG << "DSchedContinueManagerTest GetContinueInfo_001 begin" << std::endl;
332     std::string localDeviceId = "localdeviceid";
333     std::string remoteDeviceId = "remotedeviceid";
334     int32_t ret = DSchedContinueManager::GetInstance().GetContinueInfo(localDeviceId, remoteDeviceId);
335     EXPECT_EQ(ret, ERR_OK);
336     DTEST_LOG << "DSchedContinueManagerTest GetContinueInfo_001 end" << std::endl;
337 }
338 
339 /**
340  * @tc.name: GetContinueInfo_002
341  * @tc.desc: test GetContinueInfo func
342  * @tc.type: FUNC
343  */
344 HWTEST_F(DSchedContinueManagerTest, GetContinueInfo_002, TestSize.Level3)
345 {
346     DTEST_LOG << "DSchedContinueManagerTest GetContinueInfo_002 begin" << std::endl;
347     DSchedContinueManager::GetInstance().OnShutdown(1, true);
348 
349     DSchedContinueManager::GetInstance().OnShutdown(1, false);
350 
351     DSchedContinueManager::GetInstance().OnShutdown(1, false);
352 
353     DSchedContinueInfo info;
354     std::shared_ptr<DSchedContinue> dContinue = CreateObject();
355     usleep(WAITTIME);
356     std::string localDeviceId = "localdeviceid";
357     std::string remoteDeviceId = "remotedeviceid";
358     DSchedContinueManager::GetInstance().continues_[info] = dContinue;
359     int32_t ret = DSchedContinueManager::GetInstance().GetContinueInfo(localDeviceId, remoteDeviceId);
360     EXPECT_EQ(ret, ERR_OK);
361 
362     DSchedContinueManager::GetInstance().continues_.clear();
363     DSchedContinueManager::GetInstance().continues_[info] = nullptr;
364     ret = DSchedContinueManager::GetInstance().GetContinueInfo(localDeviceId, remoteDeviceId);
365     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
366     DTEST_LOG << "DSchedContinueManagerTest GetContinueInfo_002 end" << std::endl;
367 }
368 
369 /**
370  * @tc.name: HandleNotifyCompleteContinuation_001
371  * @tc.desc: test HandleNotifyCompleteContinuation func
372  * @tc.type: FUNC
373  */
374 HWTEST_F(DSchedContinueManagerTest, HandleNotifyCompleteContinuation_001, TestSize.Level3)
375 {
376     DTEST_LOG << "DSchedContinueManagerTest HandleNotifyCompleteContinuation_001 begin" << std::endl;
377     std::u16string devId;
378     int32_t missionId = 0;
379     std::string callerBundleName;
380     DSchedContinueManager::GetInstance().continues_.clear();
381     DSchedContinueManager::GetInstance().HandleNotifyCompleteContinuation(devId, missionId, false, callerBundleName);
382 
383     DSchedContinueInfo info;
384     DSchedContinueManager::GetInstance().continues_[info] = nullptr;
385     DSchedContinueManager::GetInstance().HandleNotifyCompleteContinuation(devId, missionId, false, callerBundleName);
386     bool ret = DSchedContinueManager::GetInstance().continues_.empty();
387     EXPECT_EQ(ret, false);
388     DTEST_LOG << "DSchedContinueManagerTest HandleNotifyCompleteContinuation_001 end" << std::endl;
389 }
390 
391 /**
392  * @tc.name: NotifyCompleteContinuation_001
393  * @tc.desc: test NotifyCompleteContinuation func
394  * @tc.type: FUNC
395  */
396 HWTEST_F(DSchedContinueManagerTest, NotifyCompleteContinuation_001, TestSize.Level3)
397 {
398     DTEST_LOG << "DSchedContinueManagerTest NotifyCompleteContinuation_001 begin" << std::endl;
399     std::u16string devId;
400     int32_t sessionId = 0;
401     bool isSuccess = false;
402     std::string callerBundleName;
403     DSchedContinueManager::GetInstance().Init();
404     int32_t ret = DSchedContinueManager::GetInstance().NotifyCompleteContinuation(devId,
405         sessionId, isSuccess, callerBundleName);
406     EXPECT_EQ(ret, ERR_OK);
407     DTEST_LOG << "DSchedContinueManagerTest NotifyCompleteContinuation_001 end" << std::endl;
408 }
409 
410 /**
411  * @tc.name: OnContinueEnd_001
412  * @tc.desc: test OnContinueEnd func
413  * @tc.type: FUNC
414  */
415 HWTEST_F(DSchedContinueManagerTest, OnContinueEnd_001, TestSize.Level3)
416 {
417     DTEST_LOG << "DSchedContinueManagerTest OnContinueEnd_001 begin" << std::endl;
418     DSchedContinueInfo info(LOCAL_DEVICEID, "sourceBundleName", REMOTE_DEVICEID, "sinkBundleName",
419         "continueType");
420     DSchedContinueManager::GetInstance().UnInit();
421     int32_t ret = DSchedContinueManager::GetInstance().OnContinueEnd(info);
422     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
423 
424     DSchedContinueManager::GetInstance().Init();
425 
426     ret = DSchedContinueManager::GetInstance().OnContinueEnd(info);
427     EXPECT_EQ(ret, ERR_OK);
428     DTEST_LOG << "DSchedContinueManagerTest OnContinueEnd_001 end" << std::endl;
429 }
430 
431 /**
432  * @tc.name: HandleContinueEnd_001
433  * @tc.desc: test HandleContinueEnd func
434  * @tc.type: FUNC
435  */
436 HWTEST_F(DSchedContinueManagerTest, HandleContinueEnd_001, TestSize.Level3)
437 {
438     DTEST_LOG << "DSchedContinueManagerTest HandleContinueEnd_001 begin" << std::endl;
439     DSchedContinueInfo info(LOCAL_DEVICEID, "sourceBundleName", REMOTE_DEVICEID, "sinkBundleName",
440         "continueType");
441     DSchedContinueManager::GetInstance().RemoveTimeout(info);
442 
443     DSchedContinueManager::GetInstance().Init();
444     DSchedContinueManager::GetInstance().RemoveTimeout(info);
445 
446     DSchedContinueManager::GetInstance().continues_.clear();
447     DSchedContinueManager::GetInstance().HandleContinueEnd(info);
448     int32_t ret = DSchedContinueManager::GetInstance().continues_.empty();
449     EXPECT_EQ(ret, true);
450 
451     std::shared_ptr<DSchedContinue> ptr = nullptr;
452     DSchedContinueManager::GetInstance().continues_[info] = ptr;
453     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(false));
454     DSchedContinueManager::GetInstance().HandleContinueEnd(info);
455 
456     DSchedContinueManager::GetInstance().continues_[info] = ptr;
457     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
458     DSchedContinueManager::GetInstance().HandleContinueEnd(info);
459     EXPECT_EQ(DSchedContinueManager::GetInstance().cntSource_, 0);
460     DTEST_LOG << "DSchedContinueManagerTest HandleContinueEnd_001 end" << std::endl;
461 }
462 
463 /**
464  * @tc.name: GetDSchedContinueByWant_001
465  * @tc.desc: test GetDSchedContinueByWant func
466  * @tc.type: FUNC
467  */
468 HWTEST_F(DSchedContinueManagerTest, GetDSchedContinueByWant_001, TestSize.Level3)
469 {
470     DTEST_LOG << "DSchedContinueManagerTest GetDSchedContinueByWant_001 begin" << std::endl;
471     OHOS::AAFwk::Want want;
472     int32_t missionId = 0;
473     DSchedContinueManager::GetInstance().continues_.clear();
474     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
475     auto ret = DSchedContinueManager::GetInstance().GetDSchedContinueByWant(want, missionId);
476     EXPECT_EQ(ret, nullptr);
477     DTEST_LOG << "DSchedContinueManagerTest GetDSchedContinueByWant_001 end" << std::endl;
478 }
479 
480 /**
481  * @tc.name: NotifyTerminateContinuation_001
482  * @tc.desc: test NotifyTerminateContinuation func
483  * @tc.type: FUNC
484  */
485 HWTEST_F(DSchedContinueManagerTest, NotifyTerminateContinuation_001, TestSize.Level3)
486 {
487     DTEST_LOG << "DSchedContinueManagerTest NotifyTerminateContinuation_001 begin" << std::endl;
488     int32_t missionId = 0;
489     int32_t sessionId = 0;
490     DSchedContinueManager::GetInstance().continues_.clear();
491     DSchedContinueManager::GetInstance().HandleDataRecv(sessionId, nullptr);
492     DSchedContinueManager::GetInstance().NotifyTerminateContinuation(missionId);
493     EXPECT_EQ(DSchedContinueManager::GetInstance().continues_.empty(), true);
494     DTEST_LOG << "DSchedContinueManagerTest NotifyTerminateContinuation_001 end" << std::endl;
495 }
496 
497 /**
498  * @tc.name: GetFirstBundleName_001
499  * @tc.desc: test GetFirstBundleName func
500  * @tc.type: FUNC
501  */
502 HWTEST_F(DSchedContinueManagerTest, GetFirstBundleName_001, TestSize.Level3)
503 {
504     DTEST_LOG << "DSchedContinueManagerTest GetFirstBundleName_001 begin" << std::endl;
505     DSchedContinueInfo info;
506     std::string firstBundleName;
507     std::string bundleName;
508     std::string deviceId;
509     bool ret = DSchedContinueManager::GetInstance().GetFirstBundleName(info, firstBundleName, bundleName, deviceId);
510     EXPECT_EQ(ret, false);
511     DTEST_LOG << "DSchedContinueManagerTest GetFirstBundleName_001 end" << std::endl;
512 }
513 
514 /**
515  * @tc.name: ContinueMission_004
516  * @tc.desc: test ContinueMission func
517  * @tc.type: FUNC
518  */
519 HWTEST_F(DSchedContinueManagerTest, ContinueMission_004, TestSize.Level3)
520 {
521     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_004 begin" << std::endl;
522     auto callback = GetDSchedService();
523     OHOS::AAFwk::WantParams wantParams;
524     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(false));
525     int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
526         callback, wantParams);
527     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
528 
529     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(LOCAL_DEVICEID), Return(true)));
530     ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
531         callback, wantParams);
532     EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
533 
534     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(REMOTE_DEVICEID), Return(true)));
535     ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
536         callback, wantParams);
537     EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
538     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_004 end" << std::endl;
539 }
540 
541 /**
542  * @tc.name: ContinueMission_005
543  * @tc.desc: test ContinueMission func
544  * @tc.type: FUNC
545  */
546 HWTEST_F(DSchedContinueManagerTest, ContinueMission_005, TestSize.Level3)
547 {
548     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_005 begin" << std::endl;
549     auto callback = GetDSchedService();
550     OHOS::AAFwk::WantParams wantParams;
551     int32_t timeout = 0;
552     DSchedContinueManager::GetInstance().WaitAllConnectDecision(CONTINUE_SOURCE,
553         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE), timeout);
554 
555     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(false));
556     int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(
557         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
558         callback, wantParams);
559     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
560     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_005 end" << std::endl;
561 }
562 
563 /**
564  * @tc.name: GetDSchedContinueByWant_002
565  * @tc.desc: test GetDSchedContinueByWant func
566  * @tc.type: FUNC
567  */
568 HWTEST_F(DSchedContinueManagerTest, GetDSchedContinueByWant_002, TestSize.Level3)
569 {
570     DTEST_LOG << "DSchedContinueManagerTest GetDSchedContinueByWant_002 begin" << std::endl;
571     OHOS::AAFwk::Want want;
572     int32_t missionId = 0;
573     int32_t callerUid = 0;
574     int32_t status = 0;
575     uint32_t accessToken = 0;
576     DSchedContinueInfo info(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE);
577     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
578     DSchedContinueManager::GetInstance().HandleStartContinuation(want, missionId, callerUid, status, accessToken);
579 
580     DSchedContinueManager::GetInstance().continues_.clear();
581     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(false));
582     auto ret = DSchedContinueManager::GetInstance().GetDSchedContinueByWant(want, missionId);
583     EXPECT_EQ(ret, nullptr);
584 
585     std::shared_ptr<DSchedContinue> dContinue = CreateObject();
586     usleep(WAITTIME);
587     DSchedContinueManager::GetInstance().continues_[info] = nullptr;
588     DSchedContinueManager::GetInstance().continues_[info] = dContinue;
589 
590     DSchedContinueManager::GetInstance().NotifyTerminateContinuation(missionId);
591     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(true));
592     ret = DSchedContinueManager::GetInstance().GetDSchedContinueByWant(want, missionId);
593     EXPECT_NE(ret, nullptr);
594     DTEST_LOG << "DSchedContinueManagerTest GetDSchedContinueByWant_002 end" << std::endl;
595 }
596 
597 /**
598  * @tc.name: CheckContinuationLimit_002
599  * @tc.desc: test CheckContinuationLimit func
600  * @tc.type: FUNC
601  */
602 HWTEST_F(DSchedContinueManagerTest, CheckContinuationLimit_002, TestSize.Level3)
603 {
604     DTEST_LOG << "DSchedContinueManagerTest CheckContinuationLimit_002 begin" << std::endl;
605     int32_t direction = 0;
606     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(false));
607     int32_t ret = DSchedContinueManager::GetInstance().CheckContinuationLimit(LOCAL_DEVICEID, REMOTE_DEVICEID,
608         direction);
609     EXPECT_EQ(ret, GET_LOCAL_DEVICE_ERR);
610 
611     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(LOCAL_DEVICEID), Return(true)));
612     DSchedContinueManager::GetInstance().cntSink_.store(MAX_CONCURRENT_SINK);
613     ret = DSchedContinueManager::GetInstance().CheckContinuationLimit(LOCAL_DEVICEID, REMOTE_DEVICEID,
614         direction);
615     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
616 
617     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(REMOTE_DEVICEID), Return(true)));
618     DSchedContinueManager::GetInstance().cntSink_.store(0);
619     ret = DSchedContinueManager::GetInstance().CheckContinuationLimit(LOCAL_DEVICEID, REMOTE_DEVICEID,
620         direction);
621     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
622     DTEST_LOG << "DSchedContinueManagerTest CheckContinuationLimit_002 end" << std::endl;
623 }
624 
625 /**
626  * @tc.name: NotifyContinueDataRecv_001
627  * @tc.desc: test NotifyContinueDataRecv func
628  * @tc.type: FUNC
629  */
630 HWTEST_F(DSchedContinueManagerTest, NotifyContinueDataRecv_001, TestSize.Level3)
631 {
632     DTEST_LOG << "DSchedContinueManagerTest NotifyContinueDataRecv_001 begin" << std::endl;
633     int32_t sessionId = 0;
634     int32_t command = 0;
635     std::string jsonStr = "jsonStr";
636     std::shared_ptr<DSchedDataBuffer> dataBuffer = nullptr;
637     DSchedContinueManager::GetInstance().continues_.clear();
638     DSchedContinueManager::GetInstance().NotifyContinueDataRecv(sessionId, command, jsonStr, dataBuffer);
639     EXPECT_EQ(DSchedContinueManager::GetInstance().continues_.empty(), true);
640     DTEST_LOG << "DSchedContinueManagerTest NotifyContinueDataRecv_001 end" << std::endl;
641 }
642 
643 /**
644  * @tc.name: ContinueMission_006
645  * @tc.desc: test ContinueMission func
646  * @tc.type: FUNC
647  */
648 HWTEST_F(DSchedContinueManagerTest, ContinueMission_006, TestSize.Level3)
649 {
650     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_006 begin" << std::endl;
651     DSchedContinueManager::GetInstance(). eventHandler_ = nullptr;
652     auto callback = GetDSchedService();
653     OHOS::AAFwk::WantParams wantParams;
654     std::shared_ptr<DmsDeviceInfo> ptr = std::make_shared<DmsDeviceInfo>("", 0, "");
655     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(REMOTE_DEVICEID), Return(true)));
656     EXPECT_CALL(*dmsStoreMock, GetDeviceInfoById(_)).WillOnce(Return(ptr));
657     int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
658         callback, wantParams);
659     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
660 
661     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(REMOTE_DEVICEID), Return(true)));
662     EXPECT_CALL(*dmsStoreMock, GetDeviceInfoById(_)).WillOnce(Return(ptr));
663     ret = DSchedContinueManager::GetInstance().ContinueMission(
664         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
665         callback, wantParams);
666     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
667     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_006 end" << std::endl;
668 }
669 
670 /**
671  * @tc.name: ContinueMission_007
672  * @tc.desc: test ContinueMission func
673  * @tc.type: FUNC
674  */
675 HWTEST_F(DSchedContinueManagerTest, ContinueMission_007, TestSize.Level3)
676 {
677     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_007 begin" << std::endl;
678     auto runner = AppExecFwk::EventRunner::Create(false);
679     DSchedContinueManager::GetInstance().eventHandler_ = std::make_shared<OHOS::AppExecFwk::EventHandler>(runner);
680     auto callback = GetDSchedService();
681     OHOS::AAFwk::WantParams wantParams;
682     std::shared_ptr<DmsDeviceInfo> ptr = std::make_shared<DmsDeviceInfo>("", 0, "");
683     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(REMOTE_DEVICEID), Return(true)));
684     EXPECT_CALL(*dmsStoreMock, GetDeviceInfoById(_)).WillOnce(Return(ptr));
685     int32_t ret = DSchedContinueManager::GetInstance().ContinueMission(LOCAL_DEVICEID, REMOTE_DEVICEID, MISSION_ID,
686         callback, wantParams);
687     EXPECT_EQ(ret, ERR_OK);
688 
689     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(REMOTE_DEVICEID), Return(true)));
690     EXPECT_CALL(*dmsStoreMock, GetDeviceInfoById(_)).WillOnce(Return(ptr));
691     ret = DSchedContinueManager::GetInstance().ContinueMission(
692         DSchedContinueInfo(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE),
693         callback, wantParams);
694     EXPECT_EQ(ret, ERR_OK);
695     DTEST_LOG << "DSchedContinueManagerTest ContinueMission_007 end" << std::endl;
696 }
697 
698 /**
699  * @tc.name: StartContinuation_002
700  * @tc.desc: test StartContinuation func
701  * @tc.type: FUNC
702  */
703 HWTEST_F(DSchedContinueManagerTest, StartContinuation_002, TestSize.Level3)
704 {
705     DTEST_LOG << "DSchedContinueManagerTest StartContinuation_002 begin" << std::endl;
706     OHOS::AAFwk::Want want;
707     int32_t missionId = 0;
708     int32_t callerUid = 0;
709     int32_t status = 0;
710     uint32_t accessToken = 0;
711     DSchedContinueInfo info(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE);
712     std::shared_ptr<DSchedContinue> dContinue = CreateObject();
713     std::shared_ptr<DmsDeviceInfo> ptr = std::make_shared<DmsDeviceInfo>("", 0, "");
714     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(Return(false));
715     EXPECT_CALL(*dmsStoreMock, GetDeviceInfoById(_)).WillOnce(Return(ptr));
716     int32_t ret = DSchedContinueManager::GetInstance().StartContinuation(want, missionId,
717         callerUid, status, accessToken);
718     EXPECT_EQ(ret, INVALID_REMOTE_PARAMETERS_ERR);
719     DTEST_LOG << "DSchedContinueManagerTest StartContinuation_002 end" << std::endl;
720 }
721 
722 /**
723  * @tc.name: HandleDataRecv_001
724  * @tc.desc: test HandleDataRecv func
725  * @tc.type: FUNC
726  */
727 HWTEST_F(DSchedContinueManagerTest, HandleDataRecv_001, TestSize.Level3)
728 {
729     DTEST_LOG << "DSchedContinueManagerTest HandleDataRecv_001 begin" << std::endl;
730     std::shared_ptr<DSchedDataBuffer> dataBuffer = std::make_shared<DSchedDataBuffer>(SIZE);
731     EXPECT_NO_FATAL_FAILURE(DSchedContinueManager::GetInstance().HandleDataRecv(1, dataBuffer));
732     DTEST_LOG << "DSchedContinueManagerTest HandleDataRecv_001 end" << std::endl;
733 }
734 
735 /**
736  * @tc.name: NotifyContinueDataRecv_002
737  * @tc.desc: test NotifyContinueDataRecv func
738  * @tc.type: FUNC
739  */
740 HWTEST_F(DSchedContinueManagerTest, NotifyContinueDataRecv_002, TestSize.Level3)
741 {
742     DTEST_LOG << "DSchedContinueManagerTest NotifyContinueDataRecv_002 begin" << std::endl;
743     int32_t sessionId = -1;
744     int32_t command = 0;
745     std::string jsonStr = "jsonStr";
746     DSchedContinueInfo info(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE);
747     std::shared_ptr<DSchedContinue> dContinue = CreateObject();
748     DSchedContinueManager::GetInstance().continues_.clear();
749     DSchedContinueManager::GetInstance().continues_[info] = nullptr;
750     DSchedContinueManager::GetInstance().continues_[info] = dContinue;
751     std::shared_ptr<DSchedDataBuffer> dataBuffer = nullptr;
752     DSchedContinueManager::GetInstance().NotifyContinueDataRecv(sessionId, command, jsonStr, dataBuffer);
753     EXPECT_NE(DSchedContinueManager::GetInstance().continues_.empty(), true);
754 
755     EXPECT_NO_FATAL_FAILURE(DSchedContinueManager::GetInstance().OnShutdown(1, false));
756     DTEST_LOG << "DSchedContinueManagerTest NotifyContinueDataRecv_002 end" << std::endl;
757 }
758 
759 /**
760  * @tc.name: NotifyContinueDataRecv_003
761  * @tc.desc: test NotifyContinueDataRecv func
762  * @tc.type: FUNC
763  */
764 HWTEST_F(DSchedContinueManagerTest, NotifyContinueDataRecv_003, TestSize.Level3)
765 {
766     DTEST_LOG << "DSchedContinueManagerTest NotifyContinueDataRecv_003 begin" << std::endl;
767     int32_t sessionId = -1;
768     int32_t command = DSCHED_CONTINUE_CMD_START;
769     DmsKvSyncE2E::GetInstance()->isMDMControl_ = false;
770     std::string jsonStr = "jsonStr";
771     DSchedContinueInfo info(LOCAL_DEVICEID, BUNDLE_NAME, REMOTE_DEVICEID, BUNDLE_NAME, CONTINUETYPE);
772     std::shared_ptr<DSchedContinue> dContinue = CreateObject();
773     DSchedContinueManager::GetInstance().continues_.clear();
774     DSchedContinueManager::GetInstance().continues_[info] = nullptr;
775     DSchedContinueManager::GetInstance().continues_[info] = dContinue;
776     std::shared_ptr<DSchedDataBuffer> dataBuffer = nullptr;
777     DSchedContinueManager::GetInstance().NotifyContinueDataRecv(sessionId, command, jsonStr, dataBuffer);
778     EXPECT_NE(DSchedContinueManager::GetInstance().continues_.empty(), true);
779     DmsKvSyncE2E::GetInstance()->isMDMControl_ = true;
780     DSchedContinueManager::GetInstance().NotifyContinueDataRecv(sessionId, command, jsonStr, dataBuffer);
781     EXPECT_NE(DSchedContinueManager::GetInstance().continues_.empty(), true);
782     EXPECT_NO_FATAL_FAILURE(DSchedContinueManager::GetInstance().OnShutdown(1, false));
783     DTEST_LOG << "DSchedContinueManagerTest NotifyContinueDataRecv_003 end" << std::endl;
784 }
785 
786 /**
787  * @tc.name: CheckContinuationLimit_003
788  * @tc.desc: test CheckContinuationLimit func
789  * @tc.type: FUNC
790  */
791 HWTEST_F(DSchedContinueManagerTest, CheckContinuationLimit_003, TestSize.Level3)
792 {
793     DTEST_LOG << "DSchedContinueManagerTest CheckContinuationLimit_003 begin" << std::endl;
794     int32_t direction = 0;
795     std::shared_ptr<DmsDeviceInfo> ptr = std::make_shared<DmsDeviceInfo>("", 0, "");
796     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(LOCAL_DEVICEID), Return(true)));
797     EXPECT_CALL(*dmsStoreMock, GetDeviceInfoById(_)).WillOnce(Return(ptr));
798     DSchedContinueManager::GetInstance().cntSink_.store(MAX_CONCURRENT_SINK);
799     int32_t ret = DSchedContinueManager::GetInstance().CheckContinuationLimit(LOCAL_DEVICEID, REMOTE_DEVICEID,
800         direction);
801     EXPECT_EQ(ret, ERR_OK);
802 
803     EXPECT_CALL(*dmsStoreMock, GetLocalDeviceId(_)).WillOnce(DoAll(SetArgReferee<0>(REMOTE_DEVICEID), Return(true)));
804     EXPECT_CALL(*dmsStoreMock, GetDeviceInfoById(_)).WillOnce(Return(ptr));
805     DSchedContinueManager::GetInstance().cntSink_.store(0);
806     ret = DSchedContinueManager::GetInstance().CheckContinuationLimit(LOCAL_DEVICEID, REMOTE_DEVICEID,
807         direction);
808     EXPECT_EQ(ret, ERR_OK);
809     DTEST_LOG << "DSchedContinueManagerTest CheckContinuationLimit_003 end" << std::endl;
810 }
811 
812 /**
813  * @tc.name: NotifyCompleteContinuation_002
814  * @tc.desc: test NotifyCompleteContinuation func
815  * @tc.type: FUNC
816  */
817 HWTEST_F(DSchedContinueManagerTest, NotifyCompleteContinuation_002, TestSize.Level3)
818 {
819     DTEST_LOG << "DSchedContinueManagerTest NotifyCompleteContinuation_002 begin" << std::endl;
820     DSchedContinueManager::GetInstance(). eventHandler_ = nullptr;
821     DSchedContinueInfo info;
822     DSchedContinueManager::GetInstance().SetTimeOut(info, 0);
823     DSchedContinueManager::GetInstance().RemoveTimeout(info);
824     DSchedContinueManager::GetInstance().OnDataRecv(0, nullptr);
825     DSchedContinueManager::GetInstance().OnShutdown(1, false);
826 
827     std::u16string devId = u"testDevId";
828     int32_t ret = DSchedContinueManager::GetInstance().NotifyCompleteContinuation(devId, 0, false, "");
829     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
830     DTEST_LOG << "DSchedContinueManagerTest NotifyCompleteContinuation_002 end" << std::endl;
831 }
832 
833 /**
834  * @tc.name: GetFirstBundleName_002
835  * @tc.desc: test GetFirstBundleName func
836  * @tc.type: FUNC
837  */
838 HWTEST_F(DSchedContinueManagerTest, GetFirstBundleName_002, TestSize.Level3)
839 {
840     DTEST_LOG << "DSchedContinueManagerTest GetFirstBundleName_002 begin" << std::endl;
841     DSchedContinueInfo info;
842     std::string firstBundleName;
843     std::string bundleName;
844     std::string deviceId;
845     g_mockDbs = true;
846     bool ret = DSchedContinueManager::GetInstance().GetFirstBundleName(info, firstBundleName, bundleName, deviceId);
847     EXPECT_EQ(ret, false);
848     DTEST_LOG << "DSchedContinueManagerTest GetFirstBundleName_002 end" << std::endl;
849 }
850 
851 /**
852  * @tc.name: ContinueStateCallbackRegister_001
853  * @tc.desc: test ContinueStateCallbackRegister func
854  * @tc.type: FUNC
855  */
856 HWTEST_F(DSchedContinueManagerTest, ContinueStateCallbackRegister_001, TestSize.Level3)
857 {
858     DTEST_LOG << "DSchedContinueManagerTest ContinueStateCallbackRegister_001 begin" << std::endl;
859     StateCallbackInfo stateCallbackInfo;
860     stateCallbackInfo.missionId = 1;
861     stateCallbackInfo.bundleName = "bundleName";
862     stateCallbackInfo.moduleName = "moduleName";
863     stateCallbackInfo.abilityName = "abilityName";
864 
865     auto callback = GetDSchedService();
866 
867     int32_t ret = DSchedContinueManager::GetInstance().ContinueStateCallbackRegister(
868         stateCallbackInfo, callback);
869     EXPECT_EQ(ret, ERR_OK);
870 
871     DSchedContinueManager::GetInstance().stateCallbackCache_[stateCallbackInfo].state = 1;
872     ret = DSchedContinueManager::GetInstance().ContinueStateCallbackRegister(
873         stateCallbackInfo, callback);
874     EXPECT_EQ(ret, ERR_OK);
875     DTEST_LOG << "DSchedContinueManagerTest ContinueStateCallbackRegister_001 end" << std::endl;
876 }
877 
878 /**
879  * @tc.name: ContinueStateCallbackUnRegister_001
880  * @tc.desc: test ContinueStateCallbackUnRegister func
881  * @tc.type: FUNC
882  */
883 HWTEST_F(DSchedContinueManagerTest, ContinueStateCallbackUnRegister_001, TestSize.Level3)
884 {
885     DTEST_LOG << "DSchedContinueManagerTest ContinueStateCallbackUnRegister_001 begin" << std::endl;
886     StateCallbackInfo stateCallbackInfo;
887     stateCallbackInfo.missionId = 1;
888     stateCallbackInfo.bundleName = "bundleName";
889     stateCallbackInfo.moduleName = "moduleName";
890     stateCallbackInfo.abilityName = "abilityName";
891 
892     int32_t ret = DSchedContinueManager::GetInstance().ContinueStateCallbackUnRegister(
893         stateCallbackInfo);
894     EXPECT_EQ(ret, ERR_OK);
895     DTEST_LOG << "DSchedContinueManagerTest ContinueStateCallbackUnRegister_001 end" << std::endl;
896 }
897 
898 /**
899  * @tc.name: NotifyQuickStartState_001
900  * @tc.desc: test NotifyQuickStartState func
901  * @tc.type: FUNC
902  */
903 HWTEST_F(DSchedContinueManagerTest, NotifyQuickStartState_001, TestSize.Level3)
904 {
905     DTEST_LOG << "DSchedContinueManagerTest NotifyQuickStartState_001 begin" << std::endl;
906     StateCallbackInfo stateCallbackInfo;
907     stateCallbackInfo.missionId = 2;
908     stateCallbackInfo.bundleName = "bundleName";
909     stateCallbackInfo.moduleName = "moduleName";
910     stateCallbackInfo.abilityName = "abilityName";
911 
912     std::string testMessage = "testMessage";
913 
914     int32_t ret = DSchedContinueManager::GetInstance().NotifyQuickStartState(
915         stateCallbackInfo, 0, testMessage);
916     EXPECT_EQ(ret, ERR_OK);
917 
918     ret = DSchedContinueManager::GetInstance().NotifyQuickStartState(
919         stateCallbackInfo, 0, testMessage);
920     EXPECT_EQ(ret, ERR_OK);
921 
922     DSchedContinueManager::GetInstance().stateCallbackCache_[stateCallbackInfo].remoteObject = GetDSchedService();
923     ret = DSchedContinueManager::GetInstance().NotifyQuickStartState(
924         stateCallbackInfo, 0, testMessage);
925     EXPECT_EQ(ret, ERR_OK);
926 
927     DTEST_LOG << "DSchedContinueManagerTest NotifyQuickStartState_001 end" << std::endl;
928 }
929 }
930 }
931