• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 <gtest/gtest.h>
17 #include <regex>
18 #include <bundle_mgr_interface.h>
19 #include <bundlemgr/launcher_service.h>
20 #include "interfaces/include/ws_common.h"
21 #include "libxml/parser.h"
22 #include "libxml/tree.h"
23 #include "session_manager/include/scene_session_manager.h"
24 #include "session_info.h"
25 #include "session/host/include/scene_session.h"
26 #include "session/host/include/main_session.h"
27 #include "window_manager_agent.h"
28 #include "session_manager.h"
29 #include "zidl/window_manager_agent_interface.h"
30 #include "mock/mock_session_stage.h"
31 #include "mock/mock_window_event_channel.h"
32 #include "context.h"
33 #include "iremote_object_mocker.h"
34 
35 using namespace testing;
36 using namespace testing::ext;
37 
38 namespace OHOS {
39 namespace Rosen {
40 namespace {
41 const std::string EMPTY_DEVICE_ID = "";
42 constexpr int WAIT_SLEEP_TIME = 1;
43 using ConfigItem = WindowSceneConfig::ConfigItem;
ReadConfig(const std::string & xmlStr)44 ConfigItem ReadConfig(const std::string& xmlStr)
45 {
46     ConfigItem config;
47     xmlDocPtr docPtr = xmlParseMemory(xmlStr.c_str(), xmlStr.length() + 1);
48     if (docPtr == nullptr) {
49         return config;
50     }
51 
52     xmlNodePtr rootPtr = xmlDocGetRootElement(docPtr);
53     if (rootPtr == nullptr || rootPtr->name == nullptr ||
54         xmlStrcmp(rootPtr->name, reinterpret_cast<const xmlChar*>("Configs"))) {
55         xmlFreeDoc(docPtr);
56         return config;
57     }
58 
59     std::map<std::string, ConfigItem> configMap;
60     config.SetValue(configMap);
61     WindowSceneConfig::ReadConfig(rootPtr, *config.mapValue_);
62     xmlFreeDoc(docPtr);
63     return config;
64 }
65 }
66 class SceneSessionManagerTest2 : public testing::Test {
67 public:
68     static void SetUpTestCase();
69     static void TearDownTestCase();
70     void SetUp() override;
71     void TearDown() override;
72 
73     static bool gestureNavigationEnabled_;
74     static ProcessGestureNavigationEnabledChangeFunc callbackFunc_;
75     static sptr<SceneSessionManager> ssm_;
76 
77 private:
78     static constexpr uint32_t WAIT_SYNC_IN_NS = 200000;
79 };
80 
81 sptr<SceneSessionManager> SceneSessionManagerTest2::ssm_ = nullptr;
82 
83 bool SceneSessionManagerTest2::gestureNavigationEnabled_ = true;
84 ProcessGestureNavigationEnabledChangeFunc SceneSessionManagerTest2::callbackFunc_ = [](bool enable,
__anonc0fa1dd60202(bool enable, const std::string& bundleName, GestureBackType type) 85     const std::string& bundleName, GestureBackType type) {
86     gestureNavigationEnabled_ = enable;
87 };
88 
WindowChangedFuncTest(int32_t persistentId,WindowUpdateType type)89 void WindowChangedFuncTest(int32_t persistentId, WindowUpdateType type)
90 {
91 }
92 
ProcessStatusBarEnabledChangeFuncTest(bool enable)93 void ProcessStatusBarEnabledChangeFuncTest(bool enable)
94 {
95 }
96 
DumpRootSceneElementInfoFuncTest(const std::vector<std::string> & params,std::vector<std::string> & infos)97 void DumpRootSceneElementInfoFuncTest(const std::vector<std::string>& params, std::vector<std::string>& infos)
98 {
99 }
100 
SetUpTestCase()101 void SceneSessionManagerTest2::SetUpTestCase()
102 {
103     ssm_ = &SceneSessionManager::GetInstance();
104 }
105 
TearDownTestCase()106 void SceneSessionManagerTest2::TearDownTestCase()
107 {
108     ssm_ = nullptr;
109 }
110 
SetUp()111 void SceneSessionManagerTest2::SetUp()
112 {
113     ssm_->sceneSessionMap_.clear();
114 }
115 
TearDown()116 void SceneSessionManagerTest2::TearDown()
117 {
118     usleep(WAIT_SYNC_IN_NS);
119     ssm_->sceneSessionMap_.clear();
120 }
121 
122 namespace {
123 /**
124  * @tc.name: SetGestureNavigationEnabled
125  * @tc.desc: SceneSessionManager set gesture navigation enabled
126  * @tc.type: FUNC
127  */
128 HWTEST_F(SceneSessionManagerTest2, SetGestureNavigationEnabled, Function | SmallTest | Level3)
129 {
130     ASSERT_NE(callbackFunc_, nullptr);
131 
132     WMError result00 = ssm_->SetGestureNavigationEnabled(true);
133     ASSERT_EQ(result00, WMError::WM_OK);
134 
135     ssm_->SetGestureNavigationEnabledChangeListener(callbackFunc_);
136     WMError result01 = ssm_->SetGestureNavigationEnabled(true);
137     ASSERT_EQ(result01, WMError::WM_OK);
138     sleep(WAIT_SLEEP_TIME);
139     ASSERT_EQ(gestureNavigationEnabled_, true);
140 
141     WMError result02 = ssm_->SetGestureNavigationEnabled(false);
142     ASSERT_EQ(result02, WMError::WM_OK);
143     sleep(WAIT_SLEEP_TIME);
144     ASSERT_EQ(gestureNavigationEnabled_, false);
145 
146     ssm_->SetGestureNavigationEnabledChangeListener(nullptr);
147     WMError result03 = ssm_->SetGestureNavigationEnabled(true);
148     ASSERT_EQ(result03, WMError::WM_OK);
149 }
150 
151 /**
152  * @tc.name: RegisterWindowManagerAgent
153  * @tc.desc: SceneSesionManager rigister window manager agent
154  * @tc.type: FUNC
155  */
156 HWTEST_F(SceneSessionManagerTest2, RegisterWindowManagerAgent, Function | SmallTest | Level3)
157 {
158     sptr<IWindowManagerAgent> windowManagerAgent = sptr<WindowManagerAgent>::MakeSptr();
159     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS;
160 
161     ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, ssm_->RegisterWindowManagerAgent(type, windowManagerAgent));
162     ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, ssm_->UnregisterWindowManagerAgent(
163         type, windowManagerAgent));
164 }
165 
166 /**
167  * @tc.name: ConfigWindowSizeLimits01
168  * @tc.desc: call ConfigWindowSizeLimits and check the systemConfig_.
169  * @tc.type: FUNC
170  */
171 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSizeLimits01, Function | SmallTest | Level3)
172 {
173     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
174         "<Configs>"
175         "<mainWindowSizeLimits>"
176         "<miniWidth>10</miniWidth>"
177         "<miniHeight>20</miniHeight>"
178         "</mainWindowSizeLimits>"
179         "<subWindowSizeLimits>"
180         "<miniWidth>30</miniWidth>"
181         "<miniHeight>40</miniHeight>"
182         "</subWindowSizeLimits>"
183         "</Configs>";
184     WindowSceneConfig::config_ = ReadConfig(xmlStr);
185     ssm_->ConfigWindowSizeLimits();
186     ASSERT_EQ(ssm_->systemConfig_.miniWidthOfMainWindow_, static_cast<uint32_t>(10));
187     ASSERT_EQ(ssm_->systemConfig_.miniHeightOfMainWindow_, static_cast<uint32_t>(20));
188     ASSERT_EQ(ssm_->systemConfig_.miniWidthOfSubWindow_, static_cast<uint32_t>(30));
189     ASSERT_EQ(ssm_->systemConfig_.miniHeightOfSubWindow_, static_cast<uint32_t>(40));
190 }
191 
192 /**
193  * @tc.name: ConfigWindowEffect01
194  * @tc.desc: call ConfigWindowEffect all success focused
195  * @tc.type: FUNC
196  */
197 HWTEST_F(SceneSessionManagerTest2, ConfigWindowEffect01, Function | SmallTest | Level3)
198 {
199     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
200         "<Configs>"
201             "<windowEffect>"
202                 "<appWindows>"
203                     "<cornerRadius>"
204                         "<fullScreen>off</fullScreen>"
205                         "<split>off</split>"
206                         "<float>off</float>"
207                     "</cornerRadius>"
208                     "<shadow>"
209                         "<focused>"
210                             "<elevation>0</elevation>"
211                             "<color>#000000</color>"
212                             "<offsetX>1</offsetX>"
213                             "<offsetY>1</offsetY>"
214                             "<alpha>0</alpha>"
215                             "<radius>0.5</radius>"
216                         "</focused>"
217                     "</shadow>"
218                     "<shadowDark>"
219                         "<focused>"
220                             "<elevation>0</elevation>"
221                             "<color>#111111</color>"
222                             "<offsetX>2</offsetX>"
223                             "<offsetY>2</offsetY>"
224                             "<alpha>1</alpha>"
225                             "<radius>1</radius>"
226                         "</focused>"
227                     "</shadowDark>"
228                 "</appWindows>"
229             "</windowEffect>"
230         "</Configs>";
231     WindowSceneConfig::config_ = ReadConfig(xmlStr);
232     ssm_->ConfigWindowSceneXml();
233     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.alpha_, 0);
234     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.offsetX_, 1);
235     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.offsetY_, 1);
236     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.radius_, 0.5);
237     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadowDark_.alpha_, 1);
238     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadowDark_.offsetX_, 2);
239     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadowDark_.offsetY_, 2);
240     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadowDark_.radius_, 1);
241     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadowDark_.color_, "#ff111111");
242 }
243 
244 /**
245  * @tc.name: ConfigWindowEffect02
246  * @tc.desc: call ConfigWindowEffect
247  * @tc.type: FUNC
248  */
249 HWTEST_F(SceneSessionManagerTest2, ConfigWindowEffect02, Function | SmallTest | Level3)
250 {
251     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
252         "<Configs>"
253             "<windowEffect>"
254                 "<appWindows>"
255                     "<cornerRadius>"
256                         "<fullScreen>off</fullScreen>"
257                         "<split>off</split>"
258                     "</cornerRadius>"
259                     "<shadow>"
260                         "<focused>"
261                             "<elevation>0</elevation>"
262                             "<alpha>0</alpha>"
263                         "</focused>"
264                         "<unfocused>"
265                             "<elevation>0</elevation>"
266                         "</unfocused>"
267                     "</shadow>"
268                 "</appWindows>"
269             "</windowEffect>"
270         "</Configs>";
271     WindowSceneConfig::config_ = ReadConfig(xmlStr);
272     ssm_->ConfigWindowSceneXml();
273     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.alpha_, 0);
274 }
275 
276 /**
277  * @tc.name: ConfigWindowEffect03
278  * @tc.desc: call ConfigWindowEffect ConfigAppWindowShadow unfocused
279  * @tc.type: FUNC
280  */
281 HWTEST_F(SceneSessionManagerTest2, ConfigWindowEffect03, Function | SmallTest | Level3)
282 {
283     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
284         "<Configs>"
285             "<windowEffect>"
286                 "<appWindows>"
287                     "<shadow>"
288                         "<unfocused>"
289                             "<elevation>0</elevation>"
290                             "<color>#000000</color>"
291                             "<offsetX>1</offsetX>"
292                             "<offsetY>1</offsetY>"
293                             "<alpha>0</alpha>"
294                             "<radius>0.5</radius>"
295                         "</unfocused>"
296                     "</shadow>"
297                     "<shadowDark>"
298                         "<unfocused>"
299                             "<elevation>0</elevation>"
300                             "<color>#111111</color>"
301                             "<offsetX>2</offsetX>"
302                             "<offsetY>2</offsetY>"
303                             "<alpha>1</alpha>"
304                             "<radius>1</radius>"
305                         "</unfocused>"
306                     "</shadowDark>"
307                 "</appWindows>"
308             "</windowEffect>"
309         "</Configs>";
310     WindowSceneConfig::config_ = ReadConfig(xmlStr);
311     ssm_->ConfigWindowSceneXml();
312     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.alpha_, 0);
313     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetX_, 1);
314     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetY_, 1);
315     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.radius_, 0.5);
316     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadowDark_.alpha_, 1);
317     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadowDark_.offsetX_, 2);
318     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadowDark_.offsetY_, 2);
319     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadowDark_.radius_, 1);
320     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadowDark_.color_, "#ff111111");
321 }
322 
323 /**
324  * @tc.name: ConfigWindowEffect04
325  * @tc.desc: call ConfigWindowEffect all
326  * @tc.type: FUNC
327  */
328 HWTEST_F(SceneSessionManagerTest2, ConfigWindowEffect04, Function | SmallTest | Level3)
329 {
330     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
331         "<Configs>"
332             "<windowEffect>"
333                 "<appWindows>"
334                     "<cornerRadius>"
335                         "<fullScreen>off</fullScreen>"
336                         "<split>off</split>"
337                         "<float>off</float>"
338                     "</cornerRadius>"
339                     "<shadow>"
340                         "<focused>"
341                             "<elevation>0</elevation>"
342                             "<color>#000000</color>"
343                             "<offsetX>1</offsetX>"
344                             "<offsetY>1</offsetY>"
345                             "<alpha>0</alpha>"
346                             "<radius>0.5</radius>"
347                         "</focused>"
348                         "<unfocused>"
349                             "<elevation>0</elevation>"
350                             "<color>#000000</color>"
351                             "<offsetX>1</offsetX>"
352                             "<offsetY>1</offsetY>"
353                             "<alpha>0</alpha>"
354                             "<radius>0.5</radius>"
355                         "</unfocused>"
356                     "</shadow>"
357                 "</appWindows>"
358             "</windowEffect>"
359         "</Configs>";
360     WindowSceneConfig::config_ = ReadConfig(xmlStr);
361     ssm_->ConfigWindowSceneXml();
362     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.alpha_, 0);
363     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.offsetX_, 1);
364     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.offsetY_, 1);
365     ASSERT_EQ(ssm_->appWindowSceneConfig_.focusedShadow_.radius_, 0.5);
366     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.alpha_, 0);
367     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetX_, 1);
368     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetY_, 1);
369     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.radius_, 0.5);
370 }
371 
372 /**
373  * @tc.name: ConfigWindowEffect05
374  * @tc.desc: call ConfigWindowEffect all offsetX.size is not 1
375  * @tc.type: FUNC
376  */
377 HWTEST_F(SceneSessionManagerTest2, ConfigWindowEffect05, Function | SmallTest | Level3)
378 {
379     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
380         "<Configs>"
381             "<windowEffect>"
382                 "<appWindows>"
383                     "<shadow>"
384                         "<focused>"
385                             "<elevation>0</elevation>"
386                             "<offsetX>1</offsetX>"
387                             "<offsetX>2</offsetX>"
388                         "</focused>"
389                         "<unfocused>"
390                             "<elevation>0</elevation>"
391                             "<color>#000000</color>"
392                             "<offsetX>1</offsetX>"
393                             "<offsetY>1</offsetY>"
394                             "<alpha>0</alpha>"
395                             "<radius>0.5</radius>"
396                         "</unfocused>"
397                     "</shadow>"
398                 "</appWindows>"
399             "</windowEffect>"
400         "</Configs>";
401     WindowSceneConfig::config_ = ReadConfig(xmlStr);
402     ssm_->ConfigWindowSceneXml();
403     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.alpha_, 0);
404     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetX_, 1);
405     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetY_, 1);
406     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.radius_, 0.5);
407 }
408 
409 /**
410  * @tc.name: ConfigWindowEffect06
411  * @tc.desc: call ConfigWindowEffect offsetY.size is not 1
412  * @tc.type: FUNC
413  */
414 HWTEST_F(SceneSessionManagerTest2, ConfigWindowEffect06, Function | SmallTest | Level3)
415 {
416     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
417         "<Configs>"
418             "<windowEffect>"
419                 "<appWindows>"
420                     "<shadow>"
421                         "<focused>"
422                             "<elevation>0</elevation>"
423                             "<offsetY>1</offsetY>"
424                             "<offsetY>2</offsetY>"
425                         "</focused>"
426                         "<unfocused>"
427                             "<elevation>0</elevation>"
428                             "<color>#000000</color>"
429                             "<offsetX>1</offsetX>"
430                             "<offsetY>1</offsetY>"
431                             "<alpha>0</alpha>"
432                             "<radius>0.5</radius>"
433                         "</unfocused>"
434                     "</shadow>"
435                 "</appWindows>"
436             "</windowEffect>"
437         "</Configs>";
438     WindowSceneConfig::config_ = ReadConfig(xmlStr);
439     ssm_->ConfigWindowSceneXml();
440     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.alpha_, 0);
441     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetX_, 1);
442     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetY_, 1);
443     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.radius_, 0.5);
444 }
445 
446 /**
447  * @tc.name: ConfigWindowEffect07
448  * @tc.desc: call ConfigWindowEffect alpha.size is not 1
449  * @tc.type: FUNC
450  */
451 HWTEST_F(SceneSessionManagerTest2, ConfigWindowEffect07, Function | SmallTest | Level3)
452 {
453     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
454         "<Configs>"
455             "<windowEffect>"
456                 "<appWindows>"
457                     "<shadow>"
458                         "<focused>"
459                             "<elevation>0</elevation>"
460                             "<alpha>1</alpha>"
461                             "<alpha>2</alpha>"
462                         "</focused>"
463                         "<unfocused>"
464                             "<elevation>0</elevation>"
465                             "<color>#000000</color>"
466                             "<offsetX>1</offsetX>"
467                             "<offsetY>1</offsetY>"
468                             "<alpha>0</alpha>"
469                             "<radius>0.5</radius>"
470                         "</unfocused>"
471                     "</shadow>"
472                 "</appWindows>"
473             "</windowEffect>"
474         "</Configs>";
475     WindowSceneConfig::config_ = ReadConfig(xmlStr);
476     ssm_->ConfigWindowSceneXml();
477     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.alpha_, 0);
478     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetX_, 1);
479     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetY_, 1);
480     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.radius_, 0.5);
481 }
482 
483 /**
484  * @tc.name: ConfigWindowEffect08
485  * @tc.desc: call ConfigWindowEffect radius.size is not 1
486  * @tc.type: FUNC
487  */
488 HWTEST_F(SceneSessionManagerTest2, ConfigWindowEffect08, Function | SmallTest | Level3)
489 {
490     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
491         "<Configs>"
492             "<windowEffect>"
493                 "<appWindows>"
494                     "<shadow>"
495                         "<focused>"
496                             "<elevation>0</elevation>"
497                             "<radius>1</radius>"
498                             "<radius>2</radius>"
499                         "</focused>"
500                         "<unfocused>"
501                             "<elevation>0</elevation>"
502                             "<color>#000000</color>"
503                             "<offsetX>1</offsetX>"
504                             "<offsetY>1</offsetY>"
505                             "<alpha>0</alpha>"
506                             "<radius>0.5</radius>"
507                         "</unfocused>"
508                     "</shadow>"
509                 "</appWindows>"
510             "</windowEffect>"
511         "</Configs>";
512     WindowSceneConfig::config_ = ReadConfig(xmlStr);
513     ssm_->ConfigWindowSceneXml();
514     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.alpha_, 0);
515     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetX_, 1);
516     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.offsetY_, 1);
517     ASSERT_EQ(ssm_->appWindowSceneConfig_.unfocusedShadow_.radius_, 0.5);
518 }
519 
520 /**
521  * @tc.name: ConfigDecor
522  * @tc.desc: call ConfigDecor fullscreen
523  * @tc.type: FUNC
524  */
525 HWTEST_F(SceneSessionManagerTest2, ConfigDecor01, Function | SmallTest | Level3)
526 {
527     std::string xmlStr1 = "<?xml version='1.0' encoding=\"utf-8\"?>"
528         "<Configs>"
529         "<decor enable=\"111\">"
530         "<supportedMode>fullscreen</supportedMode>"
531         "</decor>"
532         "</Configs>";
533     WindowSceneConfig::config_ = ReadConfig(xmlStr1);
534     ssm_->ConfigWindowSceneXml();
535 
536     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
537         "<Configs>"
538         "<decor enable=\"true\">"
539         "<supportedMode>fullscreen</supportedMode>"
540         "</decor>"
541         "</Configs>";
542     WindowSceneConfig::config_ = ReadConfig(xmlStr);
543     ssm_->ConfigWindowSceneXml();
544     ASSERT_EQ(ssm_->systemConfig_.decorWindowModeSupportType_,
545         static_cast<uint32_t>(WindowModeSupport::WINDOW_MODE_SUPPORT_FULLSCREEN));
546 }
547 
548 /**
549  * @tc.name: ConfigDecor
550  * @tc.desc: call ConfigDecor
551  * @tc.type: FUNC
552  */
553 HWTEST_F(SceneSessionManagerTest2, ConfigDecor02, Function | SmallTest | Level3)
554 {
555     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
556         "<Configs>"
557         "<decor enable=\"true\">"
558         "</decor>"
559         "</Configs>";
560     WindowSceneConfig::config_ = ReadConfig(xmlStr);
561     ssm_->ConfigWindowSceneXml();
562     ASSERT_EQ(ssm_->systemConfig_.decorWindowModeSupportType_,
563         WindowModeSupport::WINDOW_MODE_SUPPORT_FULLSCREEN);
564 }
565 
566 /**
567  * @tc.name: ConfigDecor
568  * @tc.desc: call ConfigDecor floating
569  * @tc.type: FUNC
570  */
571 HWTEST_F(SceneSessionManagerTest2, ConfigDecor03, Function | SmallTest | Level3)
572 {
573     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
574         "<Configs>"
575         "<decor enable=\"true\">"
576         "<supportedMode>floating</supportedMode>"
577         "</decor>"
578         "</Configs>";
579     WindowSceneConfig::config_ = ReadConfig(xmlStr);
580     ssm_->ConfigWindowSceneXml();
581     ASSERT_EQ(ssm_->systemConfig_.decorWindowModeSupportType_,
582         WindowModeSupport::WINDOW_MODE_SUPPORT_FLOATING);
583 }
584 
585 /**
586  * @tc.name: ConfigDecor
587  * @tc.desc: call ConfigDecor pip
588  * @tc.type: FUNC
589  */
590 HWTEST_F(SceneSessionManagerTest2, ConfigDecor04, Function | SmallTest | Level3)
591 {
592     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
593         "<Configs>"
594         "<decor enable=\"true\">"
595         "<supportedMode>pip</supportedMode>"
596         "</decor>"
597         "</Configs>";
598     WindowSceneConfig::config_ = ReadConfig(xmlStr);
599     ssm_->ConfigWindowSceneXml();
600     ASSERT_EQ(ssm_->systemConfig_.decorWindowModeSupportType_,
601         WindowModeSupport::WINDOW_MODE_SUPPORT_PIP);
602 }
603 
604 /**
605  * @tc.name: ConfigDecor
606  * @tc.desc: call ConfigDecor split
607  * @tc.type: FUNC
608  */
609 HWTEST_F(SceneSessionManagerTest2, ConfigDecor05, Function | SmallTest | Level3)
610 {
611     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
612         "<Configs>"
613         "<decor enable=\"true\">"
614         "<supportedMode>split</supportedMode>"
615         "</decor>"
616         "</Configs>";
617     WindowSceneConfig::config_ = ReadConfig(xmlStr);
618     ssm_->ConfigWindowSceneXml();
619     ASSERT_EQ(ssm_->systemConfig_.decorWindowModeSupportType_,
620         WindowModeSupport::WINDOW_MODE_SUPPORT_SPLIT_PRIMARY |
621         WindowModeSupport::WINDOW_MODE_SUPPORT_SPLIT_SECONDARY);
622 }
623 
624 /**
625  * @tc.name: ConfigDecor
626  * @tc.desc: call ConfigDecor default
627  * @tc.type: FUNC
628  */
629 HWTEST_F(SceneSessionManagerTest2, ConfigDecor06, Function | SmallTest | Level3)
630 {
631     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
632         "<Configs>"
633         "<decor enable=\"true\">"
634         "<supportedMode>111</supportedMode>"
635         "</decor>"
636         "</Configs>";
637     WindowSceneConfig::config_ = ReadConfig(xmlStr);
638     ssm_->ConfigWindowSceneXml();
639     ASSERT_EQ(ssm_->systemConfig_.decorWindowModeSupportType_,
640         WINDOW_MODE_SUPPORT_ALL);
641 }
642 
643 /**
644  * @tc.name: ConfigWindowSceneXml01
645  * @tc.desc: call defaultWindowMode
646  * @tc.type: FUNC
647  */
648 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSceneXml01, Function | SmallTest | Level3)
649 {
650     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
651         "<Configs>"
652         "<defaultWindowMode>10</defaultWindowMode>"
653         "</Configs>";
654     WindowSceneConfig::config_ = ReadConfig(xmlStr);
655     ssm_->ConfigWindowSceneXml();
656 
657     std::string xmlStr1 = "<?xml version='1.0' encoding=\"utf-8\"?>"
658         "<Configs>"
659         "<defaultWindowMode>102</defaultWindowMode>"
660         "</Configs>";
661     WindowSceneConfig::config_ = ReadConfig(xmlStr1);
662     ssm_->ConfigWindowSceneXml();
663     ASSERT_EQ(ssm_->systemConfig_.defaultWindowMode_,
664         static_cast<WindowMode>(static_cast<uint32_t>(102)));
665 }
666 
667 /**
668  * @tc.name: ConfigWindowSceneXml02
669  * @tc.desc: call defaultWindowMode
670  * @tc.type: FUNC
671  */
672 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSceneXml02, Function | SmallTest | Level3)
673 {
674     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
675         "<Configs>"
676         "<defaultWindowMode>1 1</defaultWindowMode>"
677         "<uiType>phone</uiType>"
678         "<backgroundScreenLock enable=\"true\"></backgroundScreenLock>"
679         "<rotationMode>windowRotation</rotationMode>"
680         "<supportTypeFloatWindow enable=\"true\"></supportTypeFloatWindow>"
681         "</Configs>";
682     WindowSceneConfig::config_ = ReadConfig(xmlStr);
683     ssm_->ConfigWindowSceneXml();
684 
685     std::string xmlStr1 = "<?xml version='1.0' encoding=\"utf-8\"?>"
686         "<Configs>"
687         "<defaultWindowMode>1</defaultWindowMode>"
688         "</Configs>";
689     WindowSceneConfig::config_ = ReadConfig(xmlStr1);
690     ssm_->ConfigWindowSceneXml();
691     ASSERT_EQ(ssm_->systemConfig_.defaultWindowMode_,
692         static_cast<WindowMode>(static_cast<uint32_t>(1)));
693 }
694 
695 /**
696  * @tc.name: ConfigWindowSceneXml03
697  * @tc.desc: call defaultMaximizeMode
698  * @tc.type: FUNC
699  */
700 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSceneXml03, Function | SmallTest | Level3)
701 {
702     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
703         "<Configs>"
704         "<defaultMaximizeMode>1 1</defaultMaximizeMode>"
705         "</Configs>";
706     WindowSceneConfig::config_ = ReadConfig(xmlStr);
707     ssm_->ConfigWindowSceneXml();
708 
709     std::string xmlStr1 = "<?xml version='1.0' encoding=\"utf-8\"?>"
710         "<Configs>"
711         "<defaultMaximizeMode>1</defaultMaximizeMode>"
712         "</Configs>";
713     WindowSceneConfig::config_ = ReadConfig(xmlStr1);
714     ssm_->ConfigWindowSceneXml();
715     ASSERT_EQ(SceneSession::maximizeMode_,
716         static_cast<MaximizeMode>(static_cast<uint32_t>(1)));
717 }
718 
719 /**
720  * @tc.name: ConfigWindowSceneXml04
721  * @tc.desc: call defaultMaximizeMode
722  * @tc.type: FUNC
723  */
724 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSceneXml04, Function | SmallTest | Level3)
725 {
726     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
727         "<Configs>"
728         "<defaultMaximizeMode>111</defaultMaximizeMode>"
729         "</Configs>";
730     WindowSceneConfig::config_ = ReadConfig(xmlStr);
731     ssm_->ConfigWindowSceneXml();
732 
733     std::string xmlStr1 = "<?xml version='1.0' encoding=\"utf-8\"?>"
734         "<Configs>"
735         "<defaultMaximizeMode>0</defaultMaximizeMode>"
736         "</Configs>";
737     WindowSceneConfig::config_ = ReadConfig(xmlStr1);
738     ssm_->ConfigWindowSceneXml();
739     ASSERT_EQ(SceneSession::maximizeMode_,
740         static_cast<MaximizeMode>(static_cast<uint32_t>(0)));
741 }
742 
743 /**
744  * @tc.name: ConfigWindowSceneXml05
745  * @tc.desc: call maxFloatingWindowSize
746  * @tc.type: FUNC
747  */
748 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSceneXml05, Function | SmallTest | Level3)
749 {
750     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
751         "<Configs>"
752         "<maxFloatingWindowSize>1</maxFloatingWindowSize>"
753         "</Configs>";
754     WindowSceneConfig::config_ = ReadConfig(xmlStr);
755     ssm_->ConfigWindowSceneXml();
756 
757     std::string xmlStr1 = "<?xml version='1.0' encoding=\"utf-8\"?>"
758         "<Configs>"
759         "<maxFloatingWindowSize>1</maxFloatingWindowSize>"
760         "</Configs>";
761     WindowSceneConfig::config_ = ReadConfig(xmlStr1);
762     ssm_->ConfigWindowSceneXml();
763     ASSERT_EQ(ssm_->systemConfig_.maxFloatingWindowSize_,
764         static_cast<uint32_t>(1));
765 }
766 
767 /**
768  * @tc.name: ConfigWindowSceneXml07
769  * @tc.desc: call backgroundScreenLock
770  * @tc.type: FUNC
771  */
772 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSceneXml07, Function | SmallTest | Level3)
773 {
774     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
775         "<Configs>"
776         "<backgroundScreenLock enable=\"true\"></backgroundScreenLock>"
777         "</Configs>";
778     WindowSceneConfig::config_ = ReadConfig(xmlStr);
779     ssm_->ConfigWindowSceneXml();
780     ASSERT_EQ(ssm_->appWindowSceneConfig_.backgroundScreenLock_, true);
781 }
782 
783 /**
784  * @tc.name: ConfigWindowSceneXml08
785  * @tc.desc: call rotationMode
786  * @tc.type: FUNC
787  */
788 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSceneXml08, Function | SmallTest | Level3)
789 {
790     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
791         "<Configs>"
792         "<rotationMode>rotation</rotationMode>"
793         "</Configs>";
794     WindowSceneConfig::config_ = ReadConfig(xmlStr);
795     ssm_->ConfigWindowSceneXml();
796     ASSERT_EQ(ssm_->appWindowSceneConfig_.rotationMode_, "rotation");
797 }
798 
799 /**
800  * @tc.name: ConfigWindowAnimation01
801  * @tc.desc: call ConfigWindowAnimation default
802  * @tc.type: FUNC
803  */
804 HWTEST_F(SceneSessionManagerTest2, ConfigWindowAnimation01, Function | SmallTest | Level3)
805 {
806     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
807         "<Configs>"
808             "<windowAnimation>"
809                 "<timing>"
810                     "<duration>350</duration>"
811                     "<curve name=\"easeOut\"></curve>"
812                 "</timing>"
813                 "<scale>0.7 0.7</scale>"
814                 "<rotation>0 0 1 0</rotation>"
815                 "<translate>0 0</translate>"
816                 "<opacity>0</opacity>"
817             "</windowAnimation>"
818         "</Configs>";
819     WindowSceneConfig::config_ = ReadConfig(xmlStr);
820     ssm_->ConfigWindowSceneXml();
821     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.duration_, 350);
822     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.scaleX_, static_cast<float>(0.7));
823     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.scaleY_, static_cast<float>(0.7));
824     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationX_, 0);
825     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationY_, 0);
826     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationZ_, 1);
827     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.angle_, 0);
828     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.translateX_, 0);
829     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.translateY_, 0);
830     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.opacity_, 0);
831 }
832 
833 /**
834  * @tc.name: ConfigWindowAnimation02
835  * @tc.desc: call ConfigWindowAnimation no change
836  * @tc.type: FUNC
837  */
838 HWTEST_F(SceneSessionManagerTest2, ConfigWindowAnimation02, Function | SmallTest | Level3)
839 {
840     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
841         "<Configs>"
842             "<windowAnimation>"
843                 "<timing>"
844                     "<duration>350</duration>"
845                     "<curve name=\"easeOut\"></curve>"
846                 "</timing>"
847             "</windowAnimation>"
848         "</Configs>";
849     WindowSceneConfig::config_ = ReadConfig(xmlStr);
850     ssm_->ConfigWindowSceneXml();
851     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.duration_, 350);
852 }
853 
854 /**
855  * @tc.name: ConfigWindowAnimation03
856  * @tc.desc: call ConfigWindowAnimation no timing
857  * @tc.type: FUNC
858  */
859 HWTEST_F(SceneSessionManagerTest2, ConfigWindowAnimation03, Function | SmallTest | Level3)
860 {
861     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
862         "<Configs>"
863             "<windowAnimation>"
864                 "<timing>"
865                 "</timing>"
866                 "<scale>0.7 0.7</scale>"
867                 "<rotation>0 0 1 0</rotation>"
868                 "<translate>0 0</translate>"
869                 "<opacity>0</opacity>"
870             "</windowAnimation>"
871         "</Configs>";
872     WindowSceneConfig::config_ = ReadConfig(xmlStr);
873     ssm_->ConfigWindowSceneXml();
874     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.scaleX_, static_cast<float>(0.7));
875     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.scaleY_, static_cast<float>(0.7));
876     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationX_, 0);
877     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationY_, 0);
878     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationZ_, 1);
879     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.angle_, 0);
880     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.translateX_, 0);
881     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.translateY_, 0);
882     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.opacity_, 0);
883 }
884 
885 /**
886  * @tc.name: ConfigWindowAnimation04
887  * @tc.desc: call ConfigWindowAnimation default timing is not int
888  * @tc.type: FUNC
889  */
890 HWTEST_F(SceneSessionManagerTest2, ConfigWindowAnimation04, Function | SmallTest | Level3)
891 {
892     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
893         "<Configs>"
894             "<windowAnimation>"
895                 "<timing>"
896                     "<duration>aaa</duration>"
897                     "<curve></curve>"
898                 "</timing>"
899                 "<scale>0.7 0.7</scale>"
900                 "<rotation>0 0 1 0</rotation>"
901                 "<translate>0 0</translate>"
902                 "<opacity>0</opacity>"
903             "</windowAnimation>"
904         "</Configs>";
905     WindowSceneConfig::config_ = ReadConfig(xmlStr);
906     ssm_->ConfigWindowSceneXml();
907     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.scaleX_, static_cast<float>(0.7));
908     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.scaleY_, static_cast<float>(0.7));
909     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationX_, 0);
910     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationY_, 0);
911     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationZ_, 1);
912     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.angle_, 0);
913     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.translateX_, 0);
914     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.translateY_, 0);
915     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.opacity_, 0);
916 }
917 
918 /**
919  * @tc.name: ConfigWindowAnimation05
920  * @tc.desc: call ConfigWindowAnimation default timing is error size
921  * @tc.type: FUNC
922  */
923 HWTEST_F(SceneSessionManagerTest2, ConfigWindowAnimation05, Function | SmallTest | Level3)
924 {
925     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
926         "<Configs>"
927             "<windowAnimation>"
928                 "<timing>"
929                     "<duration>350 350</duration>"
930                     "<curve></curve>"
931                 "</timing>"
932                 "<scale>0.7 0.7</scale>"
933                 "<rotation>0 0 1 0</rotation>"
934                 "<translate>0 0</translate>"
935                 "<opacity>0</opacity>"
936             "</windowAnimation>"
937         "</Configs>";
938     WindowSceneConfig::config_ = ReadConfig(xmlStr);
939     ssm_->ConfigWindowSceneXml();
940     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.scaleX_, static_cast<float>(0.7));
941     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.scaleY_, static_cast<float>(0.7));
942     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationX_, 0);
943     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationY_, 0);
944     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.rotationZ_, 1);
945     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.angle_, 0);
946     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.translateX_, 0);
947     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.translateY_, 0);
948     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.opacity_, 0);
949 }
950 
951 /**
952  * @tc.name: ConfigWindowAnimation06
953  * @tc.desc: call ConfigWindowAnimation default change is not int
954  * @tc.type: FUNC
955  */
956 HWTEST_F(SceneSessionManagerTest2, ConfigWindowAnimation06, Function | SmallTest | Level3)
957 {
958     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
959         "<Configs>"
960             "<windowAnimation>"
961                 "<timing>"
962                     "<duration>350</duration>"
963                     "<curve name=\"easeOut\"></curve>"
964                 "</timing>"
965                 "<scale>a a</scale>"
966                 "<rotation>a a a a</rotation>"
967                 "<translate>a a</translate>"
968                 "<opacity>a</opacity>"
969             "</windowAnimation>"
970         "</Configs>";
971     WindowSceneConfig::config_ = ReadConfig(xmlStr);
972     ssm_->ConfigWindowSceneXml();
973     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.duration_, 350);
974 }
975 
976 /**
977  * @tc.name: ConfigWindowAnimation07
978  * @tc.desc: call ConfigWindowAnimation default change error size
979  * @tc.type: FUNC
980  */
981 HWTEST_F(SceneSessionManagerTest2, ConfigWindowAnimation07, Function | SmallTest | Level3)
982 {
983     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
984         "<Configs>"
985             "<windowAnimation>"
986                 "<timing>"
987                     "<duration>350</duration>"
988                     "<curve name=\"easeOut\"></curve>"
989                 "</timing>"
990                 "<scale>0.7 0.7 0.7</scale>"
991                 "<rotation>0 0 1 0 1</rotation>"
992                 "<translate>0 0 1</translate>"
993                 "<opacity>0 1</opacity>"
994             "</windowAnimation>"
995         "</Configs>";
996     WindowSceneConfig::config_ = ReadConfig(xmlStr);
997     ssm_->ConfigWindowSceneXml();
998     ASSERT_EQ(ssm_->appWindowSceneConfig_.windowAnimation_.duration_, 350);
999 }
1000 
1001 /**
1002  * @tc.name: ConfigStartingWindowAnimation01
1003  * @tc.desc: call ConfigStartingWindowAnimation default
1004  * @tc.type: FUNC
1005  */
1006 HWTEST_F(SceneSessionManagerTest2, ConfigStartingWindowAnimation01, Function | SmallTest | Level3)
1007 {
1008     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1009         "<Configs>"
1010             "<startWindowTransitionAnimation enable=\"false\">"
1011                 "<timing>"
1012                     "<duration>200</duration>"
1013                     "<curve name=\"linear\"></curve>"
1014                 "</timing>"
1015                 "<opacityStart>1</opacityStart>"
1016                 "<opacityEnd>0</opacityEnd>"
1017             "</startWindowTransitionAnimation>"
1018         "</Configs>";
1019     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1020     ssm_->ConfigWindowSceneXml();
1021     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.enabled_, false);
1022     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.duration_, 200);
1023     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.opacityStart_, 1);
1024     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.opacityEnd_, 0);
1025 }
1026 
1027 /**
1028  * @tc.name: ConfigStartingWindowAnimation02
1029  * @tc.desc: call ConfigStartingWindowAnimation default
1030  * @tc.type: FUNC
1031  */
1032 HWTEST_F(SceneSessionManagerTest2, ConfigStartingWindowAnimation02, Function | SmallTest | Level3)
1033 {
1034     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1035         "<Configs>"
1036             "<startWindowTransitionAnimation enable=\"aaa\">"
1037                 "<timing>"
1038                     "<duration>200</duration>"
1039                     "<curve name=\"linear\"></curve>"
1040                 "</timing>"
1041                 "<opacityStart>1</opacityStart>"
1042                 "<opacityEnd>0</opacityEnd>"
1043             "</startWindowTransitionAnimation>"
1044         "</Configs>";
1045     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1046     ssm_->ConfigWindowSceneXml();
1047     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.duration_, 200);
1048     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.opacityStart_, 1);
1049     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.opacityEnd_, 0);
1050 }
1051 
1052 /**
1053  * @tc.name: ConfigStartingWindowAnimation03
1054  * @tc.desc: call ConfigStartingWindowAnimation default
1055  * @tc.type: FUNC
1056  */
1057 HWTEST_F(SceneSessionManagerTest2, ConfigStartingWindowAnimation03, Function | SmallTest | Level3)
1058 {
1059     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1060         "<Configs>"
1061             "<startWindowTransitionAnimation enable=\"false\">"
1062                 "<timing>"
1063                     "<duration>aaa</duration>"
1064                     "<curve name=\"linear\"></curve>"
1065                 "</timing>"
1066                 "<opacityStart>aaa</opacityStart>"
1067                 "<opacityEnd>aaa</opacityEnd>"
1068             "</startWindowTransitionAnimation>"
1069         "</Configs>";
1070     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1071     ssm_->ConfigWindowSceneXml();
1072     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.enabled_, false);
1073 }
1074 
1075 /**
1076  * @tc.name: ConfigStartingWindowAnimation04
1077  * @tc.desc: call ConfigStartingWindowAnimation default
1078  * @tc.type: FUNC
1079  */
1080 HWTEST_F(SceneSessionManagerTest2, ConfigStartingWindowAnimation04, Function | SmallTest | Level3)
1081 {
1082     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1083         "<Configs>"
1084             "<startWindowTransitionAnimation enable=\"false\">"
1085                 "<timing>"
1086                     "<duration>200 200</duration>"
1087                     "<curve name=\"linear\"></curve>"
1088                 "</timing>"
1089                 "<opacityStart>1 1</opacityStart>"
1090                 "<opacityEnd>0 1</opacityEnd>"
1091             "</startWindowTransitionAnimation>"
1092         "</Configs>";
1093     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1094     ssm_->ConfigWindowSceneXml();
1095     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.enabled_, false);
1096 }
1097 
1098 /**
1099  * @tc.name: ConfigStartingWindowAnimation05
1100  * @tc.desc: call ConfigStartingWindowAnimation default
1101  * @tc.type: FUNC
1102  */
1103 HWTEST_F(SceneSessionManagerTest2, ConfigStartingWindowAnimation05, Function | SmallTest | Level3)
1104 {
1105     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1106         "<Configs>"
1107             "<startWindowTransitionAnimation enable=\"false\">"
1108                 "<timing>"
1109                     "<duration>aaa aaa</duration>"
1110                     "<curve name=\"linear\"></curve>"
1111                 "</timing>"
1112                 "<opacityStart>a a</opacityStart>"
1113                 "<opacityEnd>a a</opacityEnd>"
1114             "</startWindowTransitionAnimation>"
1115         "</Configs>";
1116     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1117     ssm_->ConfigWindowSceneXml();
1118     ASSERT_EQ(ssm_->appWindowSceneConfig_.startingWindowAnimationConfig_.enabled_, false);
1119 }
1120 
1121 /**
1122  * @tc.name: ConfigSnapshotScale01
1123  * @tc.desc: call ConfigSnapshotScale and check the snapshotScale_.
1124  * @tc.type: FUNC
1125  */
1126 HWTEST_F(SceneSessionManagerTest2, ConfigSnapshotScale01, Function | SmallTest | Level3)
1127 {
1128     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1129         "<Configs>"
1130         "<snapshotScale>0.7</snapshotScale>"
1131         "</Configs>";
1132     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1133     ssm_->ConfigSnapshotScale();
1134     ASSERT_EQ(ssm_->snapshotScale_, static_cast<float>(0.7));
1135 }
1136 
1137 /**
1138  * @tc.name: ConfigSnapshotScale02
1139  * @tc.desc: call ConfigSnapshotScale and check the snapshotScale_.
1140  * @tc.type: FUNC
1141  */
1142 HWTEST_F(SceneSessionManagerTest2, ConfigSnapshotScale02, Function | SmallTest | Level3)
1143 {
1144     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1145         "<Configs>"
1146         "<snapshotScale>0.7 0.7</snapshotScale>"
1147         "</Configs>";
1148     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1149     ssm_->ConfigSnapshotScale();
1150     ASSERT_EQ(ssm_->snapshotScale_, 0.7f);
1151 }
1152 
1153 /**
1154  * @tc.name: ConfigSnapshotScale03
1155  * @tc.desc: call ConfigSnapshotScale and check the snapshotScale_.
1156  * @tc.type: FUNC
1157  */
1158 HWTEST_F(SceneSessionManagerTest2, ConfigSnapshotScale03, Function | SmallTest | Level3)
1159 {
1160     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1161         "<Configs>"
1162         "<snapshotScale>aaa</snapshotScale>"
1163         "</Configs>";
1164     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1165     ssm_->ConfigSnapshotScale();
1166     ASSERT_EQ(ssm_->snapshotScale_, 0.7f);
1167 }
1168 
1169 /**
1170  * @tc.name: ConfigSnapshotScale04
1171  * @tc.desc: call ConfigSnapshotScale and check the snapshotScale_.
1172  * @tc.type: FUNC
1173  */
1174 HWTEST_F(SceneSessionManagerTest2, ConfigSnapshotScale04, Function | SmallTest | Level3)
1175 {
1176     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1177         "<Configs>"
1178         "<snapshotScale>-0.1</snapshotScale>"
1179         "</Configs>";
1180     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1181     ssm_->ConfigSnapshotScale();
1182     ASSERT_EQ(ssm_->snapshotScale_, 0.7f);
1183 }
1184 
1185 /**
1186  * @tc.name: ConfigSnapshotScale05
1187  * @tc.desc: call ConfigSnapshotScale and check the snapshotScale_.
1188  * @tc.type: FUNC
1189  */
1190 HWTEST_F(SceneSessionManagerTest2, ConfigSnapshotScale05, Function | SmallTest | Level3)
1191 {
1192     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1193         "<Configs>"
1194         "<snapshotScale>1.5</snapshotScale>"
1195         "</Configs>";
1196     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1197     ssm_->ConfigSnapshotScale();
1198     ASSERT_EQ(ssm_->snapshotScale_, 0.7f);
1199 }
1200 
1201 /**
1202  * @tc.name: ConfigSystemUIStatusBar01
1203  * @tc.desc: call ConfigSystemUIStatusBar default.
1204  * @tc.type: FUNC
1205  */
1206 HWTEST_F(SceneSessionManagerTest2, ConfigSystemUIStatusBar01, Function | SmallTest | Level3)
1207 {
1208     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1209         "<Configs>"
1210             "<systemUIStatusBar>"
1211                 "<showInLandscapeMode>1</showInLandscapeMode>"
1212                 "<immersiveStatusBarBgColor>#4c000000</immersiveStatusBarBgColor>"
1213                 "<immersiveStatusBarContentColor>#ffffee</immersiveStatusBarContentColor>"
1214             "</systemUIStatusBar>"
1215         "</Configs>";
1216     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1217     sptr<SceneSessionManager> sceneSessionManager = sptr<SceneSessionManager>::MakeSptr();
1218     sceneSessionManager->ConfigWindowSceneXml();
1219     ASSERT_EQ(sceneSessionManager->appWindowSceneConfig_.systemUIStatusBarConfig_.showInLandscapeMode_, 1);
1220     ASSERT_STREQ(sceneSessionManager->appWindowSceneConfig_.systemUIStatusBarConfig_.immersiveStatusBarBgColor_.c_str(),
1221         "#4c000000");
1222     ASSERT_STREQ(sceneSessionManager->appWindowSceneConfig_.systemUIStatusBarConfig_.
1223         immersiveStatusBarContentColor_.c_str(), "#ffffee");
1224 }
1225 
1226 /**
1227  * @tc.name: DumpSessionAll
1228  * @tc.desc: ScreenSesionManager dump all session info
1229  * @tc.type: FUNC
1230  */
1231 HWTEST_F(SceneSessionManagerTest2, DumpSessionAll, Function | SmallTest | Level3)
1232 {
1233     SessionInfo sessionInfo;
1234     sessionInfo.bundleName_ = "SceneSessionManagerTest2";
1235     sessionInfo.abilityName_ = "DumpSessionAll";
1236     sptr<WindowSessionProperty> windowSessionProperty = sptr<WindowSessionProperty>::MakeSptr();
1237     sptr<SceneSession> sceneSession = ssm_->RequestSceneSession(sessionInfo, windowSessionProperty);
1238     ASSERT_EQ(nullptr, sceneSession);
1239     std::vector<std::string> infos;
1240     WSError result = ssm_->DumpSessionAll(infos);
1241     ASSERT_EQ(WSError::WS_OK, result);
1242     ASSERT_FALSE(infos.empty());
1243 }
1244 
1245 /**
1246  * @tc.name: DumpSessionWithId
1247  * @tc.desc: ScreenSesionManager dump session with id
1248  * @tc.type: FUNC
1249  */
1250 HWTEST_F(SceneSessionManagerTest2, DumpSessionWithId, Function | SmallTest | Level3)
1251 {
1252     SessionInfo sessionInfo;
1253     sessionInfo.bundleName_ = "SceneSessionManagerTest2";
1254     sessionInfo.abilityName_ = "DumpSessionWithId";
1255     sptr<WindowSessionProperty> windowSessionProperty = sptr<WindowSessionProperty>::MakeSptr();
1256     sptr<SceneSession> sceneSession = ssm_->RequestSceneSession(sessionInfo, windowSessionProperty);
1257     ASSERT_EQ(nullptr, sceneSession);
1258     std::vector<std::string> infos;
1259     WSError result = ssm_->DumpSessionWithId(windowSessionProperty->GetPersistentId(), infos);
1260     ASSERT_EQ(WSError::WS_OK, result);
1261     ASSERT_FALSE(infos.empty());
1262 }
1263 
1264 /**
1265  * @tc.name: Init
1266  * @tc.desc: SceneSesionManager init
1267  * @tc.type: FUNC
1268  */
1269 HWTEST_F(SceneSessionManagerTest2, Init, Function | SmallTest | Level3)
1270 {
1271     int ret = 0;
1272     ssm_->Init();
1273     ssm_->RegisterAppListener();
1274     ASSERT_EQ(ret, 0);
1275 }
1276 
1277 /**
1278  * @tc.name: LoadWindowSceneXml
1279  * @tc.desc: SceneSesionManager load window scene xml
1280  * @tc.type: FUNC
1281  */
1282 HWTEST_F(SceneSessionManagerTest2, LoadWindowSceneXml, Function | SmallTest | Level3)
1283 {
1284     int ret = 0;
1285     ssm_->LoadWindowSceneXml();
1286     ssm_->ConfigWindowSceneXml();
1287     ssm_->SetEnableInputEvent(true);
1288     ssm_->SetEnableInputEvent(false);
1289     ASSERT_EQ(ssm_->IsInputEventEnabled(), false);
1290     ASSERT_EQ(ret, 0);
1291 }
1292 
1293 /**
1294  * @tc.name: UpdateRecoveredSessionInfo
1295  * @tc.desc: SceneSessionManager load window scene xml
1296  * @tc.type: FUNC
1297  */
1298 HWTEST_F(SceneSessionManagerTest2, UpdateRecoveredSessionInfo, Function | SmallTest | Level3)
1299 {
1300     ASSERT_NE(nullptr, ssm_);
1301     std::vector<int32_t> recoveredPersistentIds;
1302     ssm_->UpdateRecoveredSessionInfo(recoveredPersistentIds);
1303     recoveredPersistentIds.push_back(0);
1304     ssm_->UpdateRecoveredSessionInfo(recoveredPersistentIds);
1305     SessionInfo info;
1306     info.abilityName_ = "test1";
1307     info.bundleName_ = "test2";
1308     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1309     ASSERT_NE(sceneSession, nullptr);
1310     ssm_->sceneSessionMap_.insert({0, sceneSession});
1311     ssm_->UpdateRecoveredSessionInfo(recoveredPersistentIds);
1312     ssm_->sceneSessionMap_.erase(0);
1313 }
1314 
1315 /**
1316  * @tc.name: UpdateRecoveredSessionInfo02
1317  * @tc.desc: Test if failRecoverPersistentSet exist or not exist
1318  * @tc.type: FUNC
1319  */
1320 HWTEST_F(SceneSessionManagerTest2, UpdateRecoveredSessionInfo02, Function | SmallTest | Level3)
1321 {
1322     int ret = 0;
1323     ASSERT_NE(ssm_, nullptr);
1324     std::vector<int32_t> recoveredPersistentIds;
1325     recoveredPersistentIds.push_back(0);
1326     recoveredPersistentIds.push_back(1);
1327     SessionInfo info;
1328     info.abilityName_ = "UpdateRecoveredSessionInfo02";
1329     info.bundleName_ = "SceneSessionManagerTest2";
1330     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1331     ASSERT_NE(sceneSession, nullptr);
1332     ssm_->failRecoveredPersistentIdSet_.insert(0);
1333     ssm_->sceneSessionMap_.insert({1, sceneSession});
1334     ssm_->UpdateRecoveredSessionInfo(recoveredPersistentIds);
1335     ssm_->failRecoveredPersistentIdSet_.erase(0);
1336     ssm_->sceneSessionMap_.erase(1);
1337     ASSERT_EQ(ret, 0);
1338 }
1339 
1340 /**
1341  * @tc.name: NotifyCreateSubSession
1342  * @tc.desc: Test if createSubSessionFuncMap_ exist
1343  * @tc.type: FUNC
1344  */
1345 HWTEST_F(SceneSessionManagerTest2, NotifyCreateSubSession, Function | SmallTest | Level3)
1346 {
1347     int ret = 0;
1348     ASSERT_NE(ssm_, nullptr);
1349     SessionInfo info;
1350     info.abilityName_ = "NotifyCreateSubSession";
1351     info.bundleName_ = "SceneSessionManagerTest2";
1352     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1353     ASSERT_NE(sceneSession, nullptr);
1354     NotifyCreateSubSessionFunc func;
1355     ssm_->createSubSessionFuncMap_.insert({1, func});
1356     ssm_->NotifyCreateSubSession(1, sceneSession, 256);
1357     ssm_->createSubSessionFuncMap_.erase(1);
1358     ASSERT_EQ(ret, 0);
1359 }
1360 
1361 /**
1362  * @tc.name: ConfigWindowSceneXml
1363  * @tc.desc: SceneSesionManager config window scene xml run
1364  * @tc.type: FUNC
1365  */
1366 HWTEST_F(SceneSessionManagerTest2, ConfigWindowSceneXml, Function | SmallTest | Level3)
1367 {
1368     int ret = 0;
1369     ssm_->ConfigWindowSceneXml();
1370     ASSERT_EQ(ret, 0);
1371 }
1372 
1373 /**
1374  * @tc.name: SetSessionContinueState
1375  * @tc.desc: SceneSesionManager set session continue state
1376  * @tc.type: FUNC
1377  */
1378 HWTEST_F(SceneSessionManagerTest2, SetSessionContinueState, Function | SmallTest | Level3)
1379 {
1380     MessageParcel *data = new MessageParcel();
1381     sptr <IRemoteObject> token = data->ReadRemoteObject();
1382     auto continueState = static_cast<ContinueState>(data->ReadInt32());
1383     WSError result02 = ssm_->SetSessionContinueState(nullptr, continueState);
1384     WSError result01 = ssm_->SetSessionContinueState(token, continueState);
1385     ASSERT_EQ(result02, WSError::WS_ERROR_INVALID_PARAM);
1386     ASSERT_EQ(result01, WSError::WS_ERROR_INVALID_PARAM);
1387     delete data;
1388 }
1389 
1390 /**
1391  * @tc.name: SetSessionContinueState002
1392  * @tc.desc: SceneSesionManager set session continue state
1393  * @tc.type: FUNC
1394  */
1395 HWTEST_F(SceneSessionManagerTest2, SetSessionContinueState002, Function | SmallTest | Level3)
1396 {
1397     MessageParcel *data = new MessageParcel();
1398     sptr<IRemoteObject> token = data->ReadRemoteObject();
1399     auto continueState = static_cast<ContinueState>(0);
1400     SessionInfo info;
1401     info.abilityName_ = "test1";
1402     info.bundleName_ = "test2";
1403     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1404     if (sceneSession == nullptr) {
1405         delete data;
1406         return;
1407     }
1408     ssm_->sceneSessionMap_.insert({1000, sceneSession});
1409     ssm_->SetSessionContinueState(token, continueState);
1410     ASSERT_NE(sceneSession, nullptr);
1411     delete data;
1412 }
1413 
1414 /**
1415  * @tc.name: StartWindowInfoReportLoop
1416  * @tc.desc: Test if pip window can be created;
1417  * @tc.type: FUNC
1418  */
1419 HWTEST_F(SceneSessionManagerTest2, StartWindowInfoReportLoop, Function | SmallTest | Level3)
1420 {
1421     ASSERT_NE(nullptr, ssm_);
1422     ssm_->StartWindowInfoReportLoop();
1423     ssm_->eventHandler_ = nullptr;
1424     ssm_->StartWindowInfoReportLoop();
1425     ssm_->isReportTaskStart_ = true;
1426     ssm_->StartWindowInfoReportLoop();
1427 }
1428 
1429 /**
1430  * @tc.name: GetFocusWindowInfo
1431  * @tc.desc: Test if pip window can be created;
1432  * @tc.type: FUNC
1433  */
1434 HWTEST_F(SceneSessionManagerTest2, GetFocusWindowInfo, Function | SmallTest | Level3)
1435 {
1436     ASSERT_NE(nullptr, ssm_);
1437     FocusChangeInfo info;
1438     ssm_->GetFocusWindowInfo(info);
1439 }
1440 
1441 /**
1442  * @tc.name: GetFocusWindowInfo
1443  * @tc.desc: Test if pip window can be created;
1444  * @tc.type: FUNC
1445  */
1446 HWTEST_F(SceneSessionManagerTest2, GetFocusWindowInfo2, Function | SmallTest | Level3)
1447 {
1448     ASSERT_NE(nullptr, ssm_);
1449     FocusChangeInfo fcinfo;
1450     ssm_->GetFocusWindowInfo(fcinfo);
1451 
1452     SessionInfo info;
1453     info.abilityName_ = "BackgroundTask02";
1454     info.bundleName_ = "BackgroundTask02";
1455     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1456     ssm_->sceneSessionMap_.insert({0, sceneSession});
1457     ssm_->GetFocusWindowInfo(fcinfo);
1458 }
1459 
1460 /**
1461  * @tc.name: SetSessionLabel
1462  * @tc.desc: Test if pip window can be created;
1463  * @tc.type: FUNC
1464  */
1465 HWTEST_F(SceneSessionManagerTest2, SetSessionLabel, Function | SmallTest | Level3)
1466 {
1467     ASSERT_NE(nullptr, ssm_);
1468     ssm_->SetSessionLabel(nullptr, "test");
1469 
1470     SessionInfo info;
1471     info.abilityName_ = "BackgroundTask02";
1472     info.bundleName_ = "BackgroundTask02";
1473     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1474     ssm_->sceneSessionMap_.insert({100, sceneSession});
1475     ssm_->SetSessionLabel(nullptr, "test");
1476 }
1477 
1478 /**
1479  * @tc.name: SetSessionIcon
1480  * @tc.desc: Test if pip window can be created;
1481  * @tc.type: FUNC
1482  */
1483 HWTEST_F(SceneSessionManagerTest2, SetSessionIcon, Function | SmallTest | Level3)
1484 {
1485     ASSERT_NE(nullptr, ssm_);
1486     ssm_->SetSessionIcon(nullptr, nullptr);
1487 
1488     SessionInfo info;
1489     info.abilityName_ = "BackgroundTask02";
1490     info.bundleName_ = "BackgroundTask02";
1491     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1492     ssm_->sceneSessionMap_.insert({100, sceneSession});
1493     ssm_->SetSessionIcon(nullptr, nullptr);
1494 }
1495 
1496 /**
1497  * @tc.name: InitWithRenderServiceAdded
1498  * @tc.desc: Test if pip window can be created;
1499  * @tc.type: FUNC
1500  */
1501 HWTEST_F(SceneSessionManagerTest2, InitWithRenderServiceAdded, Function | SmallTest | Level3)
1502 {
1503     ASSERT_NE(nullptr, ssm_);
1504     ssm_->InitWithRenderServiceAdded();
1505 }
1506 
1507 /**
1508  * @tc.name: PendingSessionToForeground
1509  * @tc.desc: Test if pip window can be created;
1510  * @tc.type: FUNC
1511  */
1512 HWTEST_F(SceneSessionManagerTest2, PendingSessionToForeground, Function | SmallTest | Level3)
1513 {
1514     ASSERT_NE(nullptr, ssm_);
1515     ssm_->PendingSessionToForeground(nullptr);
1516 
1517     SessionInfo info;
1518     info.abilityName_ = "BackgroundTask02";
1519     info.bundleName_ = "BackgroundTask02";
1520     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1521     ssm_->sceneSessionMap_.insert({100, sceneSession});
1522     ssm_->PendingSessionToForeground(nullptr);
1523 }
1524 
1525 /**
1526  * @tc.name: GetFocusSessionToken
1527  * @tc.desc: Test if pip window can be created;
1528  * @tc.type: FUNC
1529  */
1530 HWTEST_F(SceneSessionManagerTest2, GetFocusSessionToken, Function | SmallTest | Level3)
1531 {
1532     WSError ret;
1533     sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
1534     ret = ssm_->GetFocusSessionToken(token);
1535     ASSERT_EQ(WSError::WS_ERROR_INVALID_PERMISSION, ret);
1536 
1537     SessionInfo info;
1538     info.abilityName_ = "BackgroundTask02";
1539     info.bundleName_ = "BackgroundTask02";
1540     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1541     ssm_->sceneSessionMap_.insert({100, sceneSession});
1542     ret = ssm_->GetFocusSessionToken(token);
1543     ASSERT_EQ(WSError::WS_ERROR_INVALID_PERMISSION, ret);
1544 }
1545 
1546 /**
1547  * @tc.name: GetFocusSessionElement
1548  * @tc.desc: Test if pip window can be created;
1549  * @tc.type: FUNC
1550  */
1551 HWTEST_F(SceneSessionManagerTest2, GetFocusSessionElement, Function | SmallTest | Level3)
1552 {
1553     ASSERT_NE(nullptr, ssm_);
1554     AppExecFwk::ElementName element;
1555     ssm_->GetFocusSessionElement(element);
1556 
1557     SessionInfo info;
1558     info.abilityName_ = "BackgroundTask02";
1559     info.bundleName_ = "BackgroundTask02";
1560     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1561     ssm_->sceneSessionMap_.insert({100, sceneSession});
1562     ssm_->GetFocusSessionElement(element);
1563 }
1564 
1565 /**
1566  * @tc.name: GetAllAbilityInfos
1567  * @tc.desc: Test if pip window can be created;
1568  * @tc.type: FUNC
1569  */
1570 HWTEST_F(SceneSessionManagerTest2, GetAllAbilityInfos, Function | SmallTest | Level3)
1571 {
1572     WSError ret;
1573     AAFwk::Want want;
1574     AppExecFwk::ElementName elementName = want.GetElement();
1575     int32_t userId = 1;
1576     std::vector<SCBAbilityInfo> scbAbilityInfos;
1577 
1578     ret = ssm_->GetAllAbilityInfos(want, userId, scbAbilityInfos);
1579     ASSERT_EQ(WSError::WS_ERROR_INVALID_PARAM, ret);
1580 
1581     elementName.bundleName_ = "test";
1582     ret = ssm_->GetAllAbilityInfos(want, userId, scbAbilityInfos);
1583     ASSERT_EQ(WSError::WS_ERROR_INVALID_PARAM, ret);
1584 
1585     elementName.abilityName_ = "test";
1586     ret = ssm_->GetAllAbilityInfos(want, userId, scbAbilityInfos);
1587     ASSERT_EQ(WSError::WS_ERROR_INVALID_PARAM, ret);
1588 
1589     elementName.bundleName_ = "";
1590     ret = ssm_->GetAllAbilityInfos(want, userId, scbAbilityInfos);
1591     ASSERT_EQ(WSError::WS_ERROR_INVALID_PARAM, ret);
1592 
1593     ssm_->bundleMgr_ = nullptr;
1594     ret = ssm_->GetAllAbilityInfos(want, userId, scbAbilityInfos);
1595     ASSERT_EQ(WSError::WS_ERROR_NULLPTR, ret);
1596 }
1597 
1598 /**
1599  * @tc.name: GetIsLayoutFullScreen
1600  * @tc.desc: Test if pip window can be created;
1601  * @tc.type: FUNC
1602  */
1603 HWTEST_F(SceneSessionManagerTest2, GetIsLayoutFullScreen, Function | SmallTest | Level3)
1604 {
1605     WSError ret;
1606     bool isLayoutFullScreen = true;
1607     ret = ssm_->GetIsLayoutFullScreen(isLayoutFullScreen);
1608     ASSERT_EQ(WSError::WS_OK, ret);
1609 
1610     isLayoutFullScreen = false;
1611     ret = ssm_->GetIsLayoutFullScreen(isLayoutFullScreen);
1612     ASSERT_EQ(WSError::WS_OK, ret);
1613 
1614     SessionInfo info;
1615     info.abilityName_ = "BackgroundTask02";
1616     info.bundleName_ = "BackgroundTask02";
1617     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1618     ssm_->sceneSessionMap_.insert({100, sceneSession});
1619     isLayoutFullScreen = true;
1620     ret = ssm_->GetIsLayoutFullScreen(isLayoutFullScreen);
1621     ASSERT_EQ(WSError::WS_OK, ret);
1622 
1623     isLayoutFullScreen = false;
1624     ret = ssm_->GetIsLayoutFullScreen(isLayoutFullScreen);
1625     ASSERT_EQ(WSError::WS_OK, ret);
1626 }
1627 
1628 /**
1629  * @tc.name: UpdateSessionAvoidAreaListener
1630  * @tc.desc: Test if pip window can be created;
1631  * @tc.type: FUNC
1632  */
1633 HWTEST_F(SceneSessionManagerTest2, UpdateSessionAvoidAreaListener, Function | SmallTest | Level3)
1634 {
1635     ASSERT_NE(nullptr, ssm_);
1636     {
1637         std::unique_lock<std::shared_mutex> lock(ssm_->sceneSessionMapMutex_);
1638         ssm_->sceneSessionMap_.clear();
1639     }
1640     int32_t persistentId = 100;
1641     ssm_->UpdateSessionAvoidAreaListener(persistentId, true);
1642 
1643     SessionInfo info;
1644     info.abilityName_ = "BackgroundTask02";
1645     info.bundleName_ = "BackgroundTask02";
1646     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1647     ssm_->sceneSessionMap_.insert({100, sceneSession});
1648     ssm_->UpdateSessionAvoidAreaListener(persistentId, true);
1649     ssm_->UpdateSessionAvoidAreaListener(persistentId, false);
1650 }
1651 
1652 /**
1653  * @tc.name: UpdateSessionTouchOutsideListener
1654  * @tc.desc: Test if pip window can be created;
1655  * @tc.type: FUNC
1656  */
1657 HWTEST_F(SceneSessionManagerTest2, UpdateSessionTouchOutsideListener, Function | SmallTest | Level3)
1658 {
1659     ASSERT_NE(nullptr, ssm_);
1660     {
1661         std::unique_lock<std::shared_mutex> lock(ssm_->sceneSessionMapMutex_);
1662         ssm_->sceneSessionMap_.clear();
1663     }
1664     int32_t persistentId = 100;
1665     ssm_->UpdateSessionTouchOutsideListener(persistentId, true);
1666 
1667     SessionInfo info;
1668     info.abilityName_ = "BackgroundTask02";
1669     info.bundleName_ = "BackgroundTask02";
1670     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1671     ssm_->sceneSessionMap_.insert({100, sceneSession});
1672     ssm_->UpdateSessionTouchOutsideListener(persistentId, true);
1673 
1674     ssm_->UpdateSessionTouchOutsideListener(persistentId, false);
1675 }
1676 
1677 /**
1678  * @tc.name: GetSessionSnapshotById
1679  * @tc.desc: Test if pip window can be created;
1680  * @tc.type: FUNC
1681  */
1682 HWTEST_F(SceneSessionManagerTest2, GetSessionSnapshotById, Function | SmallTest | Level3)
1683 {
1684     ASSERT_NE(nullptr, ssm_);
1685     SessionSnapshot snapshot;
1686     ssm_->GetSessionSnapshotById(100, snapshot);
1687 }
1688 
1689 /**
1690  * @tc.name: ClearSession
1691  * @tc.desc: Test if pip window can be created;
1692  * @tc.type: FUNC
1693  */
1694 HWTEST_F(SceneSessionManagerTest2, ClearSession, Function | SmallTest | Level3)
1695 {
1696     WSError ret;
1697     ret = ssm_->ClearSession(100);
1698     ASSERT_EQ(WSError::WS_ERROR_INVALID_PERMISSION, ret);
1699 }
1700 
1701 /**
1702  * @tc.name: ClearAllSessions
1703  * @tc.desc: Test if pip window can be created;
1704  * @tc.type: FUNC
1705  */
1706 HWTEST_F(SceneSessionManagerTest2, ClearAllSessions, Function | SmallTest | Level3)
1707 {
1708     WSError ret;
1709     ret = ssm_->ClearAllSessions();
1710     ASSERT_EQ(WSError::WS_ERROR_INVALID_PERMISSION, ret);
1711 }
1712 
1713 /**
1714  * @tc.name: GetTopWindowId
1715  * @tc.desc: Test if pip window can be created;
1716  * @tc.type: FUNC
1717  */
1718 HWTEST_F(SceneSessionManagerTest2, GetTopWindowId, Function | SmallTest | Level3)
1719 {
1720     WMError ret;
1721     {
1722         std::unique_lock<std::shared_mutex> lock(ssm_->sceneSessionMapMutex_);
1723         ssm_->sceneSessionMap_.clear();
1724     }
1725     uint32_t persistentId = 100;
1726     uint32_t topWinId = 200;
1727     ret = ssm_->GetTopWindowId(persistentId, topWinId);
1728     ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, ret);
1729 
1730     SessionInfo info;
1731     info.abilityName_ = "BackgroundTask02";
1732     info.bundleName_ = "BackgroundTask02";
1733     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1734     ssm_->sceneSessionMap_.insert({100, sceneSession});
1735     ret = ssm_->GetTopWindowId(persistentId, topWinId);
1736     ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, ret);
1737 }
1738 
1739 /**
1740  * @tc.name: InitPersistentStorage
1741  * @tc.desc: Test if pip window can be created;
1742  * @tc.type: FUNC
1743  */
1744 HWTEST_F(SceneSessionManagerTest2, InitPersistentStorage, Function | SmallTest | Level3)
1745 {
1746     ASSERT_NE(nullptr, ssm_);
1747     {
1748         std::unique_lock<std::shared_mutex> lock(ssm_->sceneSessionMapMutex_);
1749         ssm_->sceneSessionMap_.clear();
1750     }
1751     ssm_->InitPersistentStorage();
1752 }
1753 
1754 /**
1755  * @tc.name: GetAccessibilityWindowInfo
1756  * @tc.desc: Test if pip window can be created;
1757  * @tc.type: FUNC
1758  */
1759 HWTEST_F(SceneSessionManagerTest2, GetAccessibilityWindowInfo, Function | SmallTest | Level3)
1760 {
1761     WMError ret;
1762     {
1763         std::unique_lock<std::shared_mutex> lock(ssm_->sceneSessionMapMutex_);
1764         ssm_->sceneSessionMap_.clear();
1765     }
1766     std::vector<sptr<AccessibilityWindowInfo>> infos;
1767     ret = ssm_->GetAccessibilityWindowInfo(infos);
1768     ASSERT_EQ(WMError::WM_OK, ret);
1769 
1770     SessionInfo info;
1771     info.abilityName_ = "BackgroundTask02";
1772     info.bundleName_ = "BackgroundTask02";
1773     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1774     ssm_->sceneSessionMap_.insert({100, sceneSession});
1775     ret = ssm_->GetAccessibilityWindowInfo(infos);
1776     ASSERT_EQ(WMError::WM_OK, ret);
1777 }
1778 
1779 /**
1780  * @tc.name: OnScreenshot
1781  * @tc.desc: Test if pip window can be created;
1782  * @tc.type: FUNC
1783  */
1784 HWTEST_F(SceneSessionManagerTest2, OnScreenshot, Function | SmallTest | Level3)
1785 {
1786     ASSERT_NE(nullptr, ssm_);
1787     {
1788         std::unique_lock<std::shared_mutex> lock(ssm_->sceneSessionMapMutex_);
1789         ssm_->sceneSessionMap_.clear();
1790     }
1791     DisplayId displayId = 0;
1792     ssm_->OnScreenshot(displayId);
1793 
1794     SessionInfo info;
1795     info.abilityName_ = "BackgroundTask02";
1796     info.bundleName_ = "BackgroundTask02";
1797     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1798     ssm_->sceneSessionMap_.insert({100, sceneSession});
1799     ssm_->OnScreenshot(displayId);
1800 
1801     sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
1802     ssm_->OnScreenshot(displayId);
1803     sceneSession->SetSessionState(SessionState::STATE_ACTIVE);
1804     ssm_->OnScreenshot(displayId);
1805     sceneSession->SetSessionState(SessionState::STATE_DISCONNECT);
1806     ssm_->OnScreenshot(displayId);
1807     sceneSession->SetSessionState(SessionState::STATE_END);
1808     ssm_->OnScreenshot(displayId);
1809 }
1810 
1811 /**
1812  * @tc.name: ProcessSubSessionForeground
1813  * @tc.desc: Test if pip window can be created;
1814  * @tc.type: FUNC
1815  */
1816 HWTEST_F(SceneSessionManagerTest2, ProcessSubSessionForeground, Function | SmallTest | Level3)
1817 {
1818     {
1819         std::unique_lock<std::shared_mutex> lock(ssm_->sceneSessionMapMutex_);
1820         ssm_->sceneSessionMap_.clear();
1821     }
1822     sptr<SceneSession> sceneSession = nullptr;
1823     ssm_->ProcessSubSessionForeground(sceneSession);
1824 
1825     SessionInfo info;
1826     info.abilityName_ = "BackgroundTask02";
1827     info.bundleName_ = "BackgroundTask02";
1828     sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1829     ASSERT_NE(nullptr, sceneSession);
1830     ssm_->ProcessSubSessionForeground(sceneSession);
1831 
1832     sptr<SceneSession> sub1 = nullptr;
1833     sptr<SceneSession> sub2 = sptr<SceneSession>::MakeSptr(info, nullptr);
1834     std::vector<sptr<SceneSession>> subs;
1835     std::vector<sptr<SceneSession>> dialogs;
1836     subs.push_back(sub1);
1837     subs.push_back(sub2);
1838     dialogs.push_back(sub1);
1839     dialogs.push_back(sub2);
1840     sceneSession->subSession_ = subs;
1841     ssm_->ProcessSubSessionForeground(sceneSession);
1842     sptr<SceneSession> sub3 = sptr<SceneSession>::MakeSptr(info, nullptr);
1843     sub3->state_ = SessionState::STATE_FOREGROUND;
1844     subs.push_back(sub3);
1845     dialogs.push_back(sub3);
1846     sceneSession->subSession_ = subs;
1847     ssm_->ProcessSubSessionForeground(sceneSession);
1848     sptr<SceneSession> sub4 = sptr<SceneSession>::MakeSptr(info, nullptr);
1849     sub4->state_ = SessionState::STATE_FOREGROUND;
1850     sub4->persistentId_ = 100;
1851     subs.push_back(sub4);
1852     dialogs.push_back(sub4);
1853     sceneSession->subSession_ = subs;
1854     ssm_->ProcessSubSessionForeground(sceneSession);
1855 
1856     ssm_->sceneSessionMap_.insert({0, sceneSession});
1857     ssm_->sceneSessionMap_.insert({100, sceneSession});
1858     ssm_->ProcessSubSessionForeground(sceneSession);
1859     ssm_->needBlockNotifyFocusStatusUntilForeground_ = true;
1860     ssm_->ProcessSubSessionForeground(sceneSession);
1861     ASSERT_NE(nullptr, ssm_);
1862 }
1863 
1864 /**
1865  * @tc.name: ConfigSystemUIStatusBar
1866  * @tc.desc: call ConfigSystemUIStatusBar default.
1867  * @tc.type: FUNC
1868  */
1869 HWTEST_F(SceneSessionManagerTest2, ConfigSystemUIStatusBar02, Function | SmallTest | Level3)
1870 {
1871     std::string xmlStr = "<?xml version='1.0' encoding=\"utf-8\"?>"
1872         "<Configs>"
1873             "<systemUIStatusBar>"
1874             "</systemUIStatusBar>"
1875         "</Configs>";
1876     WindowSceneConfig::config_ = ReadConfig(xmlStr);
1877     sptr<SceneSessionManager> sceneSessionManager = sptr<SceneSessionManager>::MakeSptr();
1878     ASSERT_NE(sceneSessionManager, nullptr);
1879     sceneSessionManager->ConfigWindowSceneXml();
1880 }
1881 
1882 /**
1883  * @tc.name: ClosePipWindowIfExist
1884  * @tc.desc: ClosePipWindowIfExist
1885  * @tc.type: FUNC
1886  */
1887 HWTEST_F(SceneSessionManagerTest2, ClosePipWindowIfExist, Function | SmallTest | Level3)
1888 {
1889     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1890     ASSERT_NE(property, nullptr);
1891     ssm_->ClosePipWindowIfExist(WindowType::WINDOW_TYPE_PIP);
1892 
1893     SessionInfo info;
1894     info.sessionState_ = {1};
1895     Rect reqRect = { 0, 0, 10, 10 };
1896     property->SetRequestRect(reqRect);
1897     property->SetWindowMode(WindowMode::WINDOW_MODE_PIP);
1898     ASSERT_EQ(false, ssm_->IsEnablePiPCreate(property));
1899 }
1900 
1901 /**
1902  * @tc.name: RecoverAndConnectSpecificSession
1903  * @tc.desc: RecoverAndConnectSpecificSession
1904  * @tc.type: FUNC
1905  */
1906 HWTEST_F(SceneSessionManagerTest2, RecoverAndConnectSpecificSession, Function | SmallTest | Level3)
1907 {
1908     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1909     ASSERT_NE(property, nullptr);
1910     property->SetParentId(1);
1911     sptr<ISessionStage> sessionStage;
1912     sptr<IWindowEventChannel> eventChannel;
1913     std::shared_ptr<RSSurfaceNode> surfaceNode;
1914     sptr<ISession> session;
1915     sptr<IRemoteObject> token;
1916     auto result = ssm_->RecoverAndConnectSpecificSession(sessionStage, eventChannel,
1917         surfaceNode, property, session, token);
1918     ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
1919 }
1920 
1921 /**
1922  * @tc.name: RecoverAndConnectSpecificSession02
1923  * @tc.desc: RecoverAndConnectSpecificSession02
1924  * @tc.type: FUNC
1925  */
1926 HWTEST_F(SceneSessionManagerTest2, RecoverAndConnectSpecificSession02, Function | SmallTest | Level3)
1927 {
1928     SessionInfo sessionInfo;
1929     sessionInfo.abilityName_ = "RecoverAndConnectSpecificSession02";
1930     sessionInfo.bundleName_ = "SceneSessionManagerTest2";
1931     sessionInfo.windowType_ = static_cast<uint32_t>(WindowType::APP_MAIN_WINDOW_END);
1932     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1933     ASSERT_NE(property, nullptr);
1934     property->SetSessionInfo(sessionInfo);
1935     property->SetPersistentId(1);
1936     property->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
1937     sptr<ISessionStage> sessionStage;
1938     sptr<IWindowEventChannel> eventChannel;
1939     std::shared_ptr<RSSurfaceNode> surfaceNode;
1940     sptr<ISession> session;
1941     sptr<IRemoteObject> token;
1942     ASSERT_NE(ssm_, nullptr);
1943     auto result = ssm_->RecoverAndConnectSpecificSession(sessionStage, eventChannel,
1944         surfaceNode, property, session, token);
1945     ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
1946 }
1947 
1948 /**
1949  * @tc.name: CacheSpecificSessionForRecovering
1950  * @tc.desc: CacheSpecificSessionForRecovering
1951  * @tc.type: FUNC
1952  */
1953 HWTEST_F(SceneSessionManagerTest2, CacheSpecificSessionForRecovering, Function | SmallTest | Level3)
1954 {
1955     sptr<WindowSessionProperty> property;
1956     ASSERT_NE(ssm_, nullptr);
1957     ssm_->recoveringFinished_ = false;
1958     SessionInfo info;
1959     info.abilityName_ = "test1";
1960     info.bundleName_ = "test2";
1961     sptr<SceneSession> sceneSession = ssm_->CreateSceneSession(info, property);
1962     ASSERT_NE(sceneSession, nullptr);
1963     ssm_->CacheSpecificSessionForRecovering(nullptr, property);
1964     ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
1965 
1966     property = sptr<WindowSessionProperty>::MakeSptr();
1967     ASSERT_NE(property, nullptr);
1968     ssm_->CacheSpecificSessionForRecovering(nullptr, property);
1969     ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
1970     property->SetWindowType(WindowType::APP_WINDOW_BASE);
1971     ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
1972     property->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
1973     ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
1974     int32_t parentPersistentId = 1;
1975     property->SetParentPersistentId(parentPersistentId);
1976     ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
1977     ASSERT_EQ(ssm_->recoverSubSessionCacheMap_[parentPersistentId].size(), 1);
1978     ssm_->CacheSpecificSessionForRecovering(sceneSession, property);
1979     ASSERT_EQ(ssm_->recoverSubSessionCacheMap_[parentPersistentId].size(), 2);
1980     ssm_->RecoverCachedSubSession(parentPersistentId);
1981     ASSERT_EQ(ssm_->recoverSubSessionCacheMap_[parentPersistentId].size(), 0);
1982     ssm_->recoverSubSessionCacheMap_.clear();
1983 }
1984 
1985 /**
1986  * @tc.name: SetAlivePersistentIds
1987  * @tc.desc: SetAlivePersistentIds
1988  * @tc.type: FUNC
1989  */
1990 HWTEST_F(SceneSessionManagerTest2, SetAlivePersistentIds, Function | SmallTest | Level3)
1991 {
1992     ASSERT_NE(ssm_, nullptr);
1993     std::vector<int32_t> recoveredPersistentIds = {0, 1, 2};
1994     ssm_->SetAlivePersistentIds(recoveredPersistentIds);
1995     ASSERT_EQ(ssm_->alivePersistentIds_, recoveredPersistentIds);
1996 }
1997 
1998 /**
1999  * @tc.name: NotifyCreateToastSession
2000  * @tc.desc: NotifyCreateToastSession
2001  * @tc.type: FUNC
2002  */
2003 HWTEST_F(SceneSessionManagerTest2, NotifyCreateToastSession, Function | SmallTest | Level3)
2004 {
2005     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
2006     ASSERT_NE(property, nullptr);
2007     ssm_->NotifyCreateToastSession(1, nullptr);
2008     SessionInfo Info;
2009     Info.persistentId_ = 1;
2010     int32_t persistentId = Info.persistentId_;
2011     Info.abilityName_ = "testInfo1a";
2012     Info.bundleName_ = "testInfo1b";
2013     sptr<SceneSession> session = sptr<SceneSession>::MakeSptr(Info, nullptr);
2014     ssm_->NotifyCreateToastSession(persistentId, session);
2015 }
2016 
2017 /**
2018  * @tc.name: RecoverCachedDialogSession
2019  * @tc.desc: RecoverCachedDialogSession
2020  * @tc.type: FUNC
2021  */
2022 HWTEST_F(SceneSessionManagerTest2, RecoverCachedDialogSession, Function | SmallTest | Level3)
2023 {
2024     ASSERT_NE(ssm_, nullptr);
2025     ssm_->recoveringFinished_ = false;
2026     SessionInfo info;
2027     info.abilityName_ = "test1";
2028     info.bundleName_ = "test2";
2029     sptr<WindowSessionProperty> property;
2030     sptr<SceneSession> sceneSession = ssm_->CreateSceneSession(info, property);
2031     ASSERT_NE(sceneSession, nullptr);
2032 
2033     int32_t parentPersistentId = 1;
2034     ssm_->RecoverCachedDialogSession(parentPersistentId);
2035     ASSERT_EQ(ssm_->recoverDialogSessionCacheMap_[parentPersistentId].size(), 0);
2036     ssm_->recoverDialogSessionCacheMap_[parentPersistentId].emplace_back(sceneSession);
2037     ASSERT_EQ(ssm_->recoverDialogSessionCacheMap_[parentPersistentId].size(), 1);
2038     ssm_->recoverDialogSessionCacheMap_[parentPersistentId].emplace_back(sceneSession);
2039     ASSERT_EQ(ssm_->recoverDialogSessionCacheMap_[parentPersistentId].size(), 2);
2040     ssm_->RecoverCachedDialogSession(parentPersistentId);
2041     ASSERT_EQ(ssm_->recoverDialogSessionCacheMap_[parentPersistentId].size(), 0);
2042 }
2043 }
2044 } // namespace Rosen
2045 } // namespace OHOS
2046