1 /*
2  * Copyright (c) 2023 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 #include "window_helper.h"
16 #include "display_manager.h"
17 #include "pointer_event.h"
18 
19 #include <gtest/gtest.h>
20 #include "key_event.h"
21 #include "session/host/include/scene_session.h"
22 #include "session/host/include/sub_session.h"
23 #include "session/host/include/system_session.h"
24 #include "session/host/include/main_session.h"
25 #include "wm_common.h"
26 #include "mock/mock_session_stage.h"
27 #include "input_event.h"
28 #include <pointer_event.h>
29 
30 using namespace testing;
31 using namespace testing::ext;
32 namespace OHOS {
33 namespace Rosen {
34 class SceneSessionTest : public testing::Test {
35 public:
36     static void SetUpTestCase();
37     static void TearDownTestCase();
38     void SetUp() override;
39     void TearDown() override;
40 };
41 
SetUpTestCase()42 void SceneSessionTest::SetUpTestCase()
43 {
44 }
45 
TearDownTestCase()46 void SceneSessionTest::TearDownTestCase()
47 {
48 }
49 
SetUp()50 void SceneSessionTest::SetUp()
51 {
52 }
53 
TearDown()54 void SceneSessionTest::TearDown()
55 {
56 }
57 
58 namespace {
59 
60 /**
61  * @tc.name: SetGlobalMaximizeMode01
62  * @tc.desc: SetGlobalMaximizeMode
63  * @tc.type: FUNC
64  */
65 HWTEST_F(SceneSessionTest, SetGlobalMaximizeMode01, Function | SmallTest | Level2)
66 {
67     SessionInfo info;
68     info.abilityName_ = "Background01";
69     info.bundleName_ = "Background01";
70     sptr<Rosen::ISession> session_;
71     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
72         new (std::nothrow) SceneSession::SpecificSessionCallback();
73     EXPECT_NE(specificCallback_, nullptr);
74     sptr<SceneSession> scensession;
75     scensession = new (std::nothrow) SceneSession(info, nullptr);
76     EXPECT_NE(scensession, nullptr);
77     scensession->isActive_ = true;
78     auto result = scensession->SetGlobalMaximizeMode(MaximizeMode::MODE_AVOID_SYSTEM_BAR);
79     ASSERT_EQ(result, WSError::WS_OK);
80 }
81 
82 /**
83  * @tc.name: GetGlobalMaximizeMode01
84  * @tc.desc: GetGlobalMaximizeMode
85  * @tc.type: FUNC
86  */
87 HWTEST_F(SceneSessionTest, GetGlobalMaximizeMode01, Function | SmallTest | Level2)
88 {
89     SessionInfo info;
90     info.abilityName_ = "Background01";
91     info.bundleName_ = "Background01";
92     sptr<Rosen::ISession> session_;
93     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
94         new (std::nothrow) SceneSession::SpecificSessionCallback();
95     EXPECT_NE(specificCallback_, nullptr);
96 
97     sptr<SceneSession> scensession;
98     scensession = new (std::nothrow) SceneSession(info, nullptr);
99     EXPECT_NE(scensession, nullptr);
100     scensession->isActive_ = true;
101     MaximizeMode mode;
102     auto result = scensession->GetGlobalMaximizeMode(mode);
103     ASSERT_EQ(result, WSError::WS_OK);
104 }
105 
106 /**
107  * @tc.name: SetAndGetPipTemplateInfo
108  * @tc.desc: SetAndGetPipTemplateInfo Test
109  * @tc.type: FUNC
110  */
111 HWTEST_F(SceneSessionTest, SetAndGetPipTemplateInfo, Function | SmallTest | Level2)
112 {
113     SessionInfo info;
114     info.abilityName_ = "Background01";
115     info.bundleName_ = "Background01";
116     sptr<Rosen::ISession> session_;
117     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
118         new (std::nothrow) SceneSession::SpecificSessionCallback();
119     EXPECT_NE(specificCallback_, nullptr);
120 
121     sptr<SceneSession> scensession;
122     scensession = new (std::nothrow) SceneSession(info, nullptr);
123     EXPECT_NE(scensession, nullptr);
124     scensession->isActive_ = true;
125     PiPTemplateInfo pipTemplateInfo;
126     pipTemplateInfo.pipTemplateType = static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL);
127     scensession->SetPiPTemplateInfo(pipTemplateInfo);
128     ASSERT_EQ(scensession->GetPiPTemplateInfo().pipTemplateType,
129         static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL));
130 }
131 
132 /**
133  * @tc.name: UpdateWindowSceneAfterCustomAnimation01
134  * @tc.desc: UpdateWindowSceneAfterCustomAnimation
135  * @tc.type: FUNC
136  */
137 HWTEST_F(SceneSessionTest, UpdateWindowSceneAfterCustomAnimation01, Function | SmallTest | Level2)
138 {
139     SessionInfo info;
140     info.abilityName_ = "Background01";
141     info.bundleName_ = "Background01";
142     sptr<Rosen::ISession> session_;
143     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
144         new (std::nothrow) SceneSession::SpecificSessionCallback();
145     EXPECT_NE(specificCallback_, nullptr);
146     sptr<SceneSession> scensession;
147     scensession = new (std::nothrow) SceneSession(info, nullptr);
148     EXPECT_NE(scensession, nullptr);
149     scensession->isActive_ = true;
150     auto result = scensession->UpdateWindowSceneAfterCustomAnimation(false);
151     ASSERT_EQ(result, WSError::WS_OK);
152     result = scensession->UpdateWindowSceneAfterCustomAnimation(true);
153     ASSERT_EQ(result, WSError::WS_OK);
154 }
155 
156 /**
157  * @tc.name: SetZOrder01
158  * @tc.desc: SetZOrder
159  * @tc.type: FUNC
160  */
161 HWTEST_F(SceneSessionTest, SetZOrder01, Function | SmallTest | Level2)
162 {
163     SessionInfo info;
164     info.abilityName_ = "Background01";
165     info.bundleName_ = "Background01";
166     sptr<Rosen::ISession> session_;
167     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
168         new (std::nothrow) SceneSession::SpecificSessionCallback();
169     EXPECT_NE(specificCallback_, nullptr);
170     int resultValue = 0;
171     sptr<SceneSession> scensession;
172     scensession = new (std::nothrow) SceneSession(info, nullptr);
173     EXPECT_NE(scensession, nullptr);
174     scensession->SetZOrder(2);
175     ASSERT_EQ(0, resultValue);
176 }
177 
178 /**
179  * @tc.name: GetTouchHotAreas01
180  * @tc.desc: GetTouchHotAreas
181  * @tc.type: FUNC
182  */
183 HWTEST_F(SceneSessionTest, GetTouchHotAreas01, Function | SmallTest | Level2)
184 {
185     SessionInfo info;
186     info.abilityName_ = "Background01";
187     info.bundleName_ = "GetTouchHotAreas01";
188     sptr<Rosen::ISession> session_;
189     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
190         new (std::nothrow) SceneSession::SpecificSessionCallback();
191     EXPECT_NE(specificCallback_, nullptr);
192     sptr<SceneSession> scensession;
193     scensession = new (std::nothrow) SceneSession(info, nullptr);
194     EXPECT_NE(scensession, nullptr);
195     Rect windowRect = {1, 1, 1, 1};
196     std::vector<Rect> rects;
197     uint32_t hotAreasNum = 10;
198     uint32_t hotAreaWidth = windowRect.width_ / hotAreasNum;
199     uint32_t hotAreaHeight = windowRect.height_ / hotAreasNum;
200     for (uint32_t i = 0; i < hotAreasNum; ++i) {
201         rects.emplace_back(Rect{hotAreaWidth * i, hotAreaHeight * i, hotAreaWidth, hotAreaHeight});
202     }
203     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
204 
205     ASSERT_NE(nullptr, property);
206     property->SetTouchHotAreas(rects);
207     ASSERT_NE(rects, scensession->GetTouchHotAreas());
208 }
209 
210 /**
211  * @tc.name: SetTurnScreenOn01
212  * @tc.desc: SetTurnScreenOn
213  * @tc.type: FUNC
214  */
215 HWTEST_F(SceneSessionTest, SetTurnScreenOn01, Function | SmallTest | Level2)
216 {
217     SessionInfo info;
218     info.abilityName_ = "Background01";
219     info.bundleName_ = "Background01";
220     sptr<Rosen::ISession> session_;
221     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
222         new (std::nothrow) SceneSession::SpecificSessionCallback();
223     EXPECT_NE(specificCallback_, nullptr);
224     sptr<SceneSession> scensession;
225     scensession = new (std::nothrow) SceneSession(info, nullptr);
226     EXPECT_NE(scensession, nullptr);
227     sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
228     ASSERT_NE(mockSessionStage, nullptr);
229     ASSERT_EQ(WSError::WS_OK, scensession->SetTurnScreenOn(false));
230     ASSERT_EQ(false, scensession->IsTurnScreenOn());
231     ASSERT_EQ(WSError::WS_OK, scensession->SetTurnScreenOn(true));
232     ASSERT_EQ(true, scensession->IsTurnScreenOn());
233 }
234 
235 /**
236  * @tc.name: UpdateWindowAnimationFlag01
237  * @tc.desc: UpdateWindowAnimationFlag
238  * @tc.type: FUNC
239  */
240 HWTEST_F(SceneSessionTest, UpdateWindowAnimationFlag01, Function | SmallTest | Level2)
241 {
242     SessionInfo info;
243     info.abilityName_ = "Background01";
244     info.bundleName_ = "Background01";
245     sptr<Rosen::ISession> session_;
246     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
247         new (std::nothrow) SceneSession::SpecificSessionCallback();
248     EXPECT_NE(specificCallback_, nullptr);
249     sptr<SceneSession> scensession;
250     scensession = new (std::nothrow) SceneSession(info, nullptr);
251     EXPECT_NE(scensession, nullptr);
252     sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
253     ASSERT_NE(mockSessionStage, nullptr);
254     ASSERT_EQ(WSError::WS_OK, scensession->UpdateWindowAnimationFlag(false));
255 }
256 
257 /**
258  * @tc.name: ClearEnterWindow01
259  * @tc.desc: ClearEnterWindow
260  * @tc.type: FUNC
261  */
262 HWTEST_F(SceneSessionTest, ClearEnterWindow01, Function | SmallTest | Level2)
263 {
264     SessionInfo info;
265     info.abilityName_ = "Background01";
266     info.bundleName_ = "ClearEnterWindow01";
267     sptr<Rosen::ISession> session_;
268     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
269         new (std::nothrow) SceneSession::SpecificSessionCallback();
270     EXPECT_NE(specificCallback_, nullptr);
271     sptr<SceneSession> scensession;
272     scensession = new (std::nothrow) SceneSession(info, nullptr);
273     EXPECT_NE(scensession, nullptr);
274     int resultValue = 0;
275     SceneSession::ClearEnterWindow();
276     ASSERT_EQ(resultValue, 0);
277 }
278 
279 /**
280  * @tc.name: GetEnterWindow01
281  * @tc.desc: GetEnterWindow
282  * @tc.type: FUNC
283  */
284 HWTEST_F(SceneSessionTest, GetEnterWindow01, Function | SmallTest | Level2)
285 {
286     SessionInfo info;
287     info.abilityName_ = "Background01";
288     info.bundleName_ = "GetEnterWindow01";
289     sptr<Rosen::ISession> session_;
290     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
291         new (std::nothrow) SceneSession::SpecificSessionCallback();
292     EXPECT_NE(specificCallback_, nullptr);
293     sptr<SceneSession> scensession;
294     scensession = new (std::nothrow) SceneSession(info, nullptr);
295     EXPECT_NE(scensession, nullptr);
296     wptr<SceneSession> scenesession_;
297     ASSERT_EQ(scenesession_, SceneSession::GetEnterWindow());
298 }
299 
300 /**
301  * @tc.name: SetRequestedOrientation
302  * @tc.desc: SetRequestedOrientation
303  * @tc.type: FUNC
304  */
305 HWTEST_F(SceneSessionTest, SetRequestedOrientation01, Function | SmallTest | Level2)
306 {
307     SessionInfo info;
308     info.abilityName_ = "Background01";
309     info.bundleName_ = "SetRequestedOrientation";
310     sptr<SceneSession> scensession;
311     scensession = new (std::nothrow) SceneSession(info, nullptr);
312     EXPECT_NE(scensession, nullptr);
313     Orientation ori = Orientation::UNSPECIFIED;
314     scensession->SetRequestedOrientation(ori);
315     Orientation ret = scensession->GetRequestedOrientation();
316     ASSERT_EQ(ori, ret);
317 
318     scensession->SetRequestedOrientation(Orientation::AUTO_ROTATION_UNSPECIFIED);
319     Orientation ret1 = scensession->GetRequestedOrientation();
320     ASSERT_EQ(ret1, Orientation::AUTO_ROTATION_UNSPECIFIED);
321 
322     scensession->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT);
323     Orientation ret2 = scensession->GetRequestedOrientation();
324     ASSERT_EQ(ret2, Orientation::USER_ROTATION_PORTRAIT);
325 
326     scensession->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE);
327     Orientation ret3 = scensession->GetRequestedOrientation();
328     ASSERT_EQ(ret3, Orientation::USER_ROTATION_LANDSCAPE);
329 
330     scensession->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT_INVERTED);
331     Orientation ret4 = scensession->GetRequestedOrientation();
332     ASSERT_EQ(ret4, Orientation::USER_ROTATION_PORTRAIT_INVERTED);
333 
334     scensession->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
335     Orientation ret5 = scensession->GetRequestedOrientation();
336     ASSERT_EQ(ret5, Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
337 
338     scensession->SetRequestedOrientation(Orientation::FOLLOW_DESKTOP);
339     Orientation ret6 = scensession->GetRequestedOrientation();
340     ASSERT_EQ(ret6, Orientation::FOLLOW_DESKTOP);
341 }
342 
343 /**
344  * @tc.name: GetRequestedOrientation
345  * @tc.desc: GetRequestedOrientation
346  * @tc.type: FUNC
347  */
348 HWTEST_F(SceneSessionTest, GetRequestedOrientation, Function | SmallTest | Level2)
349 {
350     SessionInfo info;
351     info.abilityName_ = "Background01";
352     info.bundleName_ = "GetRequestedOrientation";
353     sptr<SceneSession> scensession;
354     scensession = new (std::nothrow) SceneSession(info, nullptr);
355     EXPECT_NE(scensession, nullptr);
356     Orientation ori = Orientation::HORIZONTAL;
357     scensession->SetRequestedOrientation(ori);
358     Orientation ret = scensession->GetRequestedOrientation();
359     ASSERT_EQ(ori, ret);
360 
361     scensession->SetRequestedOrientation(Orientation::AUTO_ROTATION_UNSPECIFIED);
362     Orientation ret1 = scensession->GetRequestedOrientation();
363     ASSERT_EQ(ret1, Orientation::AUTO_ROTATION_UNSPECIFIED);
364 
365     scensession->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT);
366     Orientation ret2 = scensession->GetRequestedOrientation();
367     ASSERT_EQ(ret2, Orientation::USER_ROTATION_PORTRAIT);
368 
369     scensession->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE);
370     Orientation ret3 = scensession->GetRequestedOrientation();
371     ASSERT_EQ(ret3, Orientation::USER_ROTATION_LANDSCAPE);
372 
373     scensession->SetRequestedOrientation(Orientation::USER_ROTATION_PORTRAIT_INVERTED);
374     Orientation ret4 = scensession->GetRequestedOrientation();
375     ASSERT_EQ(ret4, Orientation::USER_ROTATION_PORTRAIT_INVERTED);
376 
377     scensession->SetRequestedOrientation(Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
378     Orientation ret5 = scensession->GetRequestedOrientation();
379     ASSERT_EQ(ret5, Orientation::USER_ROTATION_LANDSCAPE_INVERTED);
380 
381     scensession->SetRequestedOrientation(Orientation::FOLLOW_DESKTOP);
382     Orientation ret6 = scensession->GetRequestedOrientation();
383     ASSERT_EQ(ret6, Orientation::FOLLOW_DESKTOP);
384 }
385 
386 /**
387  * @tc.name: SetDefaultRequestedOrientation
388  * @tc.desc: SetDefaultRequestedOrientation
389  * @tc.type: FUNC
390  */
391 HWTEST_F(SceneSessionTest, SetDefaultRequestedOrientation, Function | SmallTest | Level2)
392 {
393     SessionInfo info;
394     info.abilityName_ = "Background01";
395     info.bundleName_ = "SetDefaultRequestedOrientation";
396     sptr<SceneSession> sceneSession;
397     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
398     EXPECT_NE(sceneSession, nullptr);
399     Orientation orientation = Orientation::AUTO_ROTATION_UNSPECIFIED;
400     sceneSession->SetDefaultRequestedOrientation(orientation);
401     Orientation ret = sceneSession->GetRequestedOrientation();
402     ASSERT_EQ(orientation, ret);
403 }
404 
405 /**
406  * @tc.name: IsKeepScreenOn
407  * @tc.desc: IsKeepScreenOn
408  * @tc.type: FUNC
409  */
410 HWTEST_F(SceneSessionTest, IsKeepScreenOn, Function | SmallTest | Level2)
411 {
412     SessionInfo info;
413     info.abilityName_ = "Background01";
414     info.bundleName_ = "IsKeepScreenOn";
415     sptr<Rosen::ISession> session_;
416     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
417         new (std::nothrow) SceneSession::SpecificSessionCallback();
418     EXPECT_NE(specificCallback_, nullptr);
419     sptr<SceneSession> scensession;
420     scensession = new (std::nothrow) SceneSession(info, nullptr);
421     EXPECT_NE(scensession, nullptr);
422     ASSERT_EQ(WSError::WS_OK, scensession->SetKeepScreenOn(false));
423     ASSERT_EQ(false, scensession->IsKeepScreenOn());
424 }
425 
426 /**
427  * @tc.name: IsAppSession
428  * @tc.desc: IsAppSession true
429  * @tc.type: FUNC
430  */
431 HWTEST_F(SceneSessionTest, IsAppSession01, Function | SmallTest | Level2)
432 {
433     SessionInfo info;
434     info.abilityName_ = "Background01";
435     info.bundleName_ = "IsAppSession";
436     info.windowType_ = 1;
437     sptr<Rosen::ISession> session_;
438     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
439         new (std::nothrow) SceneSession::SpecificSessionCallback();
440     EXPECT_NE(specificCallback_, nullptr);
441     sptr<SceneSession> scensession;
442     scensession = new (std::nothrow) SceneSession(info, nullptr);
443     EXPECT_NE(scensession, nullptr);
444     ASSERT_EQ(true, scensession->IsAppSession());
445 }
446 
447 /**
448  * @tc.name: IsAppSession
449  * @tc.desc: IsAppSession false
450  * @tc.type: FUNC
451  */
452 HWTEST_F(SceneSessionTest, IsAppSession02, Function | SmallTest | Level2)
453 {
454     SessionInfo info;
455     info.abilityName_ = "Background01";
456     info.bundleName_ = "IsAppSession";
457     info.windowType_ = 2106;
458     sptr<Rosen::ISession> session_;
459     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
460         new (std::nothrow) SceneSession::SpecificSessionCallback();
461     EXPECT_NE(specificCallback_, nullptr);
462     sptr<SceneSession> scensession;
463     scensession = new (std::nothrow) SceneSession(info, nullptr);
464     EXPECT_NE(scensession, nullptr);
465     ASSERT_EQ(false, scensession->IsAppSession());
466 
467     SessionInfo parentInfo;
468     parentInfo.abilityName_ = "testSession1";
469     parentInfo.moduleName_ = "testSession2";
470     parentInfo.bundleName_ = "testSession3";
471     sptr<Session> parentSession = sptr<Session>::MakeSptr(parentInfo);
472     ASSERT_NE(parentSession, nullptr);
473 
474     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
475     EXPECT_NE(property, nullptr);
476     property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
477     parentSession->SetSessionProperty(property);
478     scensession->SetParentSession(parentSession);
479     ASSERT_EQ(false, scensession->IsAppSession());
480 
481     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
482     parentSession->SetSessionProperty(property);
483     scensession->SetParentSession(parentSession);
484     ASSERT_EQ(true, scensession->IsAppSession());
485 }
486 
487 /**
488  * @tc.name: IsAppOrLowerSystemSession
489  * @tc.desc: IsAppOrLowerSystemSession true
490  * @tc.type: FUNC
491  */
492 HWTEST_F(SceneSessionTest, IsAppOrLowerSystemSession01, Function | SmallTest | Level2)
493 {
494     SessionInfo info;
495     info.abilityName_ = "Background01";
496     info.bundleName_ = "IsAppOrLowerSystemSession01";
497     info.windowType_ = 2126;
498 
499     sptr<SceneSession> scensession;
500     scensession = new (std::nothrow) SceneSession(info, nullptr);
501     EXPECT_NE(scensession, nullptr);
502     ASSERT_EQ(true, scensession->IsAppOrLowerSystemSession());
503 }
504 
505 /**
506  * @tc.name: IsAppOrLowerSystemSession
507  * @tc.desc: IsAppOrLowerSystemSession false
508  * @tc.type: FUNC
509  */
510 HWTEST_F(SceneSessionTest, IsAppOrLowerSystemSession02, Function | SmallTest | Level2)
511 {
512     SessionInfo info;
513     info.abilityName_ = "Background02";
514     info.bundleName_ = "IsAppOrLowerSystemSession02";
515     info.windowType_ = 2106;
516 
517     sptr<SceneSession> scensession;
518     scensession = new (std::nothrow) SceneSession(info, nullptr);
519     EXPECT_NE(scensession, nullptr);
520     ASSERT_EQ(false, scensession->IsAppOrLowerSystemSession());
521 
522     SessionInfo parentInfo;
523     parentInfo.abilityName_ = "testSession1";
524     parentInfo.moduleName_ = "testSession2";
525     parentInfo.bundleName_ = "testSession3";
526     sptr<Session> parentSession = sptr<Session>::MakeSptr(parentInfo);
527     ASSERT_NE(parentSession, nullptr);
528 
529     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
530     EXPECT_NE(property, nullptr);
531     property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
532     parentSession->SetSessionProperty(property);
533     scensession->SetParentSession(parentSession);
534     ASSERT_EQ(false, scensession->IsAppOrLowerSystemSession());
535 
536     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
537     parentSession->SetSessionProperty(property);
538     scensession->SetParentSession(parentSession);
539     ASSERT_EQ(true, scensession->IsAppOrLowerSystemSession());
540 }
541 
542 /**
543  * @tc.name: IsSystemSessionAboveApp
544  * @tc.desc: IsSystemSessionAboveApp true
545  * @tc.type: FUNC
546  */
547 HWTEST_F(SceneSessionTest, IsSystemSessionAboveApp01, Function | SmallTest | Level2)
548 {
549     SessionInfo info1;
550     info1.abilityName_ = "HighZOrder01";
551     info1.bundleName_ = "IsSystemSessionAboveApp01";
552     info1.windowType_ = 2122;
553 
554     sptr<SceneSession> scensession1;
555     scensession1 = new (std::nothrow) SceneSession(info1, nullptr);
556     EXPECT_NE(scensession1, nullptr);
557     ASSERT_EQ(true, scensession1->IsSystemSessionAboveApp());
558 
559     SessionInfo info2;
560     info2.abilityName_ = "HighZOrder02";
561     info2.bundleName_ = "IsSystemSessionAboveApp02";
562     info2.windowType_ = 2104;
563 
564     sptr<SceneSession> scensession2;
565     scensession2 = new (std::nothrow) SceneSession(info2, nullptr);
566     EXPECT_NE(scensession2, nullptr);
567     ASSERT_EQ(true, scensession2->IsSystemSessionAboveApp());
568 
569     SessionInfo info3;
570     info3.abilityName_ = "HighZOrder03";
571     info3.bundleName_ = "SCBDropdownPanel13";
572     info3.windowType_ = 2109;
573 
574     sptr<SceneSession> scensession3;
575     scensession3 = new (std::nothrow) SceneSession(info3, nullptr);
576     EXPECT_NE(scensession3, nullptr);
577     ASSERT_EQ(true, scensession3->IsSystemSessionAboveApp());
578 
579     SessionInfo info4;
580     info4.abilityName_ = "HighZOrder04";
581     info4.bundleName_ = "IsSystemSessionAboveApp04";
582     info4.windowType_ = 2109;
583 
584     sptr<SceneSession> scensession4;
585     scensession4 = new (std::nothrow) SceneSession(info4, nullptr);
586     EXPECT_NE(scensession4, nullptr);
587     ASSERT_EQ(false, scensession4->IsSystemSessionAboveApp());
588 }
589 
590 /**
591  * @tc.name: IsSystemSessionAboveApp
592  * @tc.desc: IsSystemSessionAboveApp false
593  * @tc.type: FUNC
594  */
595 HWTEST_F(SceneSessionTest, IsSystemSessionAboveApp02, Function | SmallTest | Level2)
596 {
597     SessionInfo info;
598     info.abilityName_ = "HighZOrder05";
599     info.bundleName_ = "IsSystemSessionAboveApp05";
600     info.windowType_ = 1;
601 
602     sptr<SceneSession> scensession;
603     scensession = new (std::nothrow) SceneSession(info, nullptr);
604     EXPECT_NE(scensession, nullptr);
605     ASSERT_EQ(false, scensession->IsSystemSessionAboveApp());
606 }
607 
608 /**
609  * @tc.name: GetWindowName
610  * @tc.desc: GetWindowName
611  * @tc.type: FUNC
612  */
613 HWTEST_F(SceneSessionTest, GetWindowName, Function | SmallTest | Level2)
614 {
615     SessionInfo info;
616     info.abilityName_ = "Background01";
617     info.bundleName_ = "GetWindowName";
618     sptr<Rosen::ISession> session_;
619     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
620         new (std::nothrow) SceneSession::SpecificSessionCallback();
621     EXPECT_NE(specificCallback_, nullptr);
622     sptr<SceneSession> scensession;
623     scensession = new (std::nothrow) SceneSession(info, nullptr);
624     EXPECT_NE(scensession, nullptr);
625     ASSERT_NE("ww", scensession->GetWindowName());
626 }
627 
628 /**
629  * @tc.name: IsDecorEnable
630  * @tc.desc: IsDecorEnable
631  * @tc.type: FUNC
632  */
633 HWTEST_F(SceneSessionTest, IsDecorEnable, Function | SmallTest | Level2)
634 {
635     SessionInfo info;
636     info.abilityName_ = "Background01";
637     info.bundleName_ = "IsDecorEnable";
638     info.windowType_ = 1;
639     sptr<Rosen::ISession> session_;
640     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
641         new (std::nothrow) SceneSession::SpecificSessionCallback();
642     EXPECT_NE(specificCallback_, nullptr);
643     sptr<SceneSession> scensession;
644     scensession = new (std::nothrow) SceneSession(info, nullptr);
645     EXPECT_NE(scensession, nullptr);
646     ASSERT_EQ(true, scensession->IsDecorEnable());
647     SessionInfo info_;
648     info_.abilityName_ = "Background01";
649     info_.bundleName_ = "IsDecorEnable";
650     info_.windowType_ = 1000;
651     sptr<SceneSession> scensession_;
652     scensession_ = new (std::nothrow) SceneSession(info_, nullptr);
653     EXPECT_NE(scensession_, nullptr);
654     ASSERT_EQ(false, scensession_->IsDecorEnable());
655 }
656 
657 /**
658  * @tc.name: IsDecorEnable01
659  * @tc.desc: IsDecorEnable
660  * @tc.type: FUNC
661  */
662 HWTEST_F(SceneSessionTest, IsDecorEnable01, Function | SmallTest | Level2)
663 {
664     SessionInfo info;
665     info.abilityName_ = "Background01";
666     info.bundleName_ = "IsDecorEnable01";
667     info.windowType_ = 1;
668     sptr<Rosen::ISession> session_;
669     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
670         new (std::nothrow) SceneSession::SpecificSessionCallback();
671     EXPECT_NE(specificCallback_, nullptr);
672 
673     sptr<SceneSession> scensession;
674     scensession = new (std::nothrow) SceneSession(info, nullptr);
675     EXPECT_NE(scensession, nullptr);
676     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
677     EXPECT_NE(property, nullptr);
678     property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
679     property->SetDecorEnable(true);
680     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
681     scensession->property_ = property;
682     ASSERT_EQ(true, scensession->IsDecorEnable());
683 
684     sptr<SceneSession> scensession_;
685     scensession_ = new (std::nothrow) SceneSession(info, nullptr);
686     EXPECT_NE(scensession_, nullptr);
687     property = new (std::nothrow) WindowSessionProperty();
688     EXPECT_NE(property, nullptr);
689     property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
690     property->SetDecorEnable(false);
691     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
692     ASSERT_EQ(true, scensession_->IsDecorEnable());
693 
694     scensession_->SetSessionProperty(nullptr);
695     ASSERT_EQ(false, scensession_->IsDecorEnable());
696 }
697 
698 /**
699  * @tc.name: UpdateNativeVisibility
700  * @tc.desc: UpdateNativeVisibility
701  * @tc.type: FUNC
702  */
703 HWTEST_F(SceneSessionTest, UpdateNativeVisibility, Function | SmallTest | Level2)
704 {
705     SessionInfo info;
706     info.abilityName_ = "Background01";
707     info.bundleName_ = "UpdateNativeVisibility";
708     info.windowType_ = 1;
709     sptr<Rosen::ISession> session_;
710     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
711         new (std::nothrow) SceneSession::SpecificSessionCallback();
712     EXPECT_NE(specificCallback_, nullptr);
713     sptr<SceneSession> scensession;
714     scensession = new (std::nothrow) SceneSession(info, nullptr);
715     EXPECT_NE(scensession, nullptr);
716     scensession->UpdateNativeVisibility(false);
717     ASSERT_EQ(false, scensession->IsVisible());
718     scensession->NotifyWindowVisibility();
719 
720     sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
721     ASSERT_NE(mockSessionStage, nullptr);
722     scensession->sessionStage_ = mockSessionStage;
723     scensession->NotifyWindowVisibility();
724 }
725 
726 /**
727  * @tc.name: SetPrivacyMode
728  * @tc.desc: SetPrivacyMode
729  * @tc.type: FUNC
730  */
731 HWTEST_F(SceneSessionTest, SetPrivacyMode, Function | SmallTest | Level2)
732 {
733     SessionInfo info;
734     info.abilityName_ = "Background01";
735     info.bundleName_ = "SetPrivacyMode";
736     info.windowType_ = 1;
737     sptr<Rosen::ISession> session_;
738     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
739         new (std::nothrow) SceneSession::SpecificSessionCallback();
740     EXPECT_NE(specificCallback_, nullptr);
741     sptr<SceneSession> scensession;
742     scensession = new (std::nothrow) SceneSession(info, nullptr);
743     EXPECT_NE(scensession, nullptr);
744     int ret = 0;
745     scensession->SetPrivacyMode(false);
746     ASSERT_EQ(0, ret);
747 }
748 
749 /**
750  * @tc.name: IsFloatingWindowAppType
751  * @tc.desc: IsFloatingWindowAppType
752  * @tc.type: FUNC
753  */
754 HWTEST_F(SceneSessionTest, IsFloatingWindowAppType, Function | SmallTest | Level2)
755 {
756     SessionInfo info;
757     info.abilityName_ = "Background01";
758     info.bundleName_ = "IsFloatingWindowAppType";
759     info.windowType_ = 1;
760     sptr<Rosen::ISession> session_;
761     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
762         new (std::nothrow) SceneSession::SpecificSessionCallback();
763     EXPECT_NE(specificCallback_, nullptr);
764     sptr<SceneSession> scensession;
765     scensession = new (std::nothrow) SceneSession(info, nullptr);
766     EXPECT_NE(scensession, nullptr);
767     ASSERT_EQ(false, scensession->IsFloatingWindowAppType());
768 
769     scensession->SetSessionProperty(nullptr);
770     ASSERT_EQ(false, scensession->IsFloatingWindowAppType());
771 }
772 
773 /**
774  * @tc.name: DumpSessionElementInfo01
775  * @tc.desc: DumpSessionElementInfo
776  * @tc.type: FUNC
777  */
778 HWTEST_F(SceneSessionTest, DumpSessionElementInfo, Function | SmallTest | Level2)
779 {
780     SessionInfo info;
781     info.abilityName_ = "Background01";
782     info.bundleName_ = "IsFloatingWindowAppType";
783     info.windowType_ = 1;
784     sptr<Rosen::ISession> session_;
785     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
786         new (std::nothrow) SceneSession::SpecificSessionCallback();
787     EXPECT_NE(specificCallback_, nullptr);
788     sptr<SceneSession> scensession;
789     scensession = new (std::nothrow) SceneSession(info, nullptr);
790     EXPECT_NE(scensession, nullptr);
791     sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
792     ASSERT_NE(mockSessionStage, nullptr);
793     std::vector<std::string> params;
794     scensession->DumpSessionElementInfo(params);
795     int ret = 1;
796     scensession->sessionStage_ = mockSessionStage;
797     scensession->DumpSessionElementInfo(params);
798     ASSERT_EQ(ret, 1);
799 }
800 
801 /**
802  * @tc.name: SaveAspectRatio
803  * @tc.desc: SaveAspectRatio
804  * @tc.type: FUNC
805  */
806 HWTEST_F(SceneSessionTest, SaveAspectRatio, Function | SmallTest | Level2)
807 {
808     SessionInfo info;
809     info.abilityName_ = "Background01";
810     info.bundleName_ = "IsFloatingWindowAppType";
811     info.windowType_ = 1;
812     sptr<SceneSession> scensession;
813     scensession = new (std::nothrow) SceneSession(info, nullptr);
814     EXPECT_NE(scensession, nullptr);
815     ASSERT_EQ(true, scensession->SaveAspectRatio(0.1));
816 
817     scensession->sessionInfo_.bundleName_ = "";
818     scensession->sessionInfo_.moduleName_ = "";
819     scensession->sessionInfo_.abilityName_ = "";
820     ASSERT_EQ(false, scensession->SaveAspectRatio(0.1));
821 }
822 
823 /**
824  * @tc.name: NotifyIsCustomAnimationPlaying
825  * @tc.desc: NotifyIsCustomAnimationPlaying
826  * @tc.type: FUNC
827  */
828 HWTEST_F(SceneSessionTest, NotifyIsCustomAnimationPlaying, Function | SmallTest | Level2)
829 {
830     SessionInfo info;
831     info.abilityName_ = "Background01";
832     info.bundleName_ = "IsFloatingWindowAppType";
833     info.windowType_ = 1;
834     sptr<Rosen::ISession> session_;
835     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
836         new (std::nothrow) SceneSession::SpecificSessionCallback();
837     EXPECT_NE(specificCallback_, nullptr);
838     sptr<SceneSession> sceneSession;
839     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
840     EXPECT_NE(sceneSession, nullptr);
841     sceneSession->NotifyIsCustomAnimationPlaying(false);
842 
__anoneb811a820202(bool status) 843     sceneSession->onIsCustomAnimationPlaying_ = [](bool status) {};
844     sceneSession->NotifyIsCustomAnimationPlaying(false);
845 }
846 
847 /**
848  * @tc.name: ModalUIExtension
849  * @tc.desc: ModalUIExtension
850  * @tc.type: FUNC
851  */
852 HWTEST_F(SceneSessionTest, ModalUIExtension, Function | SmallTest | Level2)
853 {
854     SessionInfo info;
855     info.abilityName_ = "ModalUIExtension";
856     info.bundleName_ = "ModalUIExtension";
857     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
858     ASSERT_NE(sceneSession, nullptr);
859 
860     EXPECT_FALSE(sceneSession->GetLastModalUIExtensionEventInfo());
861     ExtensionWindowEventInfo extensionInfo;
862     extensionInfo.persistentId = 12345;
863     extensionInfo.pid = 1234;
864     extensionInfo.windowRect = { 1, 2, 3, 4 };
865     sceneSession->AddModalUIExtension(extensionInfo);
866 
867     auto getInfo = sceneSession->GetLastModalUIExtensionEventInfo();
868     EXPECT_TRUE(getInfo);
869     EXPECT_EQ(getInfo.value().persistentId, extensionInfo.persistentId);
870     EXPECT_EQ(getInfo.value().pid, extensionInfo.pid);
871     EXPECT_EQ(getInfo.value().windowRect, extensionInfo.windowRect);
872 
873     Rect windowRect = { 5, 6, 7, 8 };
874     extensionInfo.windowRect = windowRect;
875     sceneSession->UpdateModalUIExtension(extensionInfo);
876     getInfo = sceneSession->GetLastModalUIExtensionEventInfo();
877     EXPECT_TRUE(getInfo);
878     EXPECT_EQ(getInfo.value().windowRect, windowRect);
879 
880     sceneSession->RemoveModalUIExtension(extensionInfo.persistentId);
881     EXPECT_FALSE(sceneSession->GetLastModalUIExtensionEventInfo());
882 }
883 
884 /**
885  * @tc.name: NotifySessionRectChange
886  * @tc.desc: NotifySessionRectChange
887  * @tc.type: FUNC
888  */
889 HWTEST_F(SceneSessionTest, NotifySessionRectChange, Function | SmallTest | Level2)
890 {
891     SessionInfo info;
892     info.abilityName_ = "Background01";
893     info.bundleName_ = "IsFloatingWindowAppType";
894     info.windowType_ = 1;
895     sptr<Rosen::ISession> session_;
896     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
897         new (std::nothrow) SceneSession::SpecificSessionCallback();
898     EXPECT_NE(specificCallback_, nullptr);
899     sptr<SceneSession> scensession;
900     scensession = new (std::nothrow) SceneSession(info, nullptr);
901     EXPECT_NE(scensession, nullptr);
902     WSRect overlapRect = { 0, 0, 0, 0 };
903     scensession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION);
904 
__anoneb811a820302(const WSRect& rect, const SizeChangeReason& reason) 905     scensession->sessionRectChangeFunc_ = [](const WSRect& rect, const SizeChangeReason& reason) {
906         return;
907     };
908     scensession->NotifySessionRectChange(overlapRect, SizeChangeReason::ROTATION);
909 }
910 
911 /**
912  * @tc.name: FixRectByAspectRatio
913  * @tc.desc: FixRectByAspectRatio
914  * @tc.type: FUNC
915  */
916 HWTEST_F(SceneSessionTest, FixRectByAspectRatio, Function | SmallTest | Level2)
917 {
918     SessionInfo info;
919     info.abilityName_ = "Background01";
920     info.bundleName_ = "IsFloatingWindowAppType";
921     info.windowType_ = 1;
922     sptr<Rosen::ISession> session_;
923     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
924         new (std::nothrow) SceneSession::SpecificSessionCallback();
925     EXPECT_NE(specificCallback_, nullptr);
926     sptr<SceneSession> scensession;
927     scensession = new (std::nothrow) SceneSession(info, nullptr);
928     EXPECT_NE(scensession, nullptr);
929     WSRect originalRect_ = { 0, 0, 0, 0 };
930     ASSERT_EQ(false, scensession->FixRectByAspectRatio(originalRect_));
931 }
932 
933 /**
934  * @tc.name: GetKeyboardAvoidArea
935  * @tc.desc: GetKeyboardAvoidArea
936  * @tc.type: FUNC
937  */
938 HWTEST_F(SceneSessionTest, GetKeyboardAvoidArea, Function | SmallTest | Level2)
939 {
940     SessionInfo info;
941     info.abilityName_ = "Background01";
942     info.bundleName_ = "IsFloatingWindowAppType";
943     info.windowType_ = 1;
944     sptr<Rosen::ISession> session_;
945     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
946         new (std::nothrow) SceneSession::SpecificSessionCallback();
947     EXPECT_NE(specificCallback_, nullptr);
948     specificCallback_->onGetSceneSessionVectorByType_ = [](WindowType type,
__anoneb811a820402(WindowType type, uint64_t displayId) 949         uint64_t displayId) -> std::vector<sptr<SceneSession>> {
950         std::vector<sptr<SceneSession>> backgroundSession;
951         return backgroundSession;
952     };
953 
954     sptr<SceneSession> scensession;
955     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
956     EXPECT_NE(scensession, nullptr);
957     WSRect overlapRect = {0, 0, 0, 0};
958     AvoidArea avoidArea;
959     int ret = 1;
960     scensession->GetKeyboardAvoidArea(overlapRect, avoidArea);
961     ASSERT_EQ(ret, 1);
962 }
963 
964 /**
965  * @tc.name: GetCutoutAvoidArea
966  * @tc.desc: GetCutoutAvoidArea
967  * @tc.type: FUNC
968  */
969 HWTEST_F(SceneSessionTest, GetCutoutAvoidArea, Function | SmallTest | Level2)
970 {
971     SessionInfo info;
972     info.abilityName_ = "Background01";
973     info.bundleName_ = "IsFloatingWindowAppType";
974     info.windowType_ = 1;
975     sptr<Rosen::ISession> session_;
976     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
977         new (std::nothrow) SceneSession::SpecificSessionCallback();
978     EXPECT_NE(specificCallback_, nullptr);
979     sptr<SceneSession> scensession;
980     scensession = new (std::nothrow) SceneSession(info, nullptr);
981     EXPECT_NE(scensession, nullptr);
982     WSRect overlapRect = { 0, 0, 0, 0 };
983     AvoidArea avoidArea;
984     int ret = 1;
985     scensession->GetCutoutAvoidArea(overlapRect, avoidArea);
986     ASSERT_EQ(ret, 1);
987 }
988 
989 /**
990  * @tc.name: SetSystemBarProperty
991  * @tc.desc: SetSystemBarProperty
992  * @tc.type: FUNC
993  */
994 HWTEST_F(SceneSessionTest, SetSystemBarProperty, Function | SmallTest | Level2)
995 {
996     SessionInfo info;
997     info.abilityName_ = "Background01";
998     info.bundleName_ = "IsFloatingWindowAppType";
999     info.windowType_ = 1;
1000     sptr<Rosen::ISession> session_;
1001     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1002         new (std::nothrow) SceneSession::SpecificSessionCallback();
1003     EXPECT_NE(specificCallback_, nullptr);
1004 
1005     sptr<SceneSession> scensession;
1006     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1007     EXPECT_NE(scensession, nullptr);
1008     scensession->property_ = nullptr;
1009     SystemBarProperty statusBarProperty;
1010     scensession->SetSystemBarProperty(WindowType::WINDOW_TYPE_FLOAT_CAMERA, statusBarProperty);
1011     ASSERT_EQ(scensession->SetSystemBarProperty(WindowType::WINDOW_TYPE_FLOAT_CAMERA, statusBarProperty),
1012               WSError::WS_ERROR_NULLPTR);
1013     sptr<WindowSessionProperty> property = new WindowSessionProperty();
1014     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1015     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1016     scensession->property_ = property;
1017     ASSERT_EQ(scensession->SetSystemBarProperty(WindowType::WINDOW_TYPE_FLOAT_CAMERA, statusBarProperty),
1018               WSError::WS_OK);
1019 }
1020 
1021 /**
1022  * @tc.name: OnShowWhenLocked
1023  * @tc.desc: OnShowWhenLocked
1024  * @tc.type: FUNC ok
1025  */
1026 HWTEST_F(SceneSessionTest, OnShowWhenLocked, Function | SmallTest | Level2)
1027 {
1028     SessionInfo info;
1029     info.abilityName_ = "Background01";
1030     info.bundleName_ = "IsFloatingWindowAppType";
1031     info.windowType_ = 1;
1032     sptr<Rosen::ISession> session_;
1033     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1034         new (std::nothrow) SceneSession::SpecificSessionCallback();
1035     EXPECT_NE(specificCallback_, nullptr);
1036     sptr<SceneSession> scensession;
1037     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1038     EXPECT_NE(scensession, nullptr);
1039     int ret = 0;
1040     scensession->OnShowWhenLocked(false);
1041     ASSERT_EQ(ret, 0);
1042 }
1043 
1044 /**
1045  * @tc.name: IsShowWhenLocked
1046  * @tc.desc: IsShowWhenLocked
1047  * @tc.type: FUNC ok
1048  */
1049 HWTEST_F(SceneSessionTest, IsShowWhenLocked, Function | SmallTest | Level2)
1050 {
1051     SessionInfo info;
1052     info.abilityName_ = "Background01";
1053     info.bundleName_ = "IsFloatingWindowAppType";
1054     info.windowType_ = 1;
1055     sptr<Rosen::ISession> session_;
1056     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1057         new (std::nothrow) SceneSession::SpecificSessionCallback();
1058     EXPECT_NE(specificCallback_, nullptr);
1059     sptr<SceneSession> scensession;
1060     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1061     EXPECT_NE(scensession, nullptr);
1062     sptr<WindowSessionProperty> property = new WindowSessionProperty();
1063     EXPECT_NE(property, nullptr);
1064     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1065     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1066     ASSERT_EQ(scensession->IsShowWhenLocked(), false);
1067     scensession->property_ = property;
1068     scensession->SetTemporarilyShowWhenLocked(true);
1069     ASSERT_EQ(scensession->IsShowWhenLocked(), true);
1070     property->SetWindowFlags(4);
1071     scensession->SetTemporarilyShowWhenLocked(false);
1072     ASSERT_EQ(scensession->IsShowWhenLocked(), true);
1073     scensession->SetTemporarilyShowWhenLocked(true);
1074     ASSERT_EQ(scensession->IsShowWhenLocked(), true);
1075 }
1076 
1077 /**
1078  * @tc.name: GetAvoidAreaByType
1079  * @tc.desc: GetAvoidAreaByType
1080  * @tc.type: FUNC ok
1081  */
1082 HWTEST_F(SceneSessionTest, GetAvoidAreaByType, Function | SmallTest | Level2)
1083 {
1084     SessionInfo info;
1085     info.abilityName_ = "Background01";
1086     info.bundleName_ = "IsFloatingWindowAppType";
1087     info.windowType_ = 1;
1088     sptr<Rosen::ISession> session_;
1089     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1090         new (std::nothrow) SceneSession::SpecificSessionCallback();
1091     EXPECT_NE(specificCallback_, nullptr);
1092         specificCallback_->onGetSceneSessionVectorByType_ = [](WindowType type,
1093             uint64_t displayId)-> std::vector<sptr<SceneSession>>
__anoneb811a820502(WindowType type, uint64_t displayId)1094     {
1095         SessionInfo info_;
1096         info_.abilityName_ = "Background01";
1097         info_.bundleName_ = "IsFloatingWindowAppType";
1098         std::vector<sptr<SceneSession>> backgroundSession;
1099         sptr<SceneSession> session2=new (std::nothrow) SceneSession(info_, nullptr);
1100         backgroundSession.push_back(session2);
1101         return backgroundSession;
1102     };
1103     sptr<SceneSession> scensession;
1104     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1105     EXPECT_NE(scensession, nullptr);
1106     WSRect rect = { 0, 0, 320, 240}; // width: 320, height: 240
1107     scensession->SetSessionRect(rect);
1108     sptr<WindowSessionProperty> property = new WindowSessionProperty();
1109     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1110     scensession->property_ = property;
1111     AvoidArea avoidArea;
1112     scensession->GetAvoidAreaByType(AvoidAreaType::TYPE_CUTOUT);
1113     scensession->GetAvoidAreaByType(AvoidAreaType::TYPE_SYSTEM);
1114     scensession->GetAvoidAreaByType(AvoidAreaType::TYPE_KEYBOARD);
1115     scensession->GetAvoidAreaByType(AvoidAreaType::TYPE_SYSTEM_GESTURE);
1116     EXPECT_NE(scensession, nullptr);
1117 }
1118 
1119 /**
1120  * @tc.name: TransferPointerEvent
1121  * @tc.desc: TransferPointerEvent
1122  * @tc.type: FUNC
1123  */
1124 HWTEST_F(SceneSessionTest, TransferPointerEvent, Function | SmallTest | Level2)
1125 {
1126     SessionInfo info;
1127     info.abilityName_ = "Background01";
1128     info.bundleName_ = "IsFloatingWindowAppType";
1129     info.windowType_ = 1;
1130     sptr<Rosen::ISession> session_;
1131     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1132         new (std::nothrow) SceneSession::SpecificSessionCallback();
1133     EXPECT_NE(specificCallback_, nullptr);
1134     sptr<SceneSession> scensession;
1135     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1136     EXPECT_NE(scensession, nullptr);
1137     std::shared_ptr<MMI::PointerEvent> pointerEvent = nullptr;
1138     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent), WSError::WS_ERROR_NULLPTR);
1139     std::shared_ptr<MMI::PointerEvent> pointerEvent_ =  MMI::PointerEvent::Create();
1140     sptr<WindowSessionProperty> property = new WindowSessionProperty();
1141     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1142     property->SetMaximizeMode(MaximizeMode::MODE_FULL_FILL);
1143     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1144     property->SetPersistentId(11);
1145     scensession->property_ = property;
1146     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent_), WSError::WS_ERROR_INVALID_SESSION);
1147 }
1148 
1149 /**
1150  * @tc.name: TransferPointerEventDecorDialog
1151  * @tc.desc: TransferPointerEventDecorDialog
1152  * @tc.type: FUNC
1153  */
1154 HWTEST_F(SceneSessionTest, TransferPointerEventDecorDialog, Function | SmallTest | Level2)
1155 {
1156     SessionInfo info;
1157     info.abilityName_ = "TransferPointerEventDecorDialog";
1158     info.bundleName_ = "TransferPointerEventDecorDialogBundle";
1159     info.windowType_ = 2122;
1160     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1161         new (std::nothrow) SceneSession::SpecificSessionCallback();
1162     sptr<SceneSession> scensession =
1163         new (std::nothrow) SceneSession(info, specificCallback_);
1164     scensession->moveDragController_ = new MoveDragController(12);
1165     scensession->SetSessionState(SessionState::STATE_ACTIVE);
1166     std::shared_ptr<MMI::PointerEvent> pointerEvent_ =  MMI::PointerEvent::Create();
1167     sptr<WindowSessionProperty> property = new WindowSessionProperty();
1168     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1169     property->SetMaximizeMode(MaximizeMode::MODE_FULL_FILL);
1170     property->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
1171     property->SetDecorEnable(true);
1172     property->SetDragEnabled(true);
1173     property->SetPersistentId(12);
1174     scensession->property_ = property;
1175     EXPECT_NE(scensession, nullptr);
1176 }
1177 
1178 /**
1179  * @tc.name: CalculateAvoidAreaRect
1180  * @tc.desc: CalculateAvoidAreaRect
1181  * @tc.type: FUNC
1182  */
1183 HWTEST_F(SceneSessionTest, CalculateAvoidAreaRect, Function | SmallTest | Level2)
1184 {
1185     SessionInfo info;
1186     info.abilityName_ = "Background01";
1187     info.bundleName_ = "IsFloatingWindowAppType";
1188     info.windowType_ = 1;
1189     sptr<Rosen::ISession> session_;
1190     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1191         new (std::nothrow) SceneSession::SpecificSessionCallback();
1192     EXPECT_NE(specificCallback_, nullptr);
1193     sptr<SceneSession> scensession;
1194     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1195     EXPECT_NE(scensession, nullptr);
1196     int ret = 0;
1197     WSRect overlapRect = { 0, 0, 0, 0 };
1198     WSRect avoidRect = { 0, 0, 0, 0 };
1199     AvoidArea avoidArea;
1200     scensession->CalculateAvoidAreaRect(overlapRect, avoidRect, avoidArea);
1201     WSRect overlapRect_ = { 1, 1, 1, 1 };
1202     WSRect avoidRect_ = { 1, 1, 1, 1 };
1203     scensession->CalculateAvoidAreaRect(overlapRect_, avoidRect_, avoidArea);
1204     ASSERT_EQ(ret, 0);
1205 }
1206 
1207 /**
1208  * @tc.name: OnNeedAvoid
1209  * @tc.desc: OnNeedAvoid
1210  * @tc.type: FUNC
1211  */
1212 HWTEST_F(SceneSessionTest, OnNeedAvoid, Function | SmallTest | Level2)
1213 {
1214     SessionInfo info;
1215     info.abilityName_ = "Background01";
1216     info.bundleName_ = "IsFloatingWindowAppType";
1217     info.windowType_ = 1;
1218     sptr<Rosen::ISession> session_;
1219     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1220         new (std::nothrow) SceneSession::SpecificSessionCallback();
1221     EXPECT_NE(specificCallback_, nullptr);
1222     sptr<SceneSession> scensession;
1223     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1224     EXPECT_NE(scensession, nullptr);
1225     ASSERT_EQ(scensession->OnNeedAvoid(false), WSError::WS_OK);
1226 }
1227 
1228 /**
1229  * @tc.name: SetCollaboratorType
1230  * @tc.desc: SetCollaboratorType
1231  * @tc.type: FUNC
1232  */
1233 HWTEST_F(SceneSessionTest, SetCollaboratorType, Function | SmallTest | Level2)
1234 {
1235     SessionInfo info;
1236     info.abilityName_ = "Background01";
1237     info.bundleName_ = "IsFloatingWindowAppType";
1238     info.windowType_ = 1;
1239     sptr<Rosen::ISession> session_;
1240     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1241         new (std::nothrow) SceneSession::SpecificSessionCallback();
1242     EXPECT_NE(specificCallback_, nullptr);
1243     sptr<SceneSession> scensession;
1244     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1245     EXPECT_NE(scensession, nullptr);
1246     scensession->SetCollaboratorType(2);
1247     ASSERT_EQ(scensession->GetCollaboratorType(), 2);
1248 }
1249 
1250 /**
1251  * @tc.name: GetAbilityInfo
1252  * @tc.desc: GetAbilityInfo
1253  * @tc.type: FUNC
1254  */
1255 HWTEST_F(SceneSessionTest, GetAbilityInfo, Function | SmallTest | Level2)
1256 {
1257     SessionInfo info;
1258     info.abilityName_ = "Background01";
1259     info.bundleName_ = "IsFloatingWindowAppType";
1260     info.windowType_ = 1;
1261     sptr<Rosen::ISession> session_;
1262     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1263         new (std::nothrow) SceneSession::SpecificSessionCallback();
1264     EXPECT_NE(specificCallback_, nullptr);
1265     sptr<SceneSession> scensession;
1266     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1267     EXPECT_NE(scensession, nullptr);
1268     std::shared_ptr<AppExecFwk::AbilityInfo> abilityInfo;
1269     scensession->SetAbilitySessionInfo(abilityInfo);
1270     ASSERT_EQ(scensession->GetAbilityInfo(), abilityInfo);
1271 }
1272 
1273 /**
1274  * @tc.name: UpdateCameraWindowStatus
1275  * @tc.desc: UpdateCameraWindowStatus
1276  * @tc.type: FUNC
1277  */
1278 HWTEST_F(SceneSessionTest, UpdateCameraWindowStatus, Function | SmallTest | Level2)
1279 {
1280     SessionInfo info;
1281     info.abilityName_ = "Background01";
1282     info.bundleName_ = "UpdateCameraWindowStatus";
1283     info.windowType_ = 1;
1284     sptr<Rosen::ISession> session_;
1285     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1286         new (std::nothrow) SceneSession::SpecificSessionCallback();
1287     EXPECT_NE(specificCallback_, nullptr);
1288     sptr<SystemSession> sysSession;
1289     sysSession = new (std::nothrow) SystemSession(info, specificCallback_);
1290     EXPECT_NE(sysSession, nullptr);
1291     int ret = 1;
__anoneb811a820602(uint32_t accessTokenId, bool isShowing) 1292     specificCallback_->onCameraFloatSessionChange_ = [](uint32_t accessTokenId, bool isShowing) {};
__anoneb811a820702(uint32_t accessTokenId, bool isShowing) 1293     specificCallback_->onCameraSessionChange_ = [](uint32_t accessTokenId, bool isShowing) {};
1294 
1295     sysSession->UpdateCameraWindowStatus(false);
1296     sysSession = new (std::nothrow) SystemSession(info, specificCallback_);
1297     sysSession->UpdateCameraWindowStatus(false);
1298     sptr<WindowSessionProperty> property = new WindowSessionProperty();
1299     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1300     sysSession->property_ = property;
1301     sysSession->UpdateCameraWindowStatus(false);
1302     property->SetWindowType(WindowType::WINDOW_TYPE_FLOAT_CAMERA);
1303     sysSession->property_ = property;
1304     sysSession->UpdateCameraWindowStatus(false);
1305     property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
1306     property->SetWindowMode(WindowMode::WINDOW_MODE_PIP);
1307     PiPTemplateInfo pipType;
1308     pipType.pipTemplateType = static_cast<uint32_t>(PiPTemplateType::VIDEO_CALL);
1309     sysSession->SetPiPTemplateInfo(pipType);
1310     sysSession->property_ = property;
1311     sysSession->UpdateCameraWindowStatus(false);
1312     ASSERT_EQ(ret, 1);
1313 }
1314 
1315 /**
1316  * @tc.name: GetRatioPreferenceKey
1317  * @tc.desc: GetRatioPreferenceKey
1318  * @tc.type: FUNC
1319  */
1320 HWTEST_F(SceneSessionTest, GetRatioPreferenceKey, Function | SmallTest | Level2)
1321 {
1322     SessionInfo info;
1323     info.abilityName_ = "ability";
1324     info.bundleName_ = "bundle";
1325     info.moduleName_ = "module";
1326     info.windowType_ = 1;
1327     sptr<Rosen::ISession> session_;
1328     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1329         new (std::nothrow) SceneSession::SpecificSessionCallback();
1330     EXPECT_NE(specificCallback_, nullptr);
1331     sptr<SceneSession> scensession;
1332     scensession = new (std::nothrow) SceneSession(info, nullptr);
1333     EXPECT_NE(scensession, nullptr);
1334     std::string key = info.bundleName_ + info.moduleName_ + info.abilityName_;
1335     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1336     ASSERT_EQ(key, scensession->GetRatioPreferenceKey());
1337 
1338     std::string key2(30, 'a');
1339     std::string key3(80, 'a');
1340     scensession->sessionInfo_.bundleName_ = key2;
1341     scensession->sessionInfo_.moduleName_ = key2;
1342     scensession->sessionInfo_.abilityName_ = key2;
1343     ASSERT_EQ(key3, scensession->GetRatioPreferenceKey());
1344 }
1345 
1346 /**
1347  * @tc.name: NotifyPropertyWhenConnect
1348  * @tc.desc: NotifyPropertyWhenConnect
1349  * @tc.type: FUNC
1350  */
1351 HWTEST_F(SceneSessionTest, NotifyPropertyWhenConnect, Function | SmallTest | Level2)
1352 {
1353     SessionInfo info;
1354     info.abilityName_ = "ability";
1355     info.bundleName_ = "bundle";
1356     info.moduleName_ = "module";
1357     info.windowType_ = 1;
1358     sptr<Rosen::ISession> session_;
1359     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1360         new (std::nothrow) SceneSession::SpecificSessionCallback();
1361     EXPECT_NE(specificCallback_, nullptr);
1362     sptr<SceneSession> scensession;
1363     scensession = new (std::nothrow) SceneSession(info, nullptr);
1364     EXPECT_NE(scensession, nullptr);
1365     int ret = 1;
1366     std::string key = info.bundleName_ + info.moduleName_ + info.abilityName_;
1367     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1368     scensession->NotifyPropertyWhenConnect();
1369     sptr<WindowSessionProperty> property = new WindowSessionProperty();
1370     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1371     scensession->property_ = property;
1372     scensession->NotifyPropertyWhenConnect();
1373     ASSERT_EQ(ret, 1);
1374 }
1375 
1376 /**
1377  * @tc.name: DumpSessionInfo
1378  * @tc.desc: DumpSessionInfo
1379  * @tc.type: FUNC
1380  */
1381 HWTEST_F(SceneSessionTest, DumpSessionInfo, Function | SmallTest | Level2)
1382 {
1383     SessionInfo info;
1384     info.bundleName_ = "SceneSessionTest";
1385     info.abilityName_ = "DumpSessionInfo";
1386     info.windowType_ = 1;
1387     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1388     EXPECT_NE(scensession, nullptr);
1389     std::vector<std::string> infos;
1390     scensession->DumpSessionInfo(infos);
1391     ASSERT_FALSE(infos.empty());
1392 }
1393 
1394 /**
1395  * @tc.name: OnSessionEvent
1396  * @tc.desc: normal function
1397  * @tc.type: FUNC
1398  */
1399 HWTEST_F(SceneSessionTest, OnSessionEvent, Function | SmallTest | Level2)
1400 {
1401     SessionInfo info;
1402     info.abilityName_ = "OnSessionEvent";
1403     info.bundleName_ = "OnSessionEvent";
1404     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1405     EXPECT_NE(sceneSession, nullptr);
1406     sceneSession->moveDragController_ = new MoveDragController(1);
1407     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1408     sceneSession->OnSessionEvent(SessionEvent::EVENT_START_MOVE);
1409     sceneSession->moveDragController_->isStartDrag_ = true;
1410     sceneSession->moveDragController_->hasPointDown_ = true;
1411     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1412     EXPECT_NE(sceneSession->sessionChangeCallback_, nullptr);
1413     ASSERT_EQ(sceneSession->OnSessionEvent(SessionEvent::EVENT_START_MOVE), WSError::WS_OK);
1414     ASSERT_EQ(sceneSession->OnSessionEvent(SessionEvent::EVENT_END_MOVE), WSError::WS_OK);
1415 }
1416 
1417 /**
1418  * @tc.name: SyncSessionEvent
1419  * @tc.desc: normal function
1420  * @tc.type: FUNC
1421  */
1422 HWTEST_F(SceneSessionTest, SyncSessionEvent, Function | SmallTest | Level2)
1423 {
1424     SessionInfo info;
1425     info.abilityName_ = "SyncSessionEvent";
1426     info.bundleName_ = "SyncSessionEvent";
1427     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1428 
1429     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
1430     property->SetWindowType(WindowType::WINDOW_TYPE_GLOBAL_SEARCH);
1431     property->isSystemCalling_ = true;
1432     sceneSession->SetSessionProperty(property);
1433     sceneSession->isActive_ = false;
1434     sceneSession->moveDragController_ = sptr<MoveDragController>::MakeSptr(sceneSession->GetPersistentId());
1435 
1436     SessionEvent event = SessionEvent::EVENT_START_MOVE;
1437     auto result = sceneSession->SyncSessionEvent(event);
1438     ASSERT_EQ(result, WSError::WS_OK);
1439 
1440     property->isSystemCalling_ = false;
1441     result = sceneSession->SyncSessionEvent(event);
1442     ASSERT_EQ(result, WSError::WS_OK);
1443 }
1444 
1445 /**
1446  * @tc.name: SetTopmost
1447  * @tc.desc: normal function
1448  * @tc.type: FUNC
1449  */
1450 HWTEST_F(SceneSessionTest, SetTopmost, Function | SmallTest | Level2)
1451 {
1452     SessionInfo info;
1453     info.abilityName_ = "SetTopmost";
1454     info.bundleName_ = "SetTopmost";
1455     sptr<Rosen::ISession> session_;
1456     sptr<SceneSession> scenesession = new (std::nothrow) MainSession(info, nullptr);
1457     EXPECT_NE(scenesession, nullptr);
1458 
1459     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1460     scenesession->SetSessionProperty(property);
1461     auto result = scenesession->SetTopmost(false);
1462     ASSERT_EQ(result, WSError::WS_OK);
1463     ASSERT_FALSE(scenesession->IsTopmost());
1464 }
1465 
1466 /**
1467  * @tc.name: SetMainWindowTopmost
1468  * @tc.desc: normal function
1469  * @tc.type: FUNC
1470  */
1471 HWTEST_F(SceneSessionTest, SetMainWindowTopmost, Function | SmallTest | Level2)
1472 {
1473     SessionInfo info;
1474     info.abilityName_ = "SetMainWindowTopmost";
1475     info.bundleName_ = "SetMainWindowTopmost";
1476     sptr<SceneSession> sceneSession = sptr<MainSession>::MakeSptr(info);
1477     auto result = sceneSession->SetMainWindowTopmost(false);
1478     ASSERT_EQ(result, WSError::WS_OK);
1479     ASSERT_FALSE(sceneSession->IsMainWindowTopmost());
1480 }
1481 
1482 /**
1483  * @tc.name: SetAspectRatio2
1484  * @tc.desc: normal function
1485  * @tc.type: FUNC
1486  */
1487 HWTEST_F(SceneSessionTest, SetAspectRatio2, Function | SmallTest | Level2)
1488 {
1489     SessionInfo info;
1490     info.abilityName_ = "SetAspectRatio2";
1491     info.bundleName_ = "SetAspectRatio2";
1492     sptr<Rosen::ISession> session_;
1493     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1494         new (std::nothrow) SceneSession::SpecificSessionCallback();
1495     EXPECT_NE(specificCallback_, nullptr);
1496     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1497     EXPECT_NE(scensession, nullptr);
1498     scensession->isActive_ = true;
1499 
1500     float ratio = 0.0001;
1501     auto result = scensession->SetAspectRatio(ratio);
1502     ASSERT_EQ(result, WSError::WS_OK);
1503 
1504     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1505     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1506     scensession->SetSessionProperty(property);
1507     result = scensession->SetAspectRatio(ratio);
1508     ASSERT_EQ(result, WSError::WS_OK);
1509 }
1510 
1511 /**
1512  * @tc.name: SetAspectRatio3
1513  * @tc.desc: normal function
1514  * @tc.type: FUNC
1515  */
1516 HWTEST_F(SceneSessionTest, SetAspectRatio3, Function | SmallTest | Level2)
1517 {
1518     SessionInfo info;
1519     info.abilityName_ = "SetAspectRatio3";
1520     info.bundleName_ = "SetAspectRatio3";
1521     sptr<Rosen::ISession> session_;
1522     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1523         new (std::nothrow) SceneSession::SpecificSessionCallback();
1524     EXPECT_NE(specificCallback_, nullptr);
1525     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1526     EXPECT_NE(scensession, nullptr);
1527     scensession->isActive_ = true;
1528 
1529     float ratio = 0.1;
1530     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1531     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1532     scensession->SetSessionProperty(property);
1533     auto result = scensession->SetAspectRatio(ratio);
1534     ASSERT_EQ(result, WSError::WS_OK);
1535 }
1536 
1537 /**
1538  * @tc.name: SetAspectRatio4
1539  * @tc.desc: normal function
1540  * @tc.type: FUNC
1541  */
1542 HWTEST_F(SceneSessionTest, SetAspectRatio4, Function | SmallTest | Level2)
1543 {
1544     SessionInfo info;
1545     info.abilityName_ = "SetAspectRatio4";
1546     info.bundleName_ = "SetAspectRatio4";
1547     sptr<Rosen::ISession> session_;
1548     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1549         new (std::nothrow) SceneSession::SpecificSessionCallback();
1550     EXPECT_NE(specificCallback_, nullptr);
1551     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1552     EXPECT_NE(scensession, nullptr);
1553     scensession->isActive_ = true;
1554 
1555     float ratio = 0.1;
1556     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1557     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1558     WindowLimits limits;
1559     limits.maxHeight_ = 0;
1560     limits.minWidth_ = 0;
1561     property->SetWindowLimits(limits);
1562     scensession->SetSessionProperty(property);
1563     auto result = scensession->SetAspectRatio(ratio);
1564     ASSERT_EQ(result, WSError::WS_OK);
1565 }
1566 
1567 /**
1568  * @tc.name: SetAspectRatio5
1569  * @tc.desc: normal function
1570  * @tc.type: FUNC
1571  */
1572 HWTEST_F(SceneSessionTest, SetAspectRatio5, Function | SmallTest | Level2)
1573 {
1574     SessionInfo info;
1575     info.abilityName_ = "SetAspectRatio5";
1576     info.bundleName_ = "SetAspectRatio5";
1577     sptr<Rosen::ISession> session_;
1578     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1579         new (std::nothrow) SceneSession::SpecificSessionCallback();
1580     EXPECT_NE(specificCallback_, nullptr);
1581     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1582     EXPECT_NE(scensession, nullptr);
1583     scensession->isActive_ = true;
1584 
1585     float ratio = 0.1;
1586     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1587     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1588     WindowLimits limits;
1589     limits.maxHeight_ = 10;
1590     limits.minWidth_ = 0;
1591     property->SetWindowLimits(limits);
1592     scensession->SetSessionProperty(property);
1593     scensession->SetAspectRatio(ratio);
1594     EXPECT_NE(scensession, nullptr);
1595 }
1596 
1597 /**
1598  * @tc.name: SetAspectRatio6
1599  * @tc.desc: normal function
1600  * @tc.type: FUNC
1601  */
1602 HWTEST_F(SceneSessionTest, SetAspectRatio6, Function | SmallTest | Level2)
1603 {
1604     SessionInfo info;
1605     info.abilityName_ = "SetAspectRatio6";
1606     info.bundleName_ = "SetAspectRatio6";
1607     sptr<Rosen::ISession> session_;
1608     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1609         new (std::nothrow) SceneSession::SpecificSessionCallback();
1610     EXPECT_NE(specificCallback_, nullptr);
1611     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1612     EXPECT_NE(scensession, nullptr);
1613     scensession->isActive_ = true;
1614 
1615     float ratio = 0.1;
1616     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1617     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1618     WindowLimits limits;
1619     limits.maxHeight_ = 0;
1620     limits.minWidth_ = 10;
1621     property->SetWindowLimits(limits);
1622     scensession->SetSessionProperty(property);
1623     auto result = scensession->SetAspectRatio(ratio);
1624     ASSERT_EQ(result, WSError::WS_OK);
1625 }
1626 
1627 /**
1628  * @tc.name: SetAspectRatio7
1629  * @tc.desc: normal function
1630  * @tc.type: FUNC
1631  */
1632 HWTEST_F(SceneSessionTest, SetAspectRatio7, Function | SmallTest | Level2)
1633 {
1634     SessionInfo info;
1635     info.abilityName_ = "SetAspectRatio7";
1636     info.bundleName_ = "SetAspectRatio7";
1637     sptr<Rosen::ISession> session_;
1638     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1639         new (std::nothrow) SceneSession::SpecificSessionCallback();
1640     EXPECT_NE(specificCallback_, nullptr);
1641     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1642     EXPECT_NE(scensession, nullptr);
1643     scensession->isActive_ = true;
1644 
1645     float ratio = 0.1;
1646     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1647     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1648     WindowLimits limits;
1649     limits.maxHeight_ = 10;
1650     limits.minWidth_ = 10;
1651     property->SetWindowLimits(limits);
1652     scensession->SetSessionProperty(property);
1653     auto result = scensession->SetAspectRatio(ratio);
1654     ASSERT_EQ(result, WSError::WS_OK);
1655 }
1656 
1657 /**
1658  * @tc.name: UpdateRect
1659  * @tc.desc: normal function
1660  * @tc.type: FUNC
1661  */
1662 HWTEST_F(SceneSessionTest, UpdateRect, Function | SmallTest | Level2)
1663 {
1664     SessionInfo info;
1665     info.abilityName_ = "UpdateRect";
1666     info.bundleName_ = "UpdateRect";
1667     sptr<Rosen::ISession> session_;
1668     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1669         new (std::nothrow) SceneSession::SpecificSessionCallback();
1670     EXPECT_NE(specificCallback_, nullptr);
1671     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1672     EXPECT_NE(scensession, nullptr);
1673     scensession->isActive_ = true;
1674 
1675     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1676     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1677 
1678     scensession->SetSessionProperty(property);
1679     WSRect rect({1, 1, 1, 1});
1680     SizeChangeReason reason = SizeChangeReason::UNDEFINED;
1681     WSError result = scensession->UpdateRect(rect, reason, "SceneSessionTest");
1682     ASSERT_EQ(result, WSError::WS_OK);
1683 }
1684 
1685 /**
1686  * @tc.name: UpdateInputMethodSessionRect
1687  * @tc.desc: normal function
1688  * @tc.type: FUNC
1689  */
1690 HWTEST_F(SceneSessionTest, UpdateInputMethodSessionRect, Function | SmallTest | Level2)
1691 {
1692     SessionInfo info;
1693     info.abilityName_ = "UpdateInputMethodSessionRect";
1694     info.bundleName_ = "UpdateInputMethodSessionRect";
1695     sptr<Rosen::ISession> session_;
1696     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1697         new (std::nothrow) SceneSession::SpecificSessionCallback();
1698     EXPECT_NE(specificCallback_, nullptr);
1699     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1700     EXPECT_NE(sceneSession, nullptr);
1701     sceneSession->isActive_ = true;
1702 
1703     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1704     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1705     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1706 
1707     sceneSession->SetSessionProperty(property);
1708     WSRect rect({1, 1, 1, 1});
1709     WSRect newWinRect;
1710     WSRect newRequestRect;
1711 
1712     sceneSession->UpdateInputMethodSessionRect(rect, newWinRect, newRequestRect);
1713     EXPECT_NE(sceneSession, nullptr);
1714 
1715     sceneSession->SetSessionProperty(nullptr);
1716     sceneSession->UpdateInputMethodSessionRect(rect, newWinRect, newRequestRect);
1717 }
1718 
1719 /**
1720  * @tc.name: UpdateSessionRect
1721  * @tc.desc: normal function
1722  * @tc.type: FUNC
1723  */
1724 HWTEST_F(SceneSessionTest, UpdateSessionRect, Function | SmallTest | Level2)
1725 {
1726     SessionInfo info;
1727     info.abilityName_ = "UpdateSessionRect";
1728     info.bundleName_ = "UpdateSessionRect";
1729     sptr<Rosen::ISession> session_;
1730     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1731         new (std::nothrow) SceneSession::SpecificSessionCallback();
1732     EXPECT_NE(specificCallback_, nullptr);
1733     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1734     EXPECT_NE(scensession, nullptr);
1735     scensession->isActive_ = true;
1736 
1737     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1738     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1739     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1740 
1741     scensession->SetSessionProperty(property);
1742     WSRect rect({1, 1, 1, 1});
1743     SizeChangeReason reason = SizeChangeReason::MOVE;
1744     WSError result = scensession->UpdateSessionRect(rect, reason);
1745     ASSERT_EQ(result, WSError::WS_OK);
1746 }
1747 
1748 /**
1749  * @tc.name: UpdateSessionRect1
1750  * @tc.desc: normal function
1751  * @tc.type: FUNC
1752  */
1753 HWTEST_F(SceneSessionTest, UpdateSessionRect1, Function | SmallTest | Level2)
1754 {
1755     SessionInfo info;
1756     info.abilityName_ = "UpdateSessionRect";
1757     info.bundleName_ = "UpdateSessionRect";
1758     sptr<Rosen::ISession> session_;
1759     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1760         new (std::nothrow) SceneSession::SpecificSessionCallback();
1761     EXPECT_NE(specificCallback_, nullptr);
1762     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1763     EXPECT_NE(scensession, nullptr);
1764     scensession->isActive_ = true;
1765 
1766     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1767     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1768     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1769 
1770     scensession->SetSessionProperty(property);
1771     WSRect rect({1, 1, 1, 1});
1772     SizeChangeReason reason = SizeChangeReason::RESIZE;
1773     WSError result = scensession->UpdateSessionRect(rect, reason);
1774     ASSERT_EQ(result, WSError::WS_OK);
1775 }
1776 
1777 /**
1778  * @tc.name: UpdateSessionRect2
1779  * @tc.desc: normal function
1780  * @tc.type: FUNC
1781  */
1782 HWTEST_F(SceneSessionTest, UpdateSessionRect2, Function | SmallTest | Level2)
1783 {
1784     SessionInfo info;
1785     info.abilityName_ = "UpdateSessionRect";
1786     info.bundleName_ = "UpdateSessionRect";
1787     sptr<Rosen::ISession> session_;
1788     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1789         new (std::nothrow) SceneSession::SpecificSessionCallback();
1790     EXPECT_NE(specificCallback_, nullptr);
1791     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
1792     EXPECT_NE(scensession, nullptr);
1793     scensession->isActive_ = true;
1794 
1795     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1796     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1797     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1798 
1799     scensession->SetSessionProperty(property);
1800     WSRect rect({1, 1, 1, 1});
1801     SizeChangeReason reason = SizeChangeReason::UNDEFINED;
1802     WSError result = scensession->UpdateSessionRect(rect, reason);
1803     ASSERT_EQ(result, WSError::WS_OK);
1804 }
1805 
1806 /**
1807  * @tc.name: GetAppForceLandscapeConfig
1808  * @tc.desc: GetAppForceLandscapeConfig
1809  * @tc.type: FUNC
1810  */
1811 HWTEST_F(SceneSessionTest, GetAppForceLandscapeConfig, Function | SmallTest | Level2)
1812 {
1813     SessionInfo info;
1814     info.abilityName_ = "GetAppForceLandscapeConfig";
1815     info.bundleName_ = "GetAppForceLandscapeConfig";
1816     sptr<SceneSession::SpecificSessionCallback> specificCallback =
1817         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1818     EXPECT_NE(specificCallback, nullptr);
1819     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1820     EXPECT_NE(sceneSession, nullptr);
1821     AppForceLandscapeConfig config = {};
1822     auto result = sceneSession->GetAppForceLandscapeConfig(config);
1823     ASSERT_EQ(result, WMError::WM_ERROR_NULLPTR);
1824 }
1825 
1826 /**
1827  * @tc.name: HandleCompatibleModeMoveDrag
1828  * @tc.desc: HandleCompatibleModeMoveDrag
1829  * @tc.type: FUNC
1830  */
1831 HWTEST_F(SceneSessionTest, HandleCompatibleModeMoveDrag, Function | SmallTest | Level2)
1832 {
1833     SessionInfo info;
1834     info.abilityName_ = "HandleCompatibleModeMoveDrag";
1835     info.bundleName_ = "HandleCompatibleModeMoveDrag";
1836     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1837     EXPECT_NE(sceneSession, nullptr);
1838 
1839     WSRect rect = {1, 1, 1, 1};
1840     WSRect rect2 = {1, 1, 2, 1};
1841     sceneSession->winRect_ = rect2;
1842     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
1843     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
1844 
1845     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, false);
1846     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
1847 
1848     rect2 = {1, 1, 1, 2};
1849     sceneSession->winRect_ = rect2;
1850     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
1851     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
1852 
1853     rect = {1, 1, 2000, 1};
1854     rect2 = {1, 1, 2, 1};
1855     sceneSession->winRect_ = rect2;
1856     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
1857     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
1858 
1859     rect = {1, 1, 2000, 1};
1860     rect2 = {1, 1, 1, 2};
1861     sceneSession->winRect_ = rect2;
1862     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
1863     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
1864 
1865     rect = {1, 1, 500, 1};
1866     rect2 = {1, 1, 1, 2};
1867     sceneSession->winRect_ = rect2;
1868     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, true);
1869     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
1870 
1871     rect = {1, 1, 500, 1};
1872     rect2 = {1, 1, 1, 2};
1873     sceneSession->winRect_ = rect2;
1874     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::HIDE, false);
1875     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::HIDE);
1876 
1877     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::MOVE, false);
1878     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::MOVE);
1879 
1880     sceneSession->HandleCompatibleModeMoveDrag(rect, SizeChangeReason::DRAG_MOVE, false);
1881     ASSERT_EQ(sceneSession->reason_, SizeChangeReason::DRAG_MOVE);
1882 }
1883 
1884 /**
1885  * @tc.name: SetMoveDragCallback
1886  * @tc.desc: SetMoveDragCallback
1887  * @tc.type: FUNC
1888  */
1889 HWTEST_F(SceneSessionTest, SetMoveDragCallback, Function | SmallTest | Level2)
1890 {
1891     SessionInfo info;
1892     info.abilityName_ = "SetMoveDragCallback";
1893     info.bundleName_ = "SetMoveDragCallback";
1894     sptr<SceneSession::SpecificSessionCallback> specificCallback =
1895         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1896     EXPECT_NE(specificCallback, nullptr);
1897     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1898     EXPECT_NE(sceneSession, nullptr);
1899 
1900     sceneSession->moveDragController_ = nullptr;
1901     sceneSession->SetMoveDragCallback();
1902 }
1903 
1904 /**
1905  * @tc.name: GetScreenWidthAndHeightFromServer
1906  * @tc.desc: GetScreenWidthAndHeightFromServer
1907  * @tc.type: FUNC
1908  */
1909 HWTEST_F(SceneSessionTest, GetScreenWidthAndHeightFromServer, Function | SmallTest | Level2)
1910 {
1911     SessionInfo info;
1912     info.abilityName_ = "GetScreenWidthAndHeightFromServer";
1913     info.bundleName_ = "GetScreenWidthAndHeightFromServer";
1914     sptr<Rosen::ISession> session_;
1915     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1916         new (std::nothrow) SceneSession::SpecificSessionCallback();
1917     EXPECT_NE(specificCallback_, nullptr);
1918     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1919     EXPECT_NE(sceneSession, nullptr);
1920     sceneSession->isActive_ = true;
1921 
1922     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1923     EXPECT_NE(property, nullptr);
1924     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
1925     property->keyboardLayoutParams_.gravity_ = WindowGravity::WINDOW_GRAVITY_BOTTOM;
1926     sceneSession->SetSessionProperty(property);
1927 
1928     uint32_t screenWidth = 0;
1929     uint32_t screenHeight = 0;
1930     bool result = sceneSession->GetScreenWidthAndHeightFromServer(property, screenWidth, screenHeight);
1931     ASSERT_EQ(result, true);
1932 
1933     sceneSession->SetSessionProperty(nullptr);
1934     result = sceneSession->GetScreenWidthAndHeightFromServer(property, screenWidth, screenHeight);
1935     ASSERT_EQ(result, true);
1936 }
1937 
1938 /**
1939  * @tc.name: SetDefaultDisplayIdIfNeed
1940  * @tc.desc: SetDefaultDisplayIdIfNeed
1941  * @tc.type: FUNC
1942  */
1943 HWTEST_F(SceneSessionTest, SetDefaultDisplayIdIfNeed, Function | SmallTest | Level2)
1944 {
1945     SessionInfo info;
1946     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1947     EXPECT_NE(sceneSession, nullptr);
1948     sceneSession->SetDefaultDisplayIdIfNeed();
1949 
1950     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
1951     EXPECT_NE(property, nullptr);
1952     property->SetDisplayId(-99);
1953     sceneSession->SetSessionProperty(property);
1954     sceneSession->SetDefaultDisplayIdIfNeed();
1955     EXPECT_EQ(property->GetDisplayId(), SCREEN_ID_INVALID);
1956 }
1957 
1958 /**
1959  * @tc.name: SetSessionGlobalRect/GetSessionGlobalRect
1960  * @tc.desc: SetSessionGlobalRect
1961  * @tc.type: FUNC
1962  */
1963 HWTEST_F(SceneSessionTest, SetSessionGlobalRect, Function | SmallTest | Level2)
1964 {
1965     SessionInfo info;
1966     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1967     EXPECT_NE(sceneSession, nullptr);
1968     WSRect test = { 100, 100, 100, 100 };
1969     sceneSession->SetSessionGlobalRect(test);
1970     sceneSession->SetScbCoreEnabled(true);
1971     EXPECT_EQ(test, sceneSession->GetSessionGlobalRect());
1972 }
1973 
1974 /**
1975  * @tc.name: SetSessionGlobalRect/GetSessionGlobalRect
1976  * @tc.desc: SetSessionGlobalRect
1977  * @tc.type: FUNC
1978  */
1979 HWTEST_F(SceneSessionTest, SetIsStatusBarVisibleInner01, Function | SmallTest | Level2)
1980 {
1981     SessionInfo info;
1982     info.abilityName_ = "SetIsStatusBarVisibleInner01";
1983     info.bundleName_ = "SetIsStatusBarVisibleInner01";
1984     info.windowType_ = 1;
1985     sptr<SceneSession::SpecificSessionCallback> specificCallback =
1986         sptr<SceneSession::SpecificSessionCallback>::MakeSptr();
1987     EXPECT_NE(specificCallback, nullptr);
1988     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, specificCallback);
1989     EXPECT_NE(sceneSession, nullptr);
1990     sceneSession->isStatusBarVisible_ = true;
1991     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(true), WSError::WS_OK);
1992     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_ERROR_NULLPTR);
1993 
__anoneb811a820802(bool& isLayoutFinished) 1994     sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) {
1995         return WSError::WS_ERROR_NULLPTR;
1996     };
1997     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(true), WSError::WS_ERROR_NULLPTR);
1998 
__anoneb811a820902(bool& isLayoutFinished) 1999     sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) {
2000         isLayoutFinished = false;
2001         return WSError::WS_OK;
2002     };
2003     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_OK);
2004 
__anoneb811a820a02(bool& isLayoutFinished) 2005     sceneSession->isLastFrameLayoutFinishedFunc_ = [](bool& isLayoutFinished) {
2006         isLayoutFinished = true;
2007         return WSError::WS_OK;
2008     };
__anoneb811a820b02(int32_t persistentId, AvoidAreaType type) 2009     sceneSession->specificCallback_->onUpdateAvoidAreaByType_ = [](int32_t persistentId, AvoidAreaType type) {};
2010     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(true), WSError::WS_OK);
2011 
2012     sceneSession->specificCallback_ = nullptr;
2013     EXPECT_EQ(sceneSession->SetIsStatusBarVisibleInner(false), WSError::WS_OK);
2014 }
2015 } // namespace
2016 } // Rosen
2017 } // OHOS
2018