1 /*
2  * Copyright (c) 2023-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 #include "dms_continue_manager_test.h"
17 
18 #include "datetime_ex.h"
19 #include "distributed_sched_test_util.h"
20 #include "dtbschedmgr_log.h"
21 #define private public
22 #include "mission/dms_continue_send_manager.h"
23 #include "mission/dms_continue_recv_manager.h"
24 #undef private
25 #include "test_log.h"
26 
27 using namespace testing;
28 using namespace testing::ext;
29 
30 namespace OHOS {
31 namespace DistributedSchedule {
32 namespace {
33 const std::string TYPE = "type";
34 const std::string BUNDLENAME_01 = "bundleName01";
35 const std::string BUNDLENAME_02 = "bundleName02";
36 const std::string NETWORKID_01 = "networkId01";
37 const std::string NETWORKID_02 = "networkId02";
38 const std::string ABILITY_NAME_01 = "abilityName01";
39 const std::string CANCEL_FOCUSED_TASK = "cancel_mission_focused_task";
40 constexpr static int32_t DMS_SEND_LEN = 5;
41 constexpr static uint8_t DMS_0X0F = 0x0f;
42 constexpr int32_t MISSIONID_01 = 1;
43 constexpr int32_t MISSIONID_02 = 2;
44 constexpr int32_t ACTIVE = 0;
45 constexpr int32_t INACTIVE = 1;
46 constexpr int32_t CANCEL_FOCUSED_DELAYED = 10000;
47 constexpr int32_t DBMS_RETRY_MAX_TIME = 5;
48 }
49 
SetUpTestCase()50 void DMSContinueManagerTest::SetUpTestCase()
51 {
52 }
53 
TearDownTestCase()54 void DMSContinueManagerTest::TearDownTestCase()
55 {
56 }
57 
SetUp()58 void DMSContinueManagerTest::SetUp()
59 {
60 }
61 
TearDown()62 void DMSContinueManagerTest::TearDown()
63 {
64 }
65 
OnCallback(const uint32_t ContinueState,const std::string & srcDeviceId,const std::string & bundleName,const std::string & continueType,const std::string & srcBundleName)66 void RemoteOnListenerStubTest::OnCallback(const uint32_t ContinueState, const std::string& srcDeviceId,
67     const std::string &bundleName, const std::string &continueType, const std::string &srcBundleName)
68 {
69 }
70 
71 /**
72  * @tc.name: testUnInit001
73  * @tc.desc: test UnInit
74  * @tc.type: FUNC
75  * @tc.require: I7F8KH
76  */
77 HWTEST_F(DMSContinueManagerTest, testUnInit001, TestSize.Level3)
78 {
79     DTEST_LOG << "DMSContinueManagerTest testUnInit001 begin" << std::endl;
80 
81     DistributedSchedUtil::MockManageMissions();
82     DMSContinueSendMgr::GetInstance().Init();
83     EXPECT_NE(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
84 
85     /**
86      * @tc.steps: step1. test UnInit when eventHandler is not nullptr;
87      */
88     DMSContinueSendMgr::GetInstance().UnInit();
89     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
90 
91     /**
92      * @tc.steps: step2. test UnInit when eventHandler is nullptr;
93      */
94     DMSContinueSendMgr::GetInstance().UnInit();
95     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
96 
97     DTEST_LOG << "DMSContinueManagerTest testUnInit001 end" << std::endl;
98 }
99 
100 /**
101  * @tc.name: testUnInit002
102  * @tc.desc: test UnInit
103  * @tc.type: FUNC
104  * @tc.require: I7F8KH
105  */
106 HWTEST_F(DMSContinueManagerTest, testUnInit002, TestSize.Level3)
107 {
108     DTEST_LOG << "DMSContinueManagerTest testUnInit002 begin" << std::endl;
109 
110     DistributedSchedUtil::MockManageMissions();
111     DMSContinueSendMgr::GetInstance().Init();
112     EXPECT_NE(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
113 
114     DMSContinueSendMgr::GetInstance().UnInit();
115     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
116     DTEST_LOG << "DMSContinueManagerTest testUnInit002 end" << std::endl;
117 }
118 
119 /**
120  * @tc.name: testPostUnfocusedTaskWithDelay001
121  * @tc.desc: test PostUnfocusedTaskWithDelay
122  * @tc.type: FUNC
123  */
124 HWTEST_F(DMSContinueManagerTest, testPostUnfocusedTaskWithDelay001, TestSize.Level3)
125 {
126     DTEST_LOG << "DMSContinueManagerTest testPostUnfocusedTaskWithDelay001 begin" << std::endl;
127 
128     DistributedSchedUtil::MockManageMissions();
129     DMSContinueSendMgr::GetInstance().Init();
130 
131     /**
132      * @tc.steps: step1. test PostUnfocusedTaskWithDelay when eventHandler is not nullptr;
133      */
134     DMSContinueSendMgr::GetInstance().PostUnfocusedTaskWithDelay(0, UnfocusedReason::TIMEOUT);
135     DMSContinueSendMgr::GetInstance().PostUnfocusedTaskWithDelay(0, UnfocusedReason::SCREENOFF);
136     EXPECT_NE(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
137 
138     /**
139      * @tc.steps: step2. test PostUnfocusedTaskWithDelay when eventHandler is nullptr;
140      */
141     DMSContinueSendMgr::GetInstance().UnInit();
142     DMSContinueSendMgr::GetInstance().PostUnfocusedTaskWithDelay(0, UnfocusedReason::TIMEOUT);
143     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
144     DTEST_LOG << "DMSContinueManagerTest testPostUnfocusedTaskWithDelay001 end" << std::endl;
145 }
146 
147 /**
148  * @tc.name: testNotifyMissionFocused001
149  * @tc.desc: test NotifyMissionFocused
150  * @tc.type: FUNC
151  * @tc.require: I7F8KH
152  */
153 HWTEST_F(DMSContinueManagerTest, testNotifyMissionFocused001, TestSize.Level3)
154 {
155     DTEST_LOG << "DMSContinueManagerTest testNotifyMissionFocused001 begin" << std::endl;
156 
157     DistributedSchedUtil::MockManageMissions();
158     DMSContinueSendMgr::GetInstance().Init();
159 
160     /**
161      * @tc.steps: step1. test NotifyMissionFocused when eventHandler is not nullptr;
162      */
163     DMSContinueSendMgr::GetInstance().NotifyMissionFocused(0, FocusedReason::NORMAL);
164     DMSContinueSendMgr::GetInstance().NotifyMissionFocused(0, FocusedReason::SCREENOFF);
165     EXPECT_NE(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
166 
167     /**
168      * @tc.steps: step2. test NotifyMissionFocused when eventHandler is nullptr;
169      */
170     DMSContinueSendMgr::GetInstance().UnInit();
171     DMSContinueSendMgr::GetInstance().NotifyMissionFocused(0, FocusedReason::NORMAL);
172     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
173     DTEST_LOG << "DMSContinueManagerTest testNotifyMissionFocused001 end" << std::endl;
174 }
175 
176 /**
177  * @tc.name: testNotifyMissionUnfocused001
178  * @tc.desc: test NotifyMissionUnfocused
179  * @tc.type: FUNC
180  * @tc.require: I7F8KH
181  */
182 HWTEST_F(DMSContinueManagerTest, testNotifyMissionUnfocused001, TestSize.Level3)
183 {
184     DTEST_LOG << "DMSContinueManagerTest testNotifyMissionUnfocused001 begin" << std::endl;
185 
186     DistributedSchedUtil::MockManageMissions();
187     DMSContinueSendMgr::GetInstance().Init();
188     /**
189      * @tc.steps: step1. test NotifyMissionUnfocused when eventHandler is not nullptr;
190      */
191     DMSContinueSendMgr::GetInstance().NotifyMissionUnfocused(0, UnfocusedReason::NORMAL);
192     EXPECT_NE(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
193 
194     /**
195      * @tc.steps: step2. test NotifyMissionUnfocused when eventHandler is nullptr;
196      */
197     DMSContinueSendMgr::GetInstance().UnInit();
198     DMSContinueSendMgr::GetInstance().NotifyMissionUnfocused(0, UnfocusedReason::NORMAL);
199     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
200     DTEST_LOG << "DMSContinueManagerTest testNotifyMissionUnfocused001 end" << std::endl;
201 }
202 
203 /**
204  * @tc.name: testRegisterOnListener001
205  * @tc.desc: test RegisterOnListener
206  * @tc.type: FUNC
207  */
208 HWTEST_F(DMSContinueManagerTest, testRegisterOnListener001, TestSize.Level1)
209 {
210     DTEST_LOG << "DMSContinueManagerTest testRegisterOnListener001 start" << std::endl;
211     DMSContinueRecvMgr::GetInstance().Init();
212     sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
213     int32_t ret = DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01);
214     EXPECT_EQ(ret, ERR_OK);
215 
216     ret = DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01);
217     EXPECT_EQ(ret, NO_MISSION_INFO_FOR_MISSION_ID);
218 
219     sptr<IRemoteObject> obj02(new RemoteOnListenerStubTest());
220     ret = DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj02);
221     EXPECT_EQ(ret, ERR_OK);
222     DTEST_LOG << "DMSContinueManagerTest testRegisterOnListener001 end" << std::endl;
223 }
224 
225 /**
226  * @tc.name: testRegisterOffListener001
227  * @tc.desc: test RegisterOffListener
228  * @tc.type: FUNC
229  */
230 HWTEST_F(DMSContinueManagerTest, testRegisterOffListener001, TestSize.Level1)
231 {
232     DTEST_LOG << "DMSContinueManagerTest testRegisterOffListener001 start" << std::endl;
233     sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
234     int32_t ret = DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01);
235     ret = DMSContinueRecvMgr::GetInstance().RegisterOffListener(TYPE, obj01);
236     EXPECT_EQ(ret, ERR_OK);
237 
238     ret = DMSContinueRecvMgr::GetInstance().RegisterOffListener(TYPE, nullptr);
239     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
240     DTEST_LOG << "DMSContinueManagerTest testRegisterOffListener001 end" << std::endl;
241 }
242 
243 /**
244  * @tc.name: testRegisterOffListener002
245  * @tc.desc: test RegisterOffListener when iterItem->second is empty.
246  * @tc.type: FUNC
247  * @tc.require: I7F8KH
248  */
249 HWTEST_F(DMSContinueManagerTest, testRegisterOffListener002, TestSize.Level3)
250 {
251     DTEST_LOG << "DMSContinueManagerTest testRegisterOffListener002 start" << std::endl;
252     sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
253     int32_t ret = DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01);
254     EXPECT_EQ(ret, ERR_OK);
255 
256     {
257         std::lock_guard<std::mutex> registerOnListenerMapLock(
258             DMSContinueRecvMgr::GetInstance().eventMutex_);
259         DMSContinueRecvMgr::GetInstance().registerOnListener_[TYPE].clear();
260     }
261     ret = DMSContinueRecvMgr::GetInstance().RegisterOffListener(TYPE, obj01);
262     EXPECT_EQ(ret, ERR_OK);
263     DTEST_LOG << "DMSContinueManagerTest testRegisterOffListener002 end" << std::endl;
264 }
265 
266 /**
267  * @tc.name: testGetMissionId001
268  * @tc.desc: test GetMissionId
269  * @tc.type: FUNC
270  */
271 HWTEST_F(DMSContinueManagerTest, testGetMissionId001, TestSize.Level1)
272 {
273     DTEST_LOG << "DMSContinueManagerTest testGetMissionId001 start" << std::endl;
274     DMSContinueSendMgr::GetInstance().focusedMission_[BUNDLENAME_01] = MISSIONID_01;
275     int32_t missionId;
276     int32_t ret = DMSContinueSendMgr::GetInstance().GetMissionIdByBundleName(BUNDLENAME_01, missionId);
277     EXPECT_EQ(missionId, MISSIONID_01);
278     EXPECT_EQ(ret, ERR_OK);
279 
280     ret = DMSContinueSendMgr::GetInstance().GetMissionIdByBundleName(BUNDLENAME_02, missionId);
281     EXPECT_EQ(ret, MISSION_NOT_FOCUSED);
282     DTEST_LOG << "DMSContinueManagerTest testGetMissionId001 end" << std::endl;
283 }
284 
285 /**
286  * @tc.name: testDealFocusedBusiness001
287  * @tc.desc: test DealFocusedBusiness.
288  * @tc.type: FUNC
289  * @tc.require: I7F8KH
290  */
291 HWTEST_F(DMSContinueManagerTest, testDealFocusedBusiness001, TestSize.Level3)
292 {
293     DTEST_LOG << "DMSContinueManagerTest testDealFocusedBusiness001 start" << std::endl;
294 
295     /**
296      * @tc.steps: step1. test DealFocusedBusiness when missionId is invalid;
297      */
298     int32_t ret = DMSContinueSendMgr::GetInstance().DealFocusedBusiness(-1, FocusedReason::MIN);
299     EXPECT_NE(ret, ERR_OK);
300 
301     DTEST_LOG << "DMSContinueManagerTest testDealFocusedBusiness001 end" << std::endl;
302 }
303 
304 /**
305  * @tc.name: testDealUnfocusedBusiness001
306  * @tc.desc: test DealUnfocusedBusiness.
307  * @tc.type: FUNC
308  * @tc.require: I7F8KH
309  */
310 HWTEST_F(DMSContinueManagerTest, testDealUnfocusedBusiness001, TestSize.Level3)
311 {
312     DTEST_LOG << "DMSContinueManagerTest testDealUnfocusedBusiness001 start" << std::endl;
313 
314     /**
315      * @tc.steps: step1. test DealUnfocusedBusiness when missionId is invalid;
316      */
317     int32_t ret = DMSContinueSendMgr::GetInstance().DealUnfocusedBusiness(-1, UnfocusedReason::NORMAL);
318     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
319 
320     /**
321      * @tc.steps: step2. test DealUnfocusedBusiness when missionId is not invalid;
322      */
323     DMSContinueSendMgr::GetInstance().focusedMission_[BUNDLENAME_01] = MISSIONID_01;
324     DMSContinueSendMgr::GetInstance().focusedMissionAbility_[MISSIONID_01] = ABILITY_NAME_01;
325     ret = DMSContinueSendMgr::GetInstance().DealUnfocusedBusiness(MISSIONID_01, UnfocusedReason::NORMAL);
326     EXPECT_EQ(ret, CAN_NOT_FOUND_ABILITY_ERR);
327 
328     /**
329      * @tc.steps: step3. test NotifyDied when obj is nullptr;
330      */
331     sptr<IRemoteObject> obj01 = nullptr;
332     DMSContinueRecvMgr::GetInstance().NotifyDied(obj01);
333 
334     /**
335      * @tc.steps: step4. test NotifyDied when iterItem->second is empty;
336      */
337     std::vector<sptr<IRemoteObject>> objs;
338     {
339         std::lock_guard<std::mutex> registerOnListenerMapLock(
340             DMSContinueRecvMgr::GetInstance().eventMutex_);
341         DMSContinueRecvMgr::GetInstance().registerOnListener_[TYPE] = objs;
342     }
343     obj01 = new RemoteOnListenerStubTest();
344     DMSContinueRecvMgr::GetInstance().NotifyDied(obj01);
345 
346     DTEST_LOG << "DMSContinueManagerTest testDealUnfocusedBusiness001 end" << std::endl;
347 }
348 
349 /**
350  * @tc.name: testVerifyBroadcastSource001
351  * @tc.desc: test testVerifyBroadcastSource001.
352  * @tc.type: FUNC
353  */
354 HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource001, TestSize.Level3)
355 {
356     DTEST_LOG << "DMSContinueManagerTest testVerifyBroadcastSource001 start" << std::endl;
357 
358     int32_t state = ACTIVE;
359     std::string networkId = "test networkId";
360     std::string sourceBundleName = "test sourceBundleName";
361     std::string sinkBundleName = "test sinkBundleName";
362     std::string continueType = "test continueType";
363     int32_t ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
364         sourceBundleName, sinkBundleName, continueType, state);
365     EXPECT_EQ(ret, ERR_OK);
366 
367     state = INACTIVE;
368     ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(
369         networkId, sourceBundleName, sinkBundleName, continueType, state);
370     EXPECT_EQ(ret, ERR_OK);
371 }
372 
373 /**
374  * @tc.name: testVerifyBroadcastSource002
375  * @tc.desc: test testVerifyBroadcastSource002.
376  * @tc.type: FUNC
377  */
378 HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource002, TestSize.Level3)
379 {
380     DTEST_LOG << "DMSContinueManagerTest testVerifyBroadcastSource002 start" << std::endl;
381 
382     int32_t state = ACTIVE;
383     std::string networkId = "test networkId";
384     std::string sourceBundleName = "test sourceBundleName";
385     std::string sinkBundleName = "test sinkBundleName";
386     std::string continueType = "test continueType";
387     int32_t ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
388         sourceBundleName, sinkBundleName, continueType, state);
389     EXPECT_EQ(ret, ERR_OK);
390 
391     state = INACTIVE;
392     networkId = "invalid networkId";
393     ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
394         sourceBundleName, sinkBundleName, continueType, state);
395     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
396 }
397 
398 /**
399  * @tc.name: testVerifyBroadcastSource003
400  * @tc.desc: test testVerifyBroadcastSource003.
401  * @tc.type: FUNC
402  */
403 HWTEST_F(DMSContinueManagerTest, testVerifyBroadcastSource003, TestSize.Level3)
404 {
405     DTEST_LOG << "DMSContinueManagerTest testVerifyBroadcastSource003 start" << std::endl;
406 
407     int32_t state = ACTIVE;
408     std::string networkId = "test networkId";
409     std::string sourceBundleName = "test sourceBundleName";
410     std::string sinkBundleName = "test sinkBundleName";
411     std::string continueType = "test continueType";
412     int32_t ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
413         sourceBundleName, sinkBundleName, continueType, state);
414     EXPECT_EQ(ret, ERR_OK);
415 
416     state = INACTIVE;
417     sourceBundleName = "invalid sourceBundleName";
418     sinkBundleName = "invalid sinkBundleName";
419     ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
420         sourceBundleName, sinkBundleName, continueType, state);
421     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
422 }
423 
424 /**
425  * @tc.name: testDealOnBroadcastBusiness001
426  * @tc.desc: test DealOnBroadcastBusiness.
427  * @tc.type: FUNC
428  * @tc.require: I7F8KH
429  */
430 HWTEST_F(DMSContinueManagerTest, testDealOnBroadcastBusiness001, TestSize.Level3)
431 {
432     DTEST_LOG << "DMSContinueManagerTest testDealOnBroadcastBusiness001 start" << std::endl;
433 
434     /**
435      * @tc.steps: step1. test DealOnBroadcastBusiness when senderNetworkId is invalid;
436      */
437     std::string senderNetworkId = "invalid senderNetworkId";
438     uint16_t bundleNameId = 0;
439     uint8_t continueTypeId = 0;
440     int32_t state = 0;
441 
442     DMSContinueRecvMgr::GetInstance().PostOnBroadcastBusiness(senderNetworkId, bundleNameId, continueTypeId, state);
443 
444     int32_t ret = DMSContinueRecvMgr::GetInstance().DealOnBroadcastBusiness(senderNetworkId, bundleNameId,
445         continueTypeId, state, 0);
446     EXPECT_EQ(ret, ERR_OK);
447 
448     ret = DMSContinueRecvMgr::GetInstance().DealOnBroadcastBusiness(senderNetworkId, bundleNameId, continueTypeId,
449         state, DBMS_RETRY_MAX_TIME);
450     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
451 
452     /**
453      * @tc.steps: step2. test NotifyRecvBroadcast when obj is nullptr;
454      */
455     sptr<IRemoteObject> obj = nullptr;
456     std::string networkId = "invalid networkId";
457     std::string sourceBundleName = "invalid sourceBundleName";
458     std::string sinkBundleName = "invalid sinkBundleName";
459     std::string continueType = "invalid continueType";
460     DMSContinueRecvMgr::GetInstance().NotifyRecvBroadcast(obj,
461         currentIconInfo(networkId, sourceBundleName, sinkBundleName, continueType), state);
462 
463     /**
464      * @tc.steps: step3. test NotifyRecvBroadcast when missionId is invalid;
465      */
466     obj =  new RemoteOnListenerStubTest();
467     DMSContinueRecvMgr::GetInstance().NotifyRecvBroadcast(obj,
468         currentIconInfo(networkId, sourceBundleName, sinkBundleName, continueType), state);
469 
470     DTEST_LOG << "DMSContinueManagerTest testDealOnBroadcastBusiness001 end" << std::endl;
471 }
472 
473 /**
474  * @tc.name: testGetBundleName001
475  * @tc.desc: test GetBundleName
476  * @tc.type: FUNC
477  */
478 HWTEST_F(DMSContinueManagerTest, testGetBundleName001, TestSize.Level1)
479 {
480     DTEST_LOG << "DMSContinueManagerTest testGetBundleName001 start" << std::endl;
481     DMSContinueSendMgr::GetInstance().focusedMission_[BUNDLENAME_01] = MISSIONID_01;
482     std::string bundleName;
483     int32_t ret = DMSContinueSendMgr::GetInstance().GetBundleNameByMissionId(MISSIONID_01, bundleName);
484     EXPECT_EQ(bundleName, BUNDLENAME_01);
485     EXPECT_EQ(ret, ERR_OK);
486 
487     ret = DMSContinueSendMgr::GetInstance().GetBundleNameByMissionId(MISSIONID_02, bundleName);
488     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
489     DTEST_LOG << "DMSContinueManagerTest testGetBundleName001 end" << std::endl;
490 }
491 
492 /**
493  * @tc.name: testIsContinue001
494  * @tc.desc: test IsContinue
495  * @tc.type: FUNC
496  */
497 HWTEST_F(DMSContinueManagerTest, testIsContinue001, TestSize.Level1)
498 {
499     DTEST_LOG << "DMSContinueManagerTest testIsContinue001 start" << std::endl;
500     DMSContinueSendMgr::GetInstance().focusedMission_[BUNDLENAME_02] = MISSIONID_02;
501     DMSContinueSendMgr::GetInstance().info_.currentMissionId = MISSIONID_01;
502     DMSContinueSendMgr::GetInstance().info_.currentIsContinuable = true;
503     bool ret = DMSContinueSendMgr::GetInstance().IsContinue(MISSIONID_02, BUNDLENAME_02);
504     EXPECT_EQ(ret, false);
505 
506     ret = DMSContinueSendMgr::GetInstance().IsContinue(MISSIONID_01, BUNDLENAME_01);
507     EXPECT_EQ(ret, true);
508 
509     DMSContinueSendMgr::GetInstance().info_.currentIsContinuable = false;
510     ret = DMSContinueSendMgr::GetInstance().IsContinue(MISSIONID_01, BUNDLENAME_01);
511     EXPECT_EQ(ret, true);
512     DTEST_LOG << "DMSContinueManagerTest testIsContinue001 end" << std::endl;
513 }
514 
515 /**
516  * @tc.name: testNotifyDied001
517  * @tc.desc: test NotifyDied
518  * @tc.type: FUNC
519  */
520 HWTEST_F(DMSContinueManagerTest, testNotifyDied001, TestSize.Level1)
521 {
522     DTEST_LOG << "DMSContinueManagerTest testNotifyDied001 start" << std::endl;
523     sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
524     int32_t ret = DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01);
525     EXPECT_EQ(false, DMSContinueRecvMgr::GetInstance().registerOnListener_.empty());
526     DMSContinueRecvMgr::GetInstance().NotifyDied(obj01);
527     DTEST_LOG << "DMSContinueManagerTest testNotifyDied001 end" << std::endl;
528 }
529 
530 /**
531  * @tc.name: testSetMissionContinueState001
532  * @tc.desc: test SetMissionContinueState
533  * @tc.type: FUNC
534  */
535 HWTEST_F(DMSContinueManagerTest, testSetMissionContinueState001, TestSize.Level3)
536 {
537     DTEST_LOG << "DMSContinueManagerTest testSetMissionContinueState001 start" << std::endl;
538     DistributedSchedUtil::MockManageMissions();
539     DMSContinueSendMgr::GetInstance().Init();
540     OHOS::AAFwk::ContinueState state = OHOS::AAFwk::ContinueState::CONTINUESTATE_ACTIVE;
541 
542      /**
543      * @tc.steps: step1. test SetMissionContinueState when eventHandler is not nullptr;
544      */
545     DMSContinueSendMgr::GetInstance().SetMissionContinueState(0, state);
546     EXPECT_NE(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
547 
548     /**
549      * @tc.steps: step2. test SetMissionContinueState when eventHandler is nullptr;
550      */
551     DMSContinueSendMgr::GetInstance().UnInit();
552     DMSContinueSendMgr::GetInstance().SetMissionContinueState(0, state);
553     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
554     DTEST_LOG << "DMSContinueManagerTest testSetMissionContinueState001 end" << std::endl;
555 }
556 
557 /**
558  * @tc.name: testSetMissionContinueState002
559  * @tc.desc: test SetMissionContinueState
560  * @tc.type: FUNC
561  */
562 HWTEST_F(DMSContinueManagerTest, testSetMissionContinueState002, TestSize.Level3)
563 {
564     DTEST_LOG << "DMSContinueManagerTest testSetMissionContinueState002 start" << std::endl;
565     DistributedSchedUtil::MockManageMissions();
566     DMSContinueSendMgr::GetInstance().Init();
567     OHOS::AAFwk::ContinueState state = OHOS::AAFwk::ContinueState::CONTINUESTATE_INACTIVE;
568 
569      /**
570      * @tc.steps: step1. test SetMissionContinueState when eventHandler is not nullptr;
571      */
572     DMSContinueSendMgr::GetInstance().SetMissionContinueState(0, state);
573     EXPECT_NE(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
574 
575     /**
576      * @tc.steps: step2. test SetMissionContinueState when eventHandler is nullptr;
577      */
578     DMSContinueSendMgr::GetInstance().UnInit();
579     DMSContinueSendMgr::GetInstance().SetMissionContinueState(0, state);
580     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
581     DTEST_LOG << "DMSContinueManagerTest testSetMissionContinueState002 end" << std::endl;
582 }
583 
584 /**
585  * @tc.name: testDealSetMissionContinueStateBusiness001
586  * @tc.desc: test DealSetMissionContinueStateBusiness.
587  * @tc.type: FUNC
588  */
589 HWTEST_F(DMSContinueManagerTest, testDealSetMissionContinueStateBusiness001, TestSize.Level3)
590 {
591     DTEST_LOG << "DMSContinueManagerTest testDealSetMissionContinueStateBusiness001 start" << std::endl;
592     OHOS::AAFwk::ContinueState state = OHOS::AAFwk::ContinueState::CONTINUESTATE_ACTIVE;
593     DMSContinueSendMgr::GetInstance().info_.currentMissionId = MISSIONID_01;
594 
595     /**
596      * @tc.steps: step1. test DealSetMissionContinueStateBusiness when missionId is invalid;
597      */
598     int32_t ret = DMSContinueSendMgr::GetInstance().DealSetMissionContinueStateBusiness(MISSIONID_02,
599         state);
600     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
601 
602     /**
603      * @tc.steps: step2. test DealUnfocusedBusiness when mission is not continueable;
604      */
605     DMSContinueSendMgr::GetInstance().info_.currentIsContinuable = false;
606     ret = DMSContinueSendMgr::GetInstance().DealSetMissionContinueStateBusiness(MISSIONID_01, state);
607     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
608 
609     DTEST_LOG << "DMSContinueManagerTest testDealSetMissionContinueStateBusiness001 end" << std::endl;
610 }
611 
612 #ifdef SUPPORT_COMMON_EVENT_SERVICE
613 /**
614  * @tc.name: testOnDeviceScreenOff001
615  * @tc.desc: test OnDeviceScreenOff normal
616  * @tc.type: FUNC
617  */
618 HWTEST_F(DMSContinueManagerTest, testOnDeviceScreenOff001, TestSize.Level1)
619 {
620     DTEST_LOG << "DMSContinueManagerTest testOnDeviceScreenOff001 start" << std::endl;
621 
622     DistributedSchedUtil::MockManageMissions();
623      /**
624      * @tc.steps: step1. test OnDeviceScreenOff when eventHandler is not nullptr;
625      */
626     DMSContinueSendMgr::GetInstance().Init();
627     DMSContinueSendMgr::GetInstance().OnDeviceScreenOff();
628     EXPECT_NE(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
629 
630     /**
631      * @tc.steps: step2. test OnDeviceScreenOff when eventHandler is nullptr;
632      */
633     DMSContinueSendMgr::GetInstance().UnInit();
634     DMSContinueSendMgr::GetInstance().OnDeviceScreenOff();
635     EXPECT_EQ(DMSContinueSendMgr::GetInstance().eventHandler_, nullptr);
636     DTEST_LOG << "DMSContinueManagerTest testOnDeviceScreenOff001 end" << std::endl;
637 }
638 #endif
639 
640 /**
641  * @tc.name: testNotifyDeviceOffline001
642  * @tc.desc: test NotifyDeviceOffline normal
643  * @tc.type: FUNC
644  */
645 HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOffline001, TestSize.Level1)
646 {
647     DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline001 start" << std::endl;
648     sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
649     DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01);
650     EXPECT_NE(DMSContinueRecvMgr::GetInstance().registerOnListener_.size(), 0);
651 
652     DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId = NETWORKID_01;
653     DMSContinueRecvMgr::GetInstance().NotifyDeviceOffline(NETWORKID_01);
654     EXPECT_EQ(DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId, "");
655 
656     DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline001 end" << std::endl;
657 }
658 
659 /**
660  * @tc.name: testNotifyDeviceOffline002
661  * @tc.desc: test NotifyDeviceOffline networkId empty
662  * @tc.type: FUNC
663  */
664 HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOffline002, TestSize.Level1)
665 {
666     DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline002 start" << std::endl;
667     DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId = NETWORKID_01;
668     DMSContinueRecvMgr::GetInstance().NotifyDeviceOffline("");
669     EXPECT_EQ(DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId, NETWORKID_01);
670 
671     DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline002 end" << std::endl;
672 }
673 
674 /**
675  * @tc.name: testNotifyDeviceOffline003
676  * @tc.desc: test NotifyDeviceOffline networkId not match
677  * @tc.type: FUNC
678  */
679 HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOffline003, TestSize.Level1)
680 {
681     DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline003 start" << std::endl;
682     DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId = NETWORKID_01;
683     DMSContinueRecvMgr::GetInstance().NotifyDeviceOffline(NETWORKID_02);
684     EXPECT_EQ(DMSContinueRecvMgr::GetInstance().iconInfo_.senderNetworkId, NETWORKID_01);
685 
686     DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOffline003 end" << std::endl;
687 }
688 
689 /**
690  * @tc.name: NotifyPackageRemoved001
691  * @tc.desc: test NotifyPackageRemoved normal
692  * @tc.type: FUNC
693  */
694 HWTEST_F(DMSContinueManagerTest, notifyPackageRemoved001, TestSize.Level1)
695 {
696     DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved001 start" << std::endl;
697     sptr<IRemoteObject> obj01(new RemoteOnListenerStubTest());
698     DMSContinueRecvMgr::GetInstance().RegisterOnListener(TYPE, obj01);
699     EXPECT_NE(DMSContinueRecvMgr::GetInstance().registerOnListener_.size(), 0);
700 
701     DMSContinueRecvMgr::GetInstance().iconInfo_.bundleName = BUNDLENAME_01;
702     DMSContinueRecvMgr::GetInstance().NotifyPackageRemoved(BUNDLENAME_01);
703     EXPECT_EQ(DMSContinueRecvMgr::GetInstance().iconInfo_.bundleName, "");
704 
705     DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved001 end" << std::endl;
706 }
707 
708 /**
709  * @tc.name: NotifyPackageRemoved002
710  * @tc.desc: test NotifyPackageRemoved bundleName empty
711  * @tc.type: FUNC
712  */
713 HWTEST_F(DMSContinueManagerTest, notifyPackageRemoved002, TestSize.Level1)
714 {
715     DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved002 start" << std::endl;
716     DMSContinueRecvMgr::GetInstance().iconInfo_.bundleName = BUNDLENAME_01;
717     DMSContinueRecvMgr::GetInstance().NotifyPackageRemoved("");
718     EXPECT_EQ(DMSContinueRecvMgr::GetInstance().iconInfo_.bundleName, BUNDLENAME_01);
719 
720     DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved002 end" << std::endl;
721 }
722 
723 /**
724  * @tc.name: NotifyPackageRemoved003
725  * @tc.desc: test NotifyPackageRemoved bundleName not match
726  * @tc.type: FUNC
727  */
728 HWTEST_F(DMSContinueManagerTest, notifyPackageRemoved003, TestSize.Level1)
729 {
730     DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved003 start" << std::endl;
731     DMSContinueRecvMgr::GetInstance().iconInfo_.bundleName = BUNDLENAME_01;
732     DMSContinueRecvMgr::GetInstance().NotifyPackageRemoved(BUNDLENAME_02);
733     EXPECT_EQ(DMSContinueRecvMgr::GetInstance().iconInfo_.bundleName, BUNDLENAME_01);
734 
735     DTEST_LOG << "DMSContinueManagerTest notifyPackageRemoved003 end" << std::endl;
736 }
737 
738 /**
739  * @tc.name: testNotifyDataRecv001
740  * @tc.desc: NotifyDataRecv
741  * @tc.type: FUNC
742  */
743 HWTEST_F(DMSContinueManagerTest, testNotifyDataRecv001, TestSize.Level1)
744 {
745     DTEST_LOG << "DMSContinueManagerTest testNotifyDataRecv001 start" << std::endl;
746     std::string senderNetworkId = NETWORKID_01;
747     uint8_t payload[] = {0xf0};
748     uint32_t dataLen1 = DMS_SEND_LEN - 1;
749     DMSContinueRecvMgr::GetInstance().NotifyDataRecv(senderNetworkId, payload, dataLen1);
750 
751     uint32_t dataLen2 = DMS_SEND_LEN;
752     DMSContinueRecvMgr::GetInstance().NotifyDataRecv(senderNetworkId, payload, dataLen2);
753     EXPECT_NE(payload[0] & DMS_0X0F, sizeof(uint32_t));
754     DTEST_LOG << "DMSContinueManagerTest testNotifyDataRecv001 end" << std::endl;
755 }
756 
757 /**
758  * @tc.name: testSendSoftbusEvent001
759  * @tc.desc: SendSoftbusEvent
760  * @tc.type: FUNC
761  */
762 HWTEST_F(DMSContinueManagerTest, testSendSoftbusEvent001, TestSize.Level1)
763 {
764     DTEST_LOG << "DMSContinueManagerTest testSendSoftbusEvent001 start" << std::endl;
765     uint16_t bundleNameId = 0;
766     uint8_t continueType = 1;
767     uint8_t type = 0;
768     bool ret = DMSContinueSendMgr::GetInstance().SendSoftbusEvent(bundleNameId, continueType, type);
769     EXPECT_NE(ret, CAN_NOT_FOUND_ABILITY_ERR);
770     DTEST_LOG << "DMSContinueManagerTest testSendSoftbusEvent001 end" << std::endl;
771 }
772 
773 /**
774  * @tc.name: testNotifyDeviceOnline001
775  * @tc.desc: NotifyDeviceOnline
776  * @tc.type: FUNC
777  */
778 HWTEST_F(DMSContinueManagerTest, testNotifyDeviceOnline001, TestSize.Level1)
779 {
780     DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOnline001 start" << std::endl;
781     int32_t ret = DMSContinueSendMgr::GetInstance().NotifyDeviceOnline();
782     EXPECT_EQ(ret, ERR_OK);
783     DTEST_LOG << "DMSContinueManagerTest testNotifyDeviceOnline001 end" << std::endl;
784 }
785 
786 /**
787  * @tc.name: testGetAbilityNameByMissionId_001
788  * @tc.desc: test GetAbilityNameByMissionId
789  * @tc.type: FUNC
790  */
791 HWTEST_F(DMSContinueManagerTest, testGetAbilityNameByMissionId_001, TestSize.Level1)
792 {
793     DTEST_LOG << "DMSContinueManagerTest testGetAbilityNameByMissionId_001 start" << std::endl;
794     DMSContinueSendMgr::GetInstance().focusedMissionAbility_[MISSIONID_01] = ABILITY_NAME_01;
795     std::string abilityName;
796     int32_t ret = DMSContinueSendMgr::GetInstance().GetAbilityNameByMissionId(MISSIONID_01, abilityName);
797     EXPECT_EQ(abilityName, ABILITY_NAME_01);
798     EXPECT_EQ(ret, ERR_OK);
799     DTEST_LOG << "DMSContinueManagerTest testGetAbilityNameByMissionId_001 end" << std::endl;
800 }
801 
802 /**
803  * @tc.name: testFocusedBusinessSendEvent_001
804  * @tc.desc: test FocusedBusinessSendEvent
805  * @tc.type: FUNC
806  */
807 HWTEST_F(DMSContinueManagerTest, testFocusedBusinessSendEvent_001, TestSize.Level1)
808 {
809     DTEST_LOG << "DMSContinueManagerTest testFocusedBusinessSendEvent_001 start" << std::endl;
810     int32_t ret = DMSContinueSendMgr::GetInstance().FocusedBusinessSendEvent(BUNDLENAME_01, ABILITY_NAME_01);
811 
812     EXPECT_EQ(ret, CAN_NOT_FOUND_ABILITY_ERR);
813     DTEST_LOG << "DMSContinueManagerTest testFocusedBusinessSendEvent_001 end" << std::endl;
814 }
815 
816 /**
817  * @tc.name: testGetBundleNameIdAndContinueTypeId_001
818  * @tc.desc: test GetBundleNameIdAndContinueTypeId
819  * @tc.type: FUNC
820  */
821 HWTEST_F(DMSContinueManagerTest, testGetBundleNameIdAndContinueTypeId_001, TestSize.Level1)
822 {
823     DTEST_LOG << "DMSContinueManagerTest testGetBundleNameIdAndContinueTypeId_001 start" << std::endl;
824     DMSContinueSendMgr::GetInstance().focusedMission_[BUNDLENAME_01] = MISSIONID_01;
825     DMSContinueSendMgr::GetInstance().focusedMissionAbility_[MISSIONID_01] = ABILITY_NAME_01;
826     uint16_t bundleNameId = 0;
827     uint8_t continueTypeId = 0;
828     OHOS::AAFwk::ContinueState state = OHOS::AAFwk::ContinueState::CONTINUESTATE_ACTIVE;
829     int32_t ret = DMSContinueSendMgr::GetInstance().GetBundleNameIdAndContinueTypeId(MISSIONID_01, state,
830         bundleNameId, continueTypeId);
831 
832     EXPECT_EQ(ret, REMOTE_DEVICE_BIND_ABILITY_ERR);
833     DTEST_LOG << "DMSContinueManagerTest testGetBundleNameIdAndContinueTypeId_001 end" << std::endl;
834 }
835 
836 /**
837  * @tc.name: testGetContinueType_001
838  * @tc.desc: test GetContinueType
839  * @tc.type: FUNC
840  */
841 HWTEST_F(DMSContinueManagerTest, testGetContinueType_001, TestSize.Level1)
842 {
843     DTEST_LOG << "DMSContinueManagerTest testGetContinueType_001 start" << std::endl;
844     int32_t state = ACTIVE;
845     std::string networkId = "test networkId";
846     std::string sourceBundleName = "test sourceBundleName";
847     std::string sinkBundleName = "test sinkBundleName";
848     std::string continueType = "test continueType";
849     int32_t ret = DMSContinueRecvMgr::GetInstance().VerifyBroadcastSource(networkId,
850         sourceBundleName, sinkBundleName, continueType, state);
851     EXPECT_EQ(ret, ERR_OK);
852 
853     EXPECT_FALSE(DMSContinueRecvMgr::GetInstance().GetContinueType(sinkBundleName).empty());
854     DTEST_LOG << "DMSContinueManagerTest testGetContinueType_001 end" << std::endl;
855 }
856 
857 /**
858  * @tc.name: testSetScreenOffInfo_001
859  * @tc.desc: test SetScreenOffInfo
860  * @tc.type: FUNC
861  */
862 HWTEST_F(DMSContinueManagerTest, testSetScreenOffInfo_001, TestSize.Level1)
863 {
864     DTEST_LOG << "DMSContinueManagerTest testSetScreenOffInfo_001 start" << std::endl;
865     int32_t missionId = 0;
866     std::string bundleName = "bundleName";
867     uint16_t bundleNameId = 0;
868     std::string abilityName = "abilityName";
869     DMSContinueSendMgr::GetInstance().screenOffHandler_ = std::make_shared<DMSContinueSendMgr::ScreenOffHandler>();
870     DMSContinueSendMgr::GetInstance().screenOffHandler_->SetScreenOffInfo(missionId, bundleName,
871         bundleNameId, abilityName);
872     EXPECT_EQ(DMSContinueSendMgr::GetInstance().screenOffHandler_->unfoInfo_.abilityName.empty(), false);
873 
874     DMSContinueSendMgr::GetInstance().screenOffHandler_->ClearScreenOffInfo();
875     EXPECT_EQ(DMSContinueSendMgr::GetInstance().screenOffHandler_->unfoInfo_.abilityName.empty(), true);
876     DTEST_LOG << "DMSContinueManagerTest testSetScreenOffInfo_001 end" << std::endl;
877 }
878 
879 /**
880  * @tc.name: testSetStateSendEvent_001
881  * @tc.desc: test SetStateSendEvent
882  * @tc.type: FUNC
883  */
884 HWTEST_F(DMSContinueManagerTest, testSetStateSendEvent_001, TestSize.Level1)
885 {
886     DTEST_LOG << "DMSContinueManagerTest testSetStateSendEvent_001 start" << std::endl;
887     int32_t ret = DMSContinueSendMgr::GetInstance().SetStateSendEvent(0, 0,
888         AAFwk::ContinueState::CONTINUESTATE_INACTIVE);
889     EXPECT_NE(ret, DMS_PERMISSION_DENIED);
890 
891     ret = DMSContinueSendMgr::GetInstance().SetStateSendEvent(0, 0, AAFwk::ContinueState::CONTINUESTATE_ACTIVE);
892     EXPECT_NE(ret, DMS_PERMISSION_DENIED);
893     DTEST_LOG << "DMSContinueManagerTest testSetStateSendEvent_001 end" << std::endl;
894 }
895 
896 /**
897  * @tc.name: testGetContinueLaunchMissionInfo_001
898  * @tc.desc: test GetContinueLaunchMissionInfo
899  * @tc.type: FUNC
900  */
901 HWTEST_F(DMSContinueManagerTest, testGetContinueLaunchMissionInfo_001, TestSize.Level1)
902 {
903     DTEST_LOG << "DMSContinueManagerTest testGetContinueLaunchMissionInfo_001 start" << std::endl;
904     ContinueLaunchMissionInfo missionInfo = {"com.test.missionInfo", "MainAbility"};
905     DMSContinueSendMgr::GetInstance().continueLaunchMission_.clear();
906     int32_t ret = DMSContinueSendMgr::GetInstance().GetContinueLaunchMissionInfo(MISSIONID_01, missionInfo);
907     EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
908 
909     DMSContinueSendMgr::GetInstance().continueLaunchMission_[missionInfo] = MISSIONID_01;
910     ret = DMSContinueSendMgr::GetInstance().GetContinueLaunchMissionInfo(MISSIONID_01, missionInfo);
911     EXPECT_EQ(ret, ERR_OK);
912     DTEST_LOG << "DMSContinueManagerTest testGetContinueLaunchMissionInfo_001 end" << std::endl;
913 }
914 
915 /**
916  * @tc.name: testUpdateContinueLaunchMission_001
917  * @tc.desc: test UpdateContinueLaunchMission
918  * @tc.type: FUNC
919  */
920 HWTEST_F(DMSContinueManagerTest, testUpdateContinueLaunchMission_001, TestSize.Level1)
921 {
922     DTEST_LOG << "DMSContinueManagerTest testUpdateContinueLaunchMission_001 start" << std::endl;
923     AAFwk::Want want;
924     AppExecFwk::ElementName element("", "com.test.demo", "MainAbility", "");
925     want.SetElement(element);
926 
927     AAFwk::MissionInfo info;
928     info.id = MISSIONID_01;
929     info.want = want;
930     EXPECT_FALSE(DMSContinueSendMgr::GetInstance().UpdateContinueLaunchMission(info));
931 
932     info.want.SetFlags(AAFwk::Want::FLAG_ABILITY_CONTINUATION);
933     EXPECT_TRUE(DMSContinueSendMgr::GetInstance().UpdateContinueLaunchMission(info));
934 
935     info.id = MISSIONID_02;
936     EXPECT_TRUE(DMSContinueSendMgr::GetInstance().UpdateContinueLaunchMission(info));
937     DTEST_LOG << "DMSContinueManagerTest testUpdateContinueLaunchMission_001 end" << std::endl;
938 }
939 } // namespace DistributedSchedule
940 } // namespace OHOS