• 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 
18 #include "interfaces/include/ws_common.h"
19 #include "iremote_object_mocker.h"
20 #include "session_manager/include/scene_session_manager.h"
21 #include "session_info.h"
22 #include "session/host/include/scene_session.h"
23 #include "session_manager.h"
24 #include "screen_session_manager_client/include/screen_session_manager_client.h"
25 
26 using namespace testing;
27 using namespace testing::ext;
28 
29 namespace OHOS {
30 namespace Rosen {
31 
32 class SceneSessionManagerTest10 : public testing::Test {
33 public:
34     static void SetUpTestCase();
35     static void TearDownTestCase();
36     void SetUp() override;
37     void TearDown() override;
38     void InitTestSceneSession(DisplayId displayId, int32_t windowId, int32_t zOrder, bool visible, WSRect rect);
39     void InitTestSceneSessionForListWindowInfo();
40 
41     static sptr<SceneSessionManager> ssm_;
42 private:
43     static constexpr uint32_t WAIT_SYNC_IN_NS = 200000;
44 };
45 
46 sptr<SceneSessionManager> SceneSessionManagerTest10::ssm_ = nullptr;
47 
NotifyRecoverSceneSessionFuncTest(const sptr<SceneSession> & session,const SessionInfo & sessionInfo)48 void NotifyRecoverSceneSessionFuncTest(const sptr<SceneSession>& session, const SessionInfo& sessionInfo)
49 {
50 }
51 
TraverseFuncTest(const sptr<SceneSession> & session)52 bool TraverseFuncTest(const sptr<SceneSession>& session)
53 {
54     return true;
55 }
56 
WindowChangedFuncTest(int32_t persistentId,WindowUpdateType type)57 void WindowChangedFuncTest(int32_t persistentId, WindowUpdateType type)
58 {
59 }
60 
ProcessStatusBarEnabledChangeFuncTest(bool enable)61 void ProcessStatusBarEnabledChangeFuncTest(bool enable)
62 {
63 }
64 
DumpRootSceneElementInfoFuncTest(const std::vector<std::string> & params,std::vector<std::string> & infos)65 void DumpRootSceneElementInfoFuncTest(const std::vector<std::string>& params, std::vector<std::string>& infos)
66 {
67 }
68 
SetUpTestCase()69 void SceneSessionManagerTest10::SetUpTestCase()
70 {
71     ssm_ = &SceneSessionManager::GetInstance();
72 }
73 
TearDownTestCase()74 void SceneSessionManagerTest10::TearDownTestCase()
75 {
76     ssm_ = nullptr;
77 }
78 
SetUp()79 void SceneSessionManagerTest10::SetUp()
80 {
81 }
82 
TearDown()83 void SceneSessionManagerTest10::TearDown()
84 {
85     usleep(WAIT_SYNC_IN_NS);
86 }
87 
InitTestSceneSession(DisplayId displayId,int32_t windowId,int32_t zOrder,bool visible,WSRect rect)88 void SceneSessionManagerTest10::InitTestSceneSession(DisplayId displayId,
89     int32_t windowId, int32_t zOrder, bool visible, WSRect rect)
90 {
91     SessionInfo info;
92     info.bundleName_ = "root";
93     info.persistentId_ = windowId;
94     sptr<SceneSession> sceneSession = ssm_->CreateSceneSession(info, nullptr);
95     ASSERT_NE(nullptr, sceneSession);
96     sceneSession->SetZOrder(zOrder);
97     sceneSession->SetRSVisible(visible);
98     sceneSession->SetSessionRect(rect);
99     sceneSession->property_->SetDisplayId(displayId);
100     ssm_->sceneSessionMap_.insert({sceneSession->GetPersistentId(), sceneSession});
101     EXPECT_EQ(windowId, sceneSession->GetPersistentId());
102 }
103 
InitTestSceneSessionForListWindowInfo()104 void SceneSessionManagerTest10::InitTestSceneSessionForListWindowInfo()
105 {
106     SessionInfo sessionInfo1;
107     sessionInfo1.isSystem_ = false;
108     sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo1, nullptr);
109     sceneSession1->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
110     WSRect rect = { 0, 0, 100, 100 };
111     sceneSession1->SetSessionRect(rect);
112     sceneSession1->SetSessionGlobalRect(rect);
113     sceneSession1->SetSessionState(SessionState::STATE_FOREGROUND);
114     sceneSession1->GetSessionProperty()->SetDisplayId(0);
115     ssm_->sceneSessionMap_.insert({ sceneSession1->GetPersistentId(), sceneSession1 });
116 
117     SessionInfo sessionInfo2;
118     sessionInfo2.isSystem_ = false;
119     sptr<SceneSession> sceneSession2 = sptr<SceneSession>::MakeSptr(sessionInfo2, nullptr);
120     sceneSession2->SetVisibilityState(WINDOW_VISIBILITY_STATE_PARTICALLY_OCCLUSION);
121     rect = { 0, 0, 120, 120 };
122     sceneSession2->SetSessionRect(rect);
123     sceneSession2->SetSessionGlobalRect(rect);
124     sceneSession2->SetSessionState(SessionState::STATE_FOREGROUND);
125     sceneSession2->GetSessionProperty()->SetDisplayId(0);
126     ssm_->sceneSessionMap_.insert({ sceneSession2->GetPersistentId(), sceneSession2 });
127 
128     SessionInfo sessionInfo3;
129     sessionInfo3.isSystem_ = false;
130     sptr<SceneSession> sceneSession3 = sptr<SceneSession>::MakeSptr(sessionInfo3, nullptr);
131     sceneSession3->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
132     rect = { 0, 100, 120, 120 };
133     sceneSession3->SetSessionRect(rect);
134     sceneSession3->SetSessionGlobalRect(rect);
135     sceneSession3->SetSessionState(SessionState::STATE_FOREGROUND);
136     sceneSession3->GetSessionProperty()->SetDisplayId(0);
137     ssm_->sceneSessionMap_.insert({ sceneSession3->GetPersistentId(), sceneSession3 });
138 
139     SessionInfo sessionInfo4;
140     sessionInfo4.isSystem_ = false;
141     sptr<SceneSession> sceneSession4 = sptr<SceneSession>::MakeSptr(sessionInfo4, nullptr);
142     sceneSession4->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
143     rect = { 0, 3000, 120, 120 };
144     sceneSession4->SetSessionRect(rect);
145     sceneSession4->SetSessionGlobalRect(rect);
146     sceneSession4->SetSessionState(SessionState::STATE_FOREGROUND);
147     sceneSession4->GetSessionProperty()->SetDisplayId(0);
148     ssm_->sceneSessionMap_.insert({ sceneSession4->GetPersistentId(), sceneSession4 });
149 
150     SessionInfo sessionInfo5;
151     sessionInfo5.isSystem_ = false;
152     sptr<SceneSession> sceneSession5 = sptr<SceneSession>::MakeSptr(sessionInfo5, nullptr);
153     sceneSession5->SetVisibilityState(WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
154     rect = { 0, 0, 100, 100 };
155     sceneSession5->SetSessionRect(rect);
156     sceneSession5->SetSessionGlobalRect(rect);
157     sceneSession5->SetSessionState(SessionState::STATE_BACKGROUND);
158     sceneSession5->GetSessionProperty()->SetDisplayId(0);
159     ssm_->sceneSessionMap_.insert({ sceneSession5->GetPersistentId(), sceneSession5 });
160 
161     SessionInfo sessionInfo6;
162     sessionInfo6.isSystem_ = true;
163     sptr<SceneSession> sceneSession6 = sptr<SceneSession>::MakeSptr(sessionInfo6, nullptr);
164     sceneSession6->SetVisibilityState(WINDOW_VISIBILITY_STATE_NO_OCCLUSION);
165     rect = { 0, 200, 120, 120 };
166     sceneSession6->SetSessionRect(rect);
167     sceneSession6->SetSessionGlobalRect(rect);
168     sceneSession6->SetSessionState(SessionState::STATE_FOREGROUND);
169     constexpr DisplayId SECOND_DISPLAY_ID = 11;
170     sceneSession6->GetSessionProperty()->SetDisplayId(SECOND_DISPLAY_ID);
171     ssm_->sceneSessionMap_.insert({ sceneSession6->GetPersistentId(), sceneSession6 });
172 }
173 
174 namespace {
175 /**
176  * @tc.name: RequestSceneSessionDestructionInner
177  * @tc.desc: Test RequestSceneSessionDestructionInner with CollaboratorType RESERVE_TYPE
178  * @tc.type: FUNC
179  */
180 HWTEST_F(SceneSessionManagerTest10, RequestSceneSessionDestructionInner, Function | SmallTest | Level3)
181 {
182     ASSERT_NE(ssm_, nullptr);
183 
184     SessionInfo info;
185     sptr<SceneSession::SpecificSessionCallback> specificCallback = nullptr;
186     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
187     sptr<AAFwk::SessionInfo> sceneSessionInfo = sptr<AAFwk::SessionInfo>::MakeSptr();
188     bool needRemoveSession = true;
189     bool isForceClean = true;
190 
191     SessionInfo sessionInfo;
192     sessionInfo.collaboratorType_ = CollaboratorType::RESERVE_TYPE;
193     auto res = ssm_->RequestSceneSessionDestructionInner(sceneSession, sceneSessionInfo,
194         needRemoveSession, isForceClean);
195     ASSERT_EQ(res, WSError::WS_OK);
196 }
197 
198 /**
199  * @tc.name: TestRequestSceneSessionDestructionInner_01
200  * @tc.desc: Test RequestSceneSessionDestructionInner with CollaboratorType DEFAULT_TYPE
201  * @tc.type: FUNC
202  */
203 HWTEST_F(SceneSessionManagerTest10, TestRequestSceneSessionDestructionInner_01, Function | SmallTest | Level3)
204 {
205     ASSERT_NE(ssm_, nullptr);
206 
207     SessionInfo info;
208     sptr<SceneSession::SpecificSessionCallback> specificCallback = nullptr;
209     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
210     sptr<AAFwk::SessionInfo> sceneSessionInfo = sptr<AAFwk::SessionInfo>::MakeSptr();
211     bool needRemoveSession = false;
212     bool isForceClean = false;
213 
214     SessionInfo sessionInfo;
215     sessionInfo.collaboratorType_ = CollaboratorType::DEFAULT_TYPE;
216     sessionInfo.want = std::make_shared<AAFwk::Want>();
217     ssm_->listenerController_ = std::make_shared<SessionListenerController>();
218     auto res = ssm_->RequestSceneSessionDestructionInner(sceneSession, sceneSessionInfo,
219         needRemoveSession, isForceClean);
220     ASSERT_EQ(res, WSError::WS_OK);
221 }
222 
223 /**
224  * @tc.name: TestRegisterWindowManagerAgent_01
225  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_SYSTEM_BAR
226  * @tc.type: FUNC
227  */
228 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_01, Function | SmallTest | Level3)
229 {
230     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_SYSTEM_BAR;
231     sptr<IWindowManagerAgent> windowManagerAgent;
232     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
233     ASSERT_EQ(res, WMError::WM_ERROR_NULLPTR);
234 }
235 
236 /**
237  * @tc.name: TestRegisterWindowManagerAgent_02
238  * @tc.desc: Test RegisterWindowManagerAgent with AgentType WINDOW_MANAGER_AGENT_TYPE_GESTURE_NAVIGATION_ENABLED
239  * @tc.type: FUNC
240  */
241 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_02, Function | SmallTest | Level3)
242 {
243     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_GESTURE_NAVIGATION_ENABLED;
244     sptr<IWindowManagerAgent> windowManagerAgent;
245     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
246     ASSERT_EQ(res, WMError::WM_ERROR_NULLPTR);
247 }
248 
249 /**
250  * @tc.name: TestRegisterWindowManagerAgent_03
251  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WATER_MARK_FLAG
252  * @tc.type: FUNC
253  */
254 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_03, Function | SmallTest | Level3)
255 {
256     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WATER_MARK_FLAG;
257     sptr<IWindowManagerAgent> windowManagerAgent;
258     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
259     ASSERT_EQ(res, WMError::WM_ERROR_NULLPTR);
260 }
261 
262 /**
263  * @tc.name: TestRegisterWindowManagerAgent_04
264  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_UPDATE
265  * @tc.type: FUNC
266  */
267 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_04, Function | SmallTest | Level3)
268 {
269     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_UPDATE;
270     sptr<IWindowManagerAgent> windowManagerAgent;
271     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
272     ASSERT_EQ(res, WMError::WM_ERROR_NULLPTR);
273 }
274 
275 /**
276  * @tc.name: TestRegisterWindowManagerAgent_05
277  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_VISIBILITY
278  * @tc.type: FUNC
279  */
280 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_05, Function | SmallTest | Level3)
281 {
282     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_VISIBILITY;
283     sptr<IWindowManagerAgent> windowManagerAgent;
284     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
285     ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
286 }
287 
288 /**
289  * @tc.name: TestRegisterWindowManagerAgent_06
290  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_FOCUS
291  * @tc.type: FUNC
292  */
293 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_06, Function | SmallTest | Level3)
294 {
295     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS;
296     sptr<IWindowManagerAgent> windowManagerAgent;
297     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
298     ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
299 }
300 
301 /**
302  * @tc.name: TestRegisterWindowManagerAgent_07
303  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_DRAWING_STATE
304  * @tc.type: FUNC
305  */
306 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_07, Function | SmallTest | Level3)
307 {
308     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_DRAWING_STATE;
309     sptr<IWindowManagerAgent> windowManagerAgent;
310     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
311     ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
312 }
313 
314 /**
315  * @tc.name: TestRegisterWindowManagerAgent_08
316  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_VISIBLE_WINDOW_NUM
317  * @tc.type: FUNC
318  */
319 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_08, Function | SmallTest | Level3)
320 {
321     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_VISIBLE_WINDOW_NUM;
322     sptr<IWindowManagerAgent> windowManagerAgent;
323     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
324     ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
325 }
326 
327 /**
328  * @tc.name: TestRegisterWindowManagerAgent_09
329  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_MODE
330  * @tc.type: FUNC
331  */
332 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_09, Function | SmallTest | Level3)
333 {
334     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_MODE;
335     sptr<IWindowManagerAgent> windowManagerAgent;
336     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
337     ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
338 }
339 
340 /**
341  * @tc.name: TestRegisterWindowManagerAgent_010
342  * @tc.desc: Test RegisterWindowManagerAgent with WindowManagerAgentType WINDOW_MANAGER_AGENT_TYPE_WINDOW_PID_VISIBILITY
343  * @tc.type: FUNC
344  */
345 HWTEST_F(SceneSessionManagerTest10, TestRegisterWindowManagerAgent_010, Function | SmallTest | Level3)
346 {
347     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_WINDOW_PID_VISIBILITY;
348     sptr<IWindowManagerAgent> windowManagerAgent;
349     auto res = ssm_->RegisterWindowManagerAgent(type, windowManagerAgent);
350     ASSERT_EQ(res, WMError::WM_ERROR_INVALID_PERMISSION);
351 }
352 
353 /**
354  * @tc.name: TestUpdateRotateAnimationConfig_01
355  * @tc.desc: Test UpdateRotateAnimationConfig with duration_ 400
356  * @tc.type: FUNC
357  */
358 HWTEST_F(SceneSessionManagerTest10, TestUpdateRotateAnimationConfig_01, Function | SmallTest | Level3)
359 {
360     ASSERT_NE(ssm_, nullptr);
361     RotateAnimationConfig config = { 400 };
362     ssm_->UpdateRotateAnimationConfig(config);
363     usleep(WAIT_SYNC_IN_NS);
364     ASSERT_EQ(ssm_->rotateAnimationConfig_.duration_, 400);
365 }
366 
367 /**
368  * @tc.name: TestUpdateRotateAnimationConfig_02
369  * @tc.desc: Test UpdateRotateAnimationConfig with duration_ 600
370  * @tc.type: FUNC
371  */
372 HWTEST_F(SceneSessionManagerTest10, TestUpdateRotateAnimationConfig_02, Function | SmallTest | Level3)
373 {
374     ASSERT_NE(ssm_, nullptr);
375     RotateAnimationConfig config = { 600 };
376     ssm_->UpdateRotateAnimationConfig(config);
377     usleep(WAIT_SYNC_IN_NS);
378     ASSERT_EQ(ssm_->rotateAnimationConfig_.duration_, 600);
379 }
380 
381 /**
382  * @tc.name: RegisterAcquireRotateAnimationConfigFunc
383  * @tc.desc: RegisterAcquireRotateAnimationConfigFunc
384  * @tc.type: FUNC
385  */
386 HWTEST_F(SceneSessionManagerTest10, RegisterAcquireRotateAnimationConfigFunc, Function | SmallTest | Level3)
387 {
388     ASSERT_NE(ssm_, nullptr);
389     SessionInfo sessionInfo;
390     sessionInfo.bundleName_ = "bundleName";
391     sessionInfo.persistentId_ = 1;
392     sessionInfo.isSystem_ = false;
393     sessionInfo.abilityInfo = std::make_shared<AppExecFwk::AbilityInfo>();
394     ASSERT_NE(sessionInfo.abilityInfo, nullptr);
395     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
396     ASSERT_NE(sceneSession, nullptr);
397     sceneSession->scenePersistence_ = sptr<ScenePersistence>::MakeSptr("bundleName", 1);
398     ASSERT_NE(sceneSession->scenePersistence_, nullptr);
399     ssm_->sceneSessionMap_.insert(std::make_pair(1, sceneSession));
400     ssm_->RegisterAcquireRotateAnimationConfigFunc(sceneSession);
401     WSRect rect({1, 1, 1, 1});
402     SizeChangeReason reason = SizeChangeReason::ROTATION;
403     WSError result = sceneSession->UpdateRect(rect, reason, "SceneSessionManagerTest10");
404     ASSERT_EQ(result, WSError::WS_OK);
405 }
406 
407 /**
408  * @tc.name: TestCheckLastFocusedAppSessionFocus_01
409  * @tc.desc: Test CheckLastFocusedAppSessionFocus with GetPersistentId
410  * @tc.type: FUNC
411  */
412 HWTEST_F(SceneSessionManagerTest10, TestCheckLastFocusedAppSessionFocus_01, Function | SmallTest | Level3)
413 {
414     ASSERT_NE(ssm_, nullptr);
415 
416     SessionInfo info1;
417     info1.abilityName_ = "focusedSession";
418     info1.bundleName_ = "focusedSession";
419     info1.windowType_ = 1;
420     sptr<SceneSession> focusedSession = sptr<SceneSession>::MakeSptr(info1, nullptr);
421     ASSERT_NE(focusedSession, nullptr);
422 
423     SessionInfo info2;
424     info2.abilityName_ = "nextSession";
425     info2.bundleName_ = "nextSession";
426     info2.windowType_ = 1;
427     sptr<SceneSession> nextSession = sptr<SceneSession>::MakeSptr(info2, nullptr);
428     ASSERT_NE(nextSession, nullptr);
429 
430     auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID);
431     focusGroup->SetLastFocusedAppSessionId(nextSession->GetPersistentId());
432     ASSERT_EQ(false, ssm_->CheckLastFocusedAppSessionFocus(focusedSession, nextSession));
433 }
434 
435 /**
436  * @tc.name: TestCheckLastFocusedAppSessionFocus_02
437  * @tc.desc: Test CheckLastFocusedAppSessionFocus with WindowType WINDOW_TYPE_DIALOG
438  * @tc.type: FUNC
439  */
440 HWTEST_F(SceneSessionManagerTest10, TestCheckLastFocusedAppSessionFocus_02, Function | SmallTest | Level3)
441 {
442     ASSERT_NE(ssm_, nullptr);
443 
444     SessionInfo info1;
445     info1.abilityName_ = "focusedSession";
446     info1.bundleName_ = "focusedSession";
447     info1.windowType_ = 1;
448     sptr<SceneSession> focusedSession = sptr<SceneSession>::MakeSptr(info1, nullptr);
449 
450     SessionInfo info2;
451     info2.abilityName_ = "nextSession";
452     info2.bundleName_ = "nextSession";
453     info2.windowType_ = 1;
454     sptr<SceneSession> nextSession = sptr<SceneSession>::MakeSptr(info2, nullptr);
455 
456     ssm_->windowFocusController_->UpdateFocusedAppSessionId(DEFAULT_DISPLAY_ID, 124);
457     focusedSession->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
458     ASSERT_EQ(false, ssm_->CheckLastFocusedAppSessionFocus(focusedSession, nextSession));
459 
460     nextSession->property_->SetWindowMode(WindowMode::WINDOW_MODE_SPLIT_PRIMARY);
461     ASSERT_EQ(false, ssm_->CheckLastFocusedAppSessionFocus(focusedSession, nextSession));
462     auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID);
463     ASSERT_EQ(0, focusGroup->GetLastFocusedAppSessionId());
464 }
465 
466 /**
467  * @tc.name: GetWindowIdsByCoordinate01
468  * @tc.desc: GetWindowIdsByCoordinate, displayId invalid
469  * @tc.type: FUNC
470  */
471 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate01, Function | SmallTest | Level3)
472 {
473     std::vector<int32_t> windowIds;
474     WMError result = ssm_->GetWindowIdsByCoordinate(DISPLAY_ID_INVALID, 0, 0, 0, windowIds);
475     EXPECT_EQ(result, WMError::WM_ERROR_INVALID_PARAM);
476 }
477 
478 /**
479  * @tc.name: GetWindowIdsByCoordinate02
480  * @tc.desc: GetWindowIdsByCoordinate, windowNumber 0, x y invalid
481  * @tc.type: FUNC
482  */
483 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate02, Function | SmallTest | Level3)
484 {
485     ssm_->sceneSessionMap_.clear();
486     InitTestSceneSession(1, 101, 11, true, {100, 100, 200, 200});
487     ssm_->sceneSessionMap_.insert({102, nullptr});
488     InitTestSceneSession(1, 103, 14, true, {120, 120, 220, 220});
489     InitTestSceneSession(1, 105, 12, true, {100, 100, 200, 200});
490     auto it1 = ssm_->sceneSessionMap_.find(105);
491     if (it1 != ssm_->sceneSessionMap_.end()) {
492         it1->second->sessionInfo_.bundleName_ = "other";
493     }
494     InitTestSceneSession(1, 106, 15, true, {140, 140, 240, 240});
495     InitTestSceneSession(2, 107, 15, true, {150, 150, 250, 250});
496     InitTestSceneSession(1, 108, 13, false, {150, 150, 250, 250});
497     InitTestSceneSession(1, 109, 13, true, {160, 160, 260, 260});
498     InitTestSceneSession(1, 110, 12, true, {500, 500, 600, 600});
499 
500     std::vector<int32_t> windowIds;
501     WMError result = ssm_->GetWindowIdsByCoordinate(1, 0, -1, -1, windowIds);
502     EXPECT_EQ(result, WMError::WM_OK);
503     EXPECT_EQ(5, windowIds.size());
504     EXPECT_EQ(106, windowIds[0]);
505     EXPECT_EQ(103, windowIds[1]);
506     EXPECT_EQ(109, windowIds[2]);
507     EXPECT_EQ(110, windowIds[3]);
508     EXPECT_EQ(101, windowIds[4]);
509     ssm_->sceneSessionMap_.clear();
510 }
511 
512 /**
513  * @tc.name: GetWindowIdsByCoordinate03
514  * @tc.desc: GetWindowIdsByCoordinate, windowNumber 3, x y invalid
515  * @tc.type: FUNC
516  */
517 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate03, Function | SmallTest | Level3)
518 {
519     ssm_->sceneSessionMap_.clear();
520     InitTestSceneSession(1, 111, 11, true, {100, 100, 200, 200});
521     ssm_->sceneSessionMap_.insert({102, nullptr});
522     InitTestSceneSession(1, 113, 14, true, {120, 120, 220, 220});
523     InitTestSceneSession(1, 114, 12, true, {100, 100, 200, 200});
524     ASSERT_TRUE(ssm_->sceneSessionMap_.find(114) != ssm_->sceneSessionMap_.end());
525     InitTestSceneSession(1, 115, 12, true, {100, 100, 200, 200});
526     auto it1 = ssm_->sceneSessionMap_.find(115);
527     if (it1 != ssm_->sceneSessionMap_.end()) {
528         it1->second->sessionInfo_.bundleName_ = "other";
529     }
530     InitTestSceneSession(1, 116, 15, true, {140, 140, 240, 240});
531     InitTestSceneSession(2, 117, 15, true, {150, 150, 250, 250});
532     InitTestSceneSession(1, 118, 13, false, {150, 150, 250, 250});
533     InitTestSceneSession(1, 119, 13, true, {160, 160, 260, 260});
534     InitTestSceneSession(1, 120, 12, true, {500, 500, 600, 600});
535 
536     std::vector<int32_t> windowIds;
537     WMError result = ssm_->GetWindowIdsByCoordinate(1, 3, -1, -1, windowIds);
538     EXPECT_EQ(result, WMError::WM_OK);
539     EXPECT_EQ(3, windowIds.size());
540     EXPECT_EQ(116, windowIds[0]);
541     EXPECT_EQ(113, windowIds[1]);
542     EXPECT_EQ(119, windowIds[2]);
543     ssm_->sceneSessionMap_.clear();
544 }
545 
546 /**
547  * @tc.name: GetWindowIdsByCoordinate04
548  * @tc.desc: GetWindowIdsByCoordinate, windowNumber 0, x y effictive value
549  * @tc.type: FUNC
550  */
551 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate04, Function | SmallTest | Level3)
552 {
553     ssm_->sceneSessionMap_.clear();
554     InitTestSceneSession(1, 121, 11, true, {100, 100, 200, 200});
555     ssm_->sceneSessionMap_.insert({102, nullptr});
556     InitTestSceneSession(1, 123, 14, true, {120, 120, 220, 220});
557     InitTestSceneSession(1, 125, 12, true, {100, 100, 200, 200});
558     auto it1 = ssm_->sceneSessionMap_.find(125);
559     if (it1 != ssm_->sceneSessionMap_.end()) {
560         it1->second->sessionInfo_.bundleName_ = "other";
561     }
562     InitTestSceneSession(1, 126, 15, true, {140, 140, 240, 240});
563     InitTestSceneSession(2, 127, 15, true, {150, 150, 250, 250});
564     InitTestSceneSession(1, 128, 13, false, {150, 150, 250, 250});
565     InitTestSceneSession(1, 129, 13, true, {160, 160, 260, 260});
566     InitTestSceneSession(1, 130, 12, true, {500, 500, 600, 600});
567 
568     std::vector<int32_t> windowIds;
569     WMError result = ssm_->GetWindowIdsByCoordinate(1, 0, 180, 180, windowIds);
570     EXPECT_EQ(result, WMError::WM_OK);
571     EXPECT_EQ(4, windowIds.size());
572     EXPECT_EQ(126, windowIds[0]);
573     EXPECT_EQ(123, windowIds[1]);
574     EXPECT_EQ(129, windowIds[2]);
575     EXPECT_EQ(121, windowIds[3]);
576     ssm_->sceneSessionMap_.clear();
577 }
578 
579 /**
580  * @tc.name: GetWindowIdsByCoordinate05
581  * @tc.desc: GetWindowIdsByCoordinate, windowNumber 3, x y effictive value
582  * @tc.type: FUNC
583  */
584 HWTEST_F(SceneSessionManagerTest10, GetWindowIdsByCoordinate05, Function | SmallTest | Level3)
585 {
586     ssm_->sceneSessionMap_.clear();
587     InitTestSceneSession(1, 131, 11, true, {100, 100, 200, 200});
588     ssm_->sceneSessionMap_.insert({102, nullptr});
589     InitTestSceneSession(1, 133, 14, true, {120, 120, 220, 220});
590     InitTestSceneSession(1, 134, 12, true, {100, 100, 200, 200});
591     ASSERT_TRUE(ssm_->sceneSessionMap_.find(134) != ssm_->sceneSessionMap_.end());
592     InitTestSceneSession(1, 135, 12, true, {100, 100, 200, 200});
593     auto it1 = ssm_->sceneSessionMap_.find(135);
594     if (it1 != ssm_->sceneSessionMap_.end()) {
595         it1->second->sessionInfo_.bundleName_ = "other";
596     }
597     InitTestSceneSession(1, 136, 15, true, {140, 140, 240, 240});
598     InitTestSceneSession(2, 137, 15, true, {150, 150, 250, 250});
599     InitTestSceneSession(1, 138, 13, false, {150, 150, 250, 250});
600     InitTestSceneSession(1, 139, 13, true, {160, 160, 260, 260});
601     InitTestSceneSession(1, 140, 12, true, {500, 500, 600, 600});
602 
603     std::vector<int32_t> windowIds;
604     WMError result = ssm_->GetWindowIdsByCoordinate(1, 3, 180, 180, windowIds);
605     EXPECT_EQ(result, WMError::WM_OK);
606     EXPECT_EQ(3, windowIds.size());
607     EXPECT_EQ(136, windowIds[0]);
608     EXPECT_EQ(133, windowIds[1]);
609     EXPECT_EQ(139, windowIds[2]);
610     ssm_->sceneSessionMap_.clear();
611 }
612 
613 /**
614  * @tc.name: ProcessFocusZOrderChange
615  * @tc.desc: ProcessFocusZOrderChange
616  * @tc.type: FUNC
617  */
618 HWTEST_F(SceneSessionManagerTest10, ProcessFocusZOrderChange, Function | SmallTest | Level3)
619 {
620     ssm_->sceneSessionMap_.clear();
621     ssm_->ProcessFocusZOrderChange(10);
622     ssm_->systemConfig_.windowUIType_ = WindowUIType::PC_WINDOW;
623     ssm_->ProcessFocusZOrderChange(97);
624 
625     ssm_->systemConfig_.windowUIType_ = WindowUIType::PHONE_WINDOW;
626     ssm_->ProcessFocusZOrderChange(97);
627 
628     SessionInfo sessionInfo;
629     sessionInfo.bundleName_ = "focusedSession";
630     sessionInfo.abilityName_ = "focusedSession";
631     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
632     ASSERT_NE(nullptr, sceneSession);
633     ssm_->sceneSessionMap_.emplace(1, sceneSession);
634     auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID);
635     focusGroup->SetFocusedSessionId(1);
636     ssm_->ProcessFocusZOrderChange(97);
637 
638     sceneSession->lastZOrder_ = 2203;
639     sceneSession->zOrder_ = 101;
640     ssm_->ProcessFocusZOrderChange(97);
641 
642     SessionInfo sessionInfo1;
643     sessionInfo1.bundleName_ = "voiceInteractionSession";
644     sessionInfo1.abilityName_ = "voiceInteractionSession";
645     sessionInfo1.windowType_ = static_cast<uint32_t>(WindowType::WINDOW_TYPE_VOICE_INTERACTION);
646     sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(sessionInfo1, nullptr);
647     ASSERT_NE(nullptr, sceneSession1);
648     sceneSession1->zOrder_ = 2109;
649     ssm_->sceneSessionMap_.emplace(2, sceneSession1);
650 
651     sceneSession->lastZOrder_ = 103;
652     sceneSession->zOrder_ = 101;
653     ssm_->ProcessFocusZOrderChange(97);
654 
655     sceneSession->lastZOrder_ = 2203;
656     sceneSession->zOrder_ = 101;
657     ssm_->ProcessFocusZOrderChange(97);
658 }
659 
660 /**
661  * @tc.name: GetAllSceneSessionForAccessibility
662  * @tc.desc: GetAllSceneSessionForAccessibility
663  * @tc.type: FUNC
664  */
665 HWTEST_F(SceneSessionManagerTest10, GetAllSceneSessionForAccessibility, Function | SmallTest | Level3)
666 {
667     ASSERT_NE(ssm_, nullptr);
668     std::vector<sptr<SceneSession>> sceneSessionList;
669     ASSERT_EQ(sceneSessionList.size(), 0);
670     SessionInfo info1;
671     info1.abilityName_ = "test1";
672     info1.bundleName_ = "test1";
673     info1.windowType_ = 1;
674     sptr<SceneSession> sceneSession1 = sptr<SceneSession>::MakeSptr(info1, nullptr);
675     ASSERT_NE(nullptr, sceneSession1);
676     SessionInfo info2;
677     info2.abilityName_ = "test2";
678     info2.bundleName_ = "test2";
679     info2.windowType_ = 1;
680     sptr<SceneSession> sceneSession2 = sptr<SceneSession>::MakeSptr(info2, nullptr);
681     ASSERT_NE(nullptr, sceneSession2);
682     SessionInfo info3;
683     info3.abilityName_ = "test3";
684     info3.bundleName_ = "test3";
685     info3.windowType_ = 1;
686     sptr<SceneSession> sceneSession3 = sptr<SceneSession>::MakeSptr(info3, nullptr);
687     ASSERT_NE(nullptr, sceneSession3);
688     ssm_->sceneSessionMap_.emplace(1, sceneSession1);
689     ssm_->sceneSessionMap_.emplace(2, sceneSession2);
690     ssm_->sceneSessionMap_.emplace(3, sceneSession3);
691     sceneSession1->isScbCoreEnabled_ = false;
692     sceneSession2->isScbCoreEnabled_ = false;
693     sceneSession3->isScbCoreEnabled_ = false;
694     sceneSession1->isVisibleForAccessibility_ = true;
695     sceneSession2->isVisibleForAccessibility_ = false;
696     sceneSession3->isVisibleForAccessibility_ = true;
697     sceneSession1->isVisible_ = true;
698     sceneSession2->isVisible_ = false;
699     sceneSession3->isVisible_ = true;
700     ssm_->GetAllSceneSessionForAccessibility(sceneSessionList);
701     ASSERT_EQ(sceneSessionList.size(), 1);
702 }
703 
704 /**
705  * @tc.name: TestGetMainParentSceneSession_01
706  * @tc.desc: Test GetMainParentSceneSession with invalid persistentId
707  * @tc.type: FUNC
708  */
709 HWTEST_F(SceneSessionManagerTest10, TestGetMainParentSceneSession_01, Function | SmallTest | Level3)
710 {
711     ASSERT_NE(ssm_, nullptr);
712     sptr<SceneSession> ret = ssm_->GetMainParentSceneSession(0, ssm_->sceneSessionMap_);
713     ASSERT_EQ(ret, nullptr);
714 }
715 
716 /**
717  * @tc.name: TestGetMainParentSceneSession_02
718  * @tc.desc: Test GetMainParentSceneSession with Error found scene session
719  * @tc.type: FUNC
720  */
721 HWTEST_F(SceneSessionManagerTest10, TestGetMainParentSceneSession_02, Function | SmallTest | Level3)
722 {
723     ASSERT_NE(ssm_, nullptr);
724     sptr<SceneSession> ret = ssm_->GetMainParentSceneSession(999, ssm_->sceneSessionMap_);
725     ASSERT_EQ(ret, nullptr);
726 }
727 
728 /**
729  * @tc.name: TestGetMainParentSceneSession_03
730  * @tc.desc: Test GetMainParentSceneSession with parent session
731  * @tc.type: FUNC
732  */
733 HWTEST_F(SceneSessionManagerTest10, TestGetMainParentSceneSession_03, Function | SmallTest | Level3)
734 {
735     ASSERT_NE(ssm_, nullptr);
736     SessionInfo info;
737     info.abilityName_ = "GetMainParentSceneSession001";
738     info.bundleName_ = "GetMainParentSceneSession001";
739     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
740     sptr<SceneSession> sceneSessionParent = sptr<SceneSession>::MakeSptr(info, nullptr);
741     sceneSessionParent->property_->SetPersistentId(100);
742     ssm_->sceneSessionMap_.insert({100, sceneSessionParent});
743     sceneSession->SetParentSession(sceneSessionParent);
744 
745     ssm_->sceneSessionMap_[999] = sceneSession;
746     sptr<SceneSession> ret = ssm_->GetMainParentSceneSession(999, ssm_->sceneSessionMap_);
747     ASSERT_NE(ret, sceneSessionParent);
748 }
749 
750 /**
751  * @tc.name: TestGetParentMainWindowId_01
752  * @tc.desc: Tst GetParentMainWindowId with invalid windowId
753  * @tc.type: FUNC
754  */
755 HWTEST_F(SceneSessionManagerTest10, TestGetParentMainWindowId_01, Function | SmallTest | Level3)
756 {
757     ASSERT_NE(ssm_, nullptr);
758     int32_t windowId = 0;
759     int32_t mainWindowId = 0;
760     WMError ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
761     ASSERT_EQ(ret, WMError::WM_ERROR_INVALID_PARAM);
762 }
763 
764 /**
765  * @tc.name: TestGetParentMainWindowId_02
766  * @tc.desc: Tst GetParentMainWindowId with not found scene session
767  * @tc.type: FUNC
768  */
769 HWTEST_F(SceneSessionManagerTest10, TestGetParentMainWindowId_02, Function | SmallTest | Level3)
770 {
771     int32_t windowId = -1;
772     int32_t mainWindowId = 0;
773     WMError ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
774     ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
775 }
776 
777 /**
778  * @tc.name: TestGetParentMainWindowId_03
779  * @tc.desc: Tst GetParentMainWindowId with session
780  * @tc.type: FUNC
781  */
782 HWTEST_F(SceneSessionManagerTest10, TestGetParentMainWindowId_03, Function | SmallTest | Level3)
783 {
784     int32_t windowId = 200;
785     int32_t mainWindowId = 0;
786     SessionInfo info;
787     info.abilityName_ = "test";
788     info.bundleName_ = "test";
789     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
790 
791     sceneSession->property_->SetPersistentId(windowId);
792     ssm_->sceneSessionMap_[windowId] = sceneSession;
793     WMError ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
794     ASSERT_EQ(ret, WMError::WM_OK);
795 }
796 
797 /**
798  * @tc.name: TestGetParentMainWindowId_04
799  * @tc.desc: Tst GetParentMainWindowId with WindowType WINDOW_TYPE_APP_SUB_WINDOW
800  * @tc.type: FUNC
801  */
802 HWTEST_F(SceneSessionManagerTest10, TestGetParentMainWindowId_04, Function | SmallTest | Level3)
803 {
804     int32_t windowId = 200;
805     int32_t mainWindowId = 0;
806     SessionInfo info;
807     info.abilityName_ = "test";
808     info.bundleName_ = "test";
809     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
810     sceneSession->property_->SetPersistentId(windowId);
811     ssm_->sceneSessionMap_[windowId] = sceneSession;
812     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
813     WMError ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
814     ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
815 
816     sceneSession->property_->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
817     ret = ssm_->GetParentMainWindowId(windowId, mainWindowId);
818     ASSERT_EQ(ret, WMError::WM_ERROR_NULLPTR);
819 }
820 
821 /**
822  * @tc.name: NotifyVisibleChange
823  * @tc.desc: test NotifyVisibleChange
824  * @tc.type: FUNC
825  */
826 HWTEST_F(SceneSessionManagerTest10, NotifyVisibleChange, Function | SmallTest | Level3)
827 {
828     SessionInfo info;
829     info.abilityName_ = "test";
830     info.bundleName_ = "test";
831     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
832     ASSERT_NE(nullptr, sceneSession);
833 
834     ASSERT_FALSE(ssm_->NotifyVisibleChange(sceneSession->GetPersistentId()));
835     ssm_->sceneSessionMap_.insert({sceneSession->GetPersistentId(), sceneSession});
836     ASSERT_TRUE(ssm_->NotifyVisibleChange(sceneSession->GetPersistentId()));
837 
838     ssm_->sceneSessionMap_.erase(sceneSession->GetPersistentId());
839 }
840 
841 /**
842  * @tc.name: TestIsInDefaultScreen_01
843  * @tc.desc: Test IsInDefaultScreen with not DefaultScreen id
844  * @tc.type: FUNC
845  */
846 HWTEST_F(SceneSessionManagerTest10, TestIsInDefaultScreen_01, Function | SmallTest | Level3)
847 {
848     SessionInfo info;
849     info.abilityName_ = "test";
850     info.bundleName_ = "test";
851     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
852     DisplayId displayId = 5;
853     sceneSession->property_->SetDisplayId(displayId);
854     ASSERT_EQ(ssm_->IsInDefaultScreen(sceneSession), false);
855 }
856 
857 /**
858  * @tc.name: TestIsInDefaultScreen_02
859  * @tc.desc: Test IsInDefaultScreen with DefaultScreen id
860  * @tc.type: FUNC
861  */
862 HWTEST_F(SceneSessionManagerTest10, TestIsInDefaultScreen_02, Function | SmallTest | Level3)
863 {
864     SessionInfo info;
865     info.abilityName_ = "test";
866     info.bundleName_ = "test";
867     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
868     ASSERT_NE(nullptr, sceneSession);
869     DisplayId displayId = ScreenSessionManagerClient::GetInstance().GetDefaultScreenId();
870     sceneSession->property_->SetDisplayId(displayId);
871     ASSERT_EQ(ssm_->IsInDefaultScreen(sceneSession), true);
872 }
873 
874 /**
875  * @tc.name: RegisterRequestVsyncFunc
876  * @tc.desc: test RegisterRequestVsyncFunc01
877  * @tc.type: FUNC
878  */
879 HWTEST_F(SceneSessionManagerTest10, RegisterRequestVsyncFunc01, Function | SmallTest | Level3)
880 {
881     ssm_->RegisterRequestVsyncFunc(nullptr);
882     SessionInfo info;
883     info.abilityName_ = "RegisterRequestVsyncFunc01";
884     info.bundleName_ = "RegisterRequestVsyncFunc01";
885     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
886     ASSERT_NE(nullptr, sceneSession);
887     ssm_->RegisterRequestVsyncFunc(sceneSession);
888     ASSERT_NE(nullptr, sceneSession->requestNextVsyncFunc_);
889 }
890 
891 /**
892  * @tc.name: TestEraseSceneSessionAndMarkDirtyLocked_01
893  * @tc.desc: Test EraseSceneSessionAndMarkDirtyLocked with erase id not exist
894  * @tc.type: FUNC
895  */
896 HWTEST_F(SceneSessionManagerTest10, TestEraseSceneSessionAndMarkDirtyLocked_01, Function | SmallTest | Level1)
897 {
898     // init
899     ssm_->sceneSessionMap_.clear();
900     ssm_->sessionMapDirty_ = 0;
901 
902     SessionInfo info;
903     info.abilityName_ = "EraseSceneSessionAndMarkDirtyLocked";
904     info.bundleName_ = "EraseSceneSessionAndMarkDirtyLocked";
905     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
906     const int32_t validId = 100;
907     const int32_t invalidId = 101;
908     ssm_->sceneSessionMap_.insert({validId, sceneSession});
909     // erase id not exist
910     ssm_->EraseSceneSessionAndMarkDirtyLocked(invalidId);
911     ASSERT_EQ(ssm_->sessionMapDirty_, 0);
912     ASSERT_NE(ssm_->sceneSessionMap_.find(validId), ssm_->sceneSessionMap_.end());
913 }
914 
915 /**
916  * @tc.name: TestEraseSceneSessionAndMarkDirtyLocked_02
917  * @tc.desc: Test EraseSceneSessionAndMarkDirtyLocked with erase invisible session
918  * @tc.type: FUNC
919  */
920 HWTEST_F(SceneSessionManagerTest10, TestEraseSceneSessionAndMarkDirtyLocked_02, Function | SmallTest | Level1)
921 {
922     // init
923     ssm_->sceneSessionMap_.clear();
924     ssm_->sessionMapDirty_ = 0;
925 
926     SessionInfo info;
927     info.abilityName_ = "TestEraseSceneSessionAndMarkDirtyLocked_02";
928     info.bundleName_ = "TestEraseSceneSessionAndMarkDirtyLocked_02";
929     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
930     const int32_t validId = 100;
931     ssm_->sceneSessionMap_.insert({validId, sceneSession});
932 
933     // erase invisible session
934     sceneSession->isVisible_ = false;
935     ssm_->EraseSceneSessionAndMarkDirtyLocked(validId);
936     ASSERT_EQ(ssm_->sessionMapDirty_, 0);
937     ASSERT_EQ(ssm_->sceneSessionMap_.find(validId), ssm_->sceneSessionMap_.end());
938 }
939 
940 /**
941  * @tc.name: TestEraseSceneSessionAndMarkDirtyLocked_03
942  * @tc.desc: Test EraseSceneSessionAndMarkDirtyLocked with erase visible session
943  * @tc.type: FUNC
944  */
945 HWTEST_F(SceneSessionManagerTest10, TestEraseSceneSessionAndMarkDirtyLocked_03, Function | SmallTest | Level1)
946 {
947     // init
948     ssm_->sceneSessionMap_.clear();
949     ssm_->sessionMapDirty_ = 0;
950 
951     SessionInfo info;
952     info.abilityName_ = "TestEraseSceneSessionAndMarkDirtyLocked_03";
953     info.bundleName_ = "TestEraseSceneSessionAndMarkDirtyLocked_03";
954     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
955     const int32_t validId = 100;
956 
957     // erase visible session
958     ssm_->sceneSessionMap_.insert({validId, sceneSession});
959     sceneSession->isVisible_ = true;
960     ssm_->EraseSceneSessionAndMarkDirtyLocked(validId);
961     ASSERT_EQ(ssm_->sessionMapDirty_, static_cast<uint32_t>(SessionUIDirtyFlag::VISIBLE));
962     ASSERT_EQ(ssm_->sceneSessionMap_.find(validId), ssm_->sceneSessionMap_.end());
963 }
964 
965 /**
966  * @tc.name: ProcessUpdateLastFocusedAppId
967  * @tc.desc: test ProcessUpdateLastFocusedAppId
968  * @tc.type: FUNC
969  */
970 HWTEST_F(SceneSessionManagerTest10, ProcessUpdateLastFocusedAppId, Function | SmallTest | Level1)
971 {
972     ssm_->sceneSessionMap_.clear();
973     std::vector<uint32_t> zOrderList;
974     ssm_->windowFocusController_->UpdateFocusedAppSessionId(DEFAULT_DISPLAY_ID, INVALID_SESSION_ID);
975     ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
976 
977     SessionInfo sessionInfo;
978     sessionInfo.bundleName_ = "lastFocusedAppSession";
979     sessionInfo.abilityName_ = "lastFocusedAppSession";
980     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
981     ssm_->sceneSessionMap_.emplace(1, sceneSession);
982     ssm_->windowFocusController_->UpdateFocusedAppSessionId(DEFAULT_DISPLAY_ID, 1);
983     sceneSession->zOrder_ = 101;
984     auto focusGroup = ssm_->windowFocusController_->GetFocusGroup(DEFAULT_DISPLAY_ID);
985 
986     ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
987     ASSERT_EQ(1, focusGroup->GetLastFocusedAppSessionId());
988 
989     zOrderList.push_back(103);
990     ssm_->ProcessUpdateLastFocusedAppId(zOrderList);
991     ASSERT_EQ(INVALID_SESSION_ID, focusGroup->GetLastFocusedAppSessionId());
992 }
993 
994 /**
995  * @tc.name: TestIsNeedSkipWindowModeTypeCheck_01
996  * @tc.desc: Test IsNeedSkipWindowModeTypeCheck with sceneSession nullptr
997  * @tc.type: FUNC
998  */
999 HWTEST_F(SceneSessionManagerTest10, TestIsNeedSkipWindowModeTypeCheck_01, Function | SmallTest | Level3)
1000 {
1001     sptr<SceneSession> sceneSession;
1002     auto ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false);
1003     ASSERT_TRUE(ret);
1004 }
1005 
1006 /**
1007  * @tc.name: TestIsNeedSkipWindowModeTypeCheck_02
1008  * @tc.desc: Test IsNeedSkipWindowModeTypeCheck with sceneSession not nullptr
1009  * @tc.type: FUNC
1010  */
1011 HWTEST_F(SceneSessionManagerTest10, TestIsNeedSkipWindowModeTypeCheck_02, Function | SmallTest | Level3)
1012 {
1013     SessionInfo sessionInfo;
1014     sessionInfo.bundleName_ = "IsNeedSkipWindowModeTypeCheck";
1015     sessionInfo.abilityName_ = "IsNeedSkipWindowModeTypeCheck";
1016     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1017     ASSERT_NE(nullptr, sceneSession->property_);
1018     sceneSession->property_->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
1019     sceneSession->SetRSVisible(true);
1020     sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
1021     auto ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false);
1022     ASSERT_TRUE(ret);
1023 }
1024 
1025 /**
1026  * @tc.name: TestIsNeedSkipWindowModeTypeCheck_03
1027  * @tc.desc: Test IsNeedSkipWindowModeTypeCheck WindowType APP_MAIN_WINDOW_BASE
1028  * @tc.type: FUNC
1029  */
1030 HWTEST_F(SceneSessionManagerTest10, TestIsNeedSkipWindowModeTypeCheck_03, Function | SmallTest | Level3)
1031 {
1032     SessionInfo sessionInfo;
1033     sessionInfo.bundleName_ = "IsNeedSkipWindowModeTypeCheck";
1034     sessionInfo.abilityName_ = "IsNeedSkipWindowModeTypeCheck";
1035     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1036     ASSERT_NE(nullptr, sceneSession->property_);
1037     sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1038     sceneSession->SetRSVisible(false);
1039     sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
1040     auto ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false);
1041     ASSERT_TRUE(ret);
1042 }
1043 
1044 /**
1045  * @tc.name: TestIsNeedSkipWindowModeTypeCheck_04
1046  * @tc.desc: Test IsNeedSkipWindowModeTypeCheck WindowType APP_MAIN_WINDOW_BASE and RSVisible true
1047  * @tc.type: FUNC
1048  */
1049 HWTEST_F(SceneSessionManagerTest10, TestIsNeedSkipWindowModeTypeCheck_04, Function | SmallTest | Level3)
1050 {
1051     SessionInfo sessionInfo;
1052     sessionInfo.bundleName_ = "TestIsNeedSkipWindowModeTypeCheck_04";
1053     sessionInfo.abilityName_ = "TestIsNeedSkipWindowModeTypeCheck_04";
1054     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1055     ASSERT_NE(nullptr, sceneSession);
1056     ASSERT_NE(nullptr, sceneSession->property_);
1057     sceneSession->property_->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1058     sceneSession->SetRSVisible(true);
1059     sceneSession->SetSessionState(SessionState::STATE_FOREGROUND);
1060     DisplayId displayId = 1001;
1061     sceneSession->property_->SetDisplayId(displayId);
1062     auto ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, true);
1063     ASSERT_TRUE(ret);
1064 
1065     ret = ssm_->IsNeedSkipWindowModeTypeCheck(sceneSession, false);
1066     ASSERT_FALSE(ret);
1067 }
1068 
1069 /**
1070  * @tc.name: NotifyStatusBarShowStatus
1071  * @tc.desc: test NotifyStatusBarShowStatus
1072  * @tc.type: FUNC
1073  */
1074 HWTEST_F(SceneSessionManagerTest10, NotifyStatusBarShowStatus, Function | SmallTest | Level3)
1075 {
1076     SessionInfo info;
1077     info.abilityName_ = "test";
1078     info.bundleName_ = "test";
1079     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1080     ASSERT_NE(nullptr, sceneSession);
1081 
1082     ssm_->sceneSessionMap_.insert({sceneSession->GetPersistentId(), sceneSession});
1083     sceneSession->isStatusBarVisible_ = true;
1084     EXPECT_EQ(WSError::WS_OK, ssm_->NotifyStatusBarShowStatus(sceneSession->GetPersistentId(), false));
1085     ssm_->sceneSessionMap_.erase(sceneSession->GetPersistentId());
1086 }
1087 
1088 /**
1089  * @tc.name: GetStatusBarConstantlyShow
1090  * @tc.desc: test GetStatusBarConstantlyShow
1091  * @tc.type: FUNC
1092  */
1093 HWTEST_F(SceneSessionManagerTest10, GetStatusBarConstantlyShow, TestSize.Level0)
1094 {
1095     SessionInfo info;
1096     info.abilityName_ = "test";
1097     info.bundleName_ = "test";
1098     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1099     ASSERT_NE(nullptr, sceneSession);
1100 
1101     ssm_->sceneSessionMap_.insert({sceneSession->GetPersistentId(), sceneSession});
1102     bool isVisible;
1103     ssm_->NotifyStatusBarConstantlyShow(sceneSession->GetSessionProperty()->GetDisplayId(), false);
1104     ssm_->GetStatusBarConstantlyShow(sceneSession->GetSessionProperty()->GetDisplayId(), isVisible);
1105     EXPECT_EQ(isVisible, false);
1106     ssm_->sceneSessionMap_.erase(sceneSession->GetPersistentId());
1107 }
1108 
1109 /**
1110  * @tc.name: NotifyAppUseControlList
1111  * @tc.desc: NotifyAppUseControlList
1112  * @tc.type: FUNC
1113  */
1114 HWTEST_F(SceneSessionManagerTest10, NotifyAppUseControlList, Function | SmallTest | Level3)
1115 {
1116     ASSERT_NE(ssm_, nullptr);
1117     std::vector<AppUseControlInfo> controlList;
1118     controlList.emplace_back();
1119     EXPECT_EQ(WSError::WS_ERROR_INVALID_PERMISSION,
1120         ssm_->NotifyAppUseControlList(ControlAppType::APP_LOCK, -1, controlList));
1121 
1122     AppUseControlInfo appUseControlInfo;
1123     appUseControlInfo.bundleName_ = "bundleName";
1124     appUseControlInfo.appIndex_ = 1;
1125     appUseControlInfo.isNeedControl_ = true;
1126     EXPECT_EQ(WSError::WS_ERROR_INVALID_PERMISSION,
1127         ssm_->NotifyAppUseControlList(ControlAppType::APP_LOCK, -1, controlList));
1128 }
1129 
1130 /**
1131  * @tc.name: MinimizeMainSession
1132  * @tc.desc: test MinimizeMainSession
1133  * @tc.type: FUNC
1134  */
1135 HWTEST_F(SceneSessionManagerTest10, MinimizeMainSession, Function | SmallTest | Level3)
1136 {
1137     ASSERT_NE(ssm_, nullptr);
1138     SessionInfo sessionInfo;
1139     sessionInfo.bundleName_ = "MinimizeMainSessionBundle";
1140     sessionInfo.abilityName_ = "MinimizeMainSessionAbility";
1141     sessionInfo.appIndex_ = 0;
1142     sessionInfo.windowType_ = 1;
1143     sessionInfo.sessionState_ = SessionState::STATE_ACTIVE;
1144     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(sessionInfo, nullptr);
1145 
1146     ssm_->sceneSessionMap_.emplace(1, sceneSession);
1147     int userId = ssm_->currentUserId_.load();
1148     auto result = ssm_->MinimizeMainSession(sessionInfo.bundleName_, sessionInfo.appIndex_, userId);
1149     ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, result);
1150 
1151     result = ssm_->MinimizeMainSession(sessionInfo.bundleName_, sessionInfo.appIndex_, 1);
1152     ASSERT_EQ(WMError::WM_ERROR_INVALID_PERMISSION, result);
1153 }
1154 
1155 /**
1156  * @tc.name: ListWindowInfo
1157  * @tc.desc: WM_ERROR_INVALID_PERMISSION
1158  * @tc.type: FUNC
1159  */
1160 HWTEST_F(SceneSessionManagerTest10, ListWindowInfo01, Function | SmallTest | Level3)
1161 {
1162     WindowInfoOption windowInfoOption;
1163     std::vector<sptr<WindowInfo>> infos;
1164     ASSERT_EQ(ssm_->ListWindowInfo(windowInfoOption, infos), WMError::WM_ERROR_INVALID_PERMISSION);
1165 }
1166 
1167 /**
1168  * @tc.name: FilterForListWindowInfo01
1169  * @tc.desc: ALL
1170  * @tc.type: FUNC
1171  */
1172 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo01, Function | SmallTest | Level3)
1173 {
1174     ssm_->sceneSessionMap_.clear();
1175     InitTestSceneSessionForListWindowInfo();
1176     WindowInfoOption windowInfoOption;
1177     windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::ALL;
1178     windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1179     windowInfoOption.displayId = DISPLAY_ID_INVALID;
1180     windowInfoOption.windowId = 0;
1181     int32_t filterNum = 0;
1182     for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1183         if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1184             filterNum++;
1185         }
1186     }
1187     ASSERT_EQ(filterNum, 6);
1188     ssm_->sceneSessionMap_.clear();
1189 }
1190 
1191 /**
1192  * @tc.name: FilterForListWindowInfo02
1193  * @tc.desc: EXCLUDE_SYSTEM
1194  * @tc.type: FUNC
1195  */
1196 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo02, Function | SmallTest | Level3)
1197 {
1198     ssm_->sceneSessionMap_.clear();
1199     InitTestSceneSessionForListWindowInfo();
1200     WindowInfoOption windowInfoOption;
1201     windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::EXCLUDE_SYSTEM;
1202     windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1203     windowInfoOption.displayId = DISPLAY_ID_INVALID;
1204     windowInfoOption.windowId = 0;
1205     int32_t filterNum = 0;
1206     for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1207         if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1208             filterNum++;
1209         }
1210     }
1211     ASSERT_EQ(filterNum, 5);
1212     ssm_->sceneSessionMap_.clear();
1213 }
1214 
1215 /**
1216  * @tc.name: FilterForListWindowInfo03
1217  * @tc.desc: VISIBLE
1218  * @tc.type: FUNC
1219  */
1220 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo03, Function | SmallTest | Level3)
1221 {
1222     ssm_->sceneSessionMap_.clear();
1223     InitTestSceneSessionForListWindowInfo();
1224     WindowInfoOption windowInfoOption;
1225     windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::VISIBLE;
1226     windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1227     windowInfoOption.displayId = DISPLAY_ID_INVALID;
1228     windowInfoOption.windowId = 0;
1229     int32_t filterNum = 0;
1230     for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1231         if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1232             filterNum++;
1233         }
1234     }
1235     ASSERT_EQ(filterNum, 4);
1236     ssm_->sceneSessionMap_.clear();
1237 }
1238 
1239 /**
1240  * @tc.name: FilterForListWindowInfo04
1241  * @tc.desc: FOREGROUND
1242  * @tc.type: FUNC
1243  */
1244 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo04, Function | SmallTest | Level3)
1245 {
1246     ssm_->sceneSessionMap_.clear();
1247     InitTestSceneSessionForListWindowInfo();
1248     WindowInfoOption windowInfoOption;
1249     windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::FOREGROUND;
1250     windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1251     windowInfoOption.displayId = DISPLAY_ID_INVALID;
1252     windowInfoOption.windowId = 0;
1253     int32_t filterNum = 0;
1254     for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1255         if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1256             filterNum++;
1257         }
1258     }
1259     ASSERT_EQ(filterNum, 5);
1260     ssm_->sceneSessionMap_.clear();
1261 }
1262 
1263 /**
1264  * @tc.name: FilterForListWindowInfo05
1265  * @tc.desc: EXCLUDE_SYSTEM | VISIBLE
1266  * @tc.type: FUNC
1267  */
1268 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo05, Function | SmallTest | Level3)
1269 {
1270     ssm_->sceneSessionMap_.clear();
1271     InitTestSceneSessionForListWindowInfo();
1272     WindowInfoOption windowInfoOption;
1273     windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::EXCLUDE_SYSTEM | WindowInfoFilterOption::VISIBLE;
1274     windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1275     windowInfoOption.displayId = DISPLAY_ID_INVALID;
1276     windowInfoOption.windowId = 0;
1277     int32_t filterNum = 0;
1278     for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1279         if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1280             filterNum++;
1281         }
1282     }
1283     ASSERT_EQ(filterNum, 3);
1284     ssm_->sceneSessionMap_.clear();
1285 }
1286 
1287 /**
1288  * @tc.name: FilterForListWindowInfo06
1289  * @tc.desc: EXCLUDE_SYSTEM | FOREGROUND
1290  * @tc.type: FUNC
1291  */
1292 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo06, Function | SmallTest | Level3)
1293 {
1294     ssm_->sceneSessionMap_.clear();
1295     InitTestSceneSessionForListWindowInfo();
1296     WindowInfoOption windowInfoOption;
1297     windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::EXCLUDE_SYSTEM |
1298         WindowInfoFilterOption::FOREGROUND;
1299     windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1300     windowInfoOption.displayId = DISPLAY_ID_INVALID;
1301     windowInfoOption.windowId = 0;
1302     int32_t filterNum = 0;
1303     for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1304         if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1305             filterNum++;
1306         }
1307     }
1308     ASSERT_EQ(filterNum, 4);
1309     ssm_->sceneSessionMap_.clear();
1310 }
1311 
1312 /**
1313  * @tc.name: FilterForListWindowInfo07
1314  * @tc.desc: FOREGROUND | VISIBLE
1315  * @tc.type: FUNC
1316  */
1317 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo07, Function | SmallTest | Level3)
1318 {
1319     ssm_->sceneSessionMap_.clear();
1320     InitTestSceneSessionForListWindowInfo();
1321     WindowInfoOption windowInfoOption;
1322     windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::FOREGROUND | WindowInfoFilterOption::VISIBLE;
1323     windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1324     windowInfoOption.displayId = DISPLAY_ID_INVALID;
1325     windowInfoOption.windowId = 0;
1326     int32_t filterNum = 0;
1327     for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1328         if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1329             filterNum++;
1330         }
1331     }
1332     ASSERT_EQ(filterNum, 4);
1333     ssm_->sceneSessionMap_.clear();
1334 }
1335 
1336 /**
1337  * @tc.name: FilterForListWindowInfo08
1338  * @tc.desc: displayId = 0
1339  * @tc.type: FUNC
1340  */
1341 HWTEST_F(SceneSessionManagerTest10, FilterForListWindowInfo08, Function | SmallTest | Level3)
1342 {
1343     ssm_->sceneSessionMap_.clear();
1344     InitTestSceneSessionForListWindowInfo();
1345     WindowInfoOption windowInfoOption;
1346     windowInfoOption.windowInfoFilterOption = WindowInfoFilterOption::ALL;
1347     windowInfoOption.windowInfoTypeOption = WindowInfoTypeOption::ALL;
1348     windowInfoOption.displayId = 0;
1349     windowInfoOption.windowId = 0;
1350     int32_t filterNum = 0;
1351     for (const auto& [_, sceneSession] : ssm_->sceneSessionMap_) {
1352         if (ssm_->FilterForListWindowInfo(windowInfoOption, sceneSession)) {
1353             filterNum++;
1354         }
1355     }
1356     ASSERT_EQ(filterNum, 5);
1357     ssm_->sceneSessionMap_.clear();
1358 }
1359 }  // namespace
1360 }
1361 }