• 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 #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 #include "ui/rs_surface_node.h"
30 
31 using namespace testing;
32 using namespace testing::ext;
33 namespace OHOS {
34 namespace Rosen {
35 class SceneSessionTest2 : public testing::Test {
36 public:
37     static void SetUpTestCase();
38     static void TearDownTestCase();
39     void SetUp() override;
40     void TearDown() override;
41 };
42 
SetUpTestCase()43 void SceneSessionTest2::SetUpTestCase()
44 {
45 }
46 
TearDownTestCase()47 void SceneSessionTest2::TearDownTestCase()
48 {
49 }
50 
SetUp()51 void SceneSessionTest2::SetUp()
52 {
53 }
54 
TearDown()55 void SceneSessionTest2::TearDown()
56 {
57 }
58 
59 namespace {
60 /**
61  * @tc.name: RaiseAboveTarget
62  * @tc.desc: normal function
63  * @tc.type: FUNC
64  */
65 HWTEST_F(SceneSessionTest2, RaiseAboveTarget, Function | SmallTest | Level2)
66 {
67     SessionInfo info;
68     info.abilityName_ = "RaiseAboveTarget";
69     info.bundleName_ = "RaiseAboveTarget";
70     sptr<Rosen::ISession> session_;
71     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
72         new (std::nothrow) SceneSession::SpecificSessionCallback();
73     EXPECT_NE(specificCallback_, nullptr);
74     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
75     EXPECT_NE(sceneSession, nullptr);
76     sceneSession->isActive_ = true;
77 
78     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
79     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
80     uint32_t p = 10;
81     property->SetKeyboardSessionGravity(SessionGravity::SESSION_GRAVITY_BOTTOM, p);
82 
83     sceneSession->SetSessionProperty(property);
84     WSError result = sceneSession->RaiseAboveTarget(0);
85     ASSERT_EQ(result, WSError::WS_OK);
86 
87     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
88     EXPECT_NE(sceneSession->sessionChangeCallback_, nullptr);
89     sceneSession->sessionChangeCallback_->onRaiseAboveTarget_ = nullptr;
90     result = sceneSession->RaiseAboveTarget(0);
91     ASSERT_EQ(result, WSError::WS_OK);
92 }
93 
94 /**
95  * @tc.name: BindDialogSessionTarget
96  * @tc.desc: normal function
97  * @tc.type: FUNC
98  */
99 HWTEST_F(SceneSessionTest2, BindDialogSessionTarget, Function | SmallTest | Level2)
100 {
101     SessionInfo info;
102     info.abilityName_ = "BindDialogSessionTarget";
103     info.bundleName_ = "BindDialogSessionTarget";
104     sptr<Rosen::ISession> session_;
105     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
106         new (std::nothrow) SceneSession::SpecificSessionCallback();
107     EXPECT_NE(specificCallback_, nullptr);
108     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
109     EXPECT_NE(scensession, nullptr);
110     scensession->isActive_ = true;
111 
112     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
113     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
114     uint32_t p = 10;
115     property->SetKeyboardSessionGravity(SessionGravity::SESSION_GRAVITY_BOTTOM, p);
116     scensession->SetSessionProperty(property);
117 
118     sptr<SceneSession> sceneSession = nullptr;
119     WSError result = scensession->BindDialogSessionTarget(sceneSession);
120     ASSERT_EQ(result, WSError::WS_ERROR_NULLPTR);
121 
122     sptr<SceneSession> sceneSession1 = scensession;
123     result = scensession->BindDialogSessionTarget(sceneSession1);
124     ASSERT_EQ(result, WSError::WS_OK);
125 }
126 
127 /**
128  * @tc.name: NotifyPropertyWhenConnect1
129  * @tc.desc: NotifyPropertyWhenConnect1
130  * @tc.type: FUNC
131  */
132 HWTEST_F(SceneSessionTest2, NotifyPropertyWhenConnect1, Function | SmallTest | Level2)
133 {
134     SessionInfo info;
135     info.abilityName_ = "ability";
136     info.bundleName_ = "bundle";
137     info.moduleName_ = "module";
138     info.windowType_ = 1;
139     sptr<Rosen::ISession> session_;
140     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
141         new (std::nothrow) SceneSession::SpecificSessionCallback();
142     EXPECT_NE(specificCallback_, nullptr);
143     sptr<SceneSession> scensession;
144     scensession = new (std::nothrow) SceneSession(info, nullptr);
145     EXPECT_NE(scensession, nullptr);
146     int ret = 1;
147     std::string key = info.bundleName_ + info.moduleName_ + info.abilityName_;
148     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
149     scensession->NotifyPropertyWhenConnect();
150 
151     sptr<WindowSessionProperty> property = nullptr;
152     scensession->NotifyPropertyWhenConnect();
153     ASSERT_EQ(ret, 1);
154 }
155 
156 /**
157  * @tc.name: GetSystemAvoidArea
158  * @tc.desc: normal function
159  * @tc.type: FUNC
160  */
161 HWTEST_F(SceneSessionTest2, GetSystemAvoidArea, Function | SmallTest | Level2)
162 {
163     SessionInfo info;
164     info.abilityName_ = "GetSystemAvoidArea";
165     info.bundleName_ = "GetSystemAvoidArea";
166     sptr<Rosen::ISession> session_;
167     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
168         new (std::nothrow) SceneSession::SpecificSessionCallback();
169     EXPECT_NE(specificCallback_, nullptr);
170     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
171     EXPECT_NE(scensession, nullptr);
172     scensession->isActive_ = true;
173 
174     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
175     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
176     int32_t p = 10;
177     property->SetWindowFlags(static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_NEED_AVOID));
178 
179     scensession->SetSessionProperty(property);
180     WSRect rect({1, 1, 1, 1});
181     AvoidArea avoidArea;
182     scensession->GetSystemAvoidArea(rect, avoidArea);
183     ASSERT_EQ(p, 10);
184 }
185 
186 /**
187  * @tc.name: HandleEnterWinwdowArea1
188  * @tc.desc: normal function
189  * @tc.type: FUNC
190  */
191 HWTEST_F(SceneSessionTest2, HandleEnterWinwdowArea1, Function | SmallTest | Level2)
192 {
193     SessionInfo info;
194     info.abilityName_ = "HandleEnterWinwdowArea1";
195     info.bundleName_ = "HandleEnterWinwdowArea1";
196     sptr<Rosen::ISession> session_;
197     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
198         new (std::nothrow) SceneSession::SpecificSessionCallback();
199     EXPECT_NE(specificCallback_, nullptr);
200     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
201     EXPECT_NE(scensession, nullptr);
202     scensession->isActive_ = true;
203 
204     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
205     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
206     property->SetWindowFlags(static_cast<uint32_t>(WindowFlag::WINDOW_FLAG_NEED_AVOID));
207 
208     scensession->SetSessionProperty(property);
209     WSError result = scensession->HandleEnterWinwdowArea(-1, -1);
210     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_PARAM);
211 
212     result = scensession->HandleEnterWinwdowArea(1, -1);
213     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_PARAM);
214 
215     result = scensession->HandleEnterWinwdowArea(-1, 1);
216     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_PARAM);
217 }
218 
219 /**
220  * @tc.name: HandleEnterWinwdowArea2
221  * @tc.desc: normal function
222  * @tc.type: FUNC
223  */
224 HWTEST_F(SceneSessionTest2, HandleEnterWinwdowArea2, Function | SmallTest | Level2)
225 {
226     SessionInfo info;
227     info.abilityName_ = "HandleEnterWinwdowArea2";
228     info.bundleName_ = "HandleEnterWinwdowArea2";
229     sptr<Rosen::ISession> session_;
230     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
231         new (std::nothrow) SceneSession::SpecificSessionCallback();
232     EXPECT_NE(specificCallback_, nullptr);
233     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
234     EXPECT_NE(scensession, nullptr);
235     scensession->isActive_ = true;
236 
237     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
238     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
239     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
240     scensession->SetSessionProperty(property);
241     WSError result = scensession->HandleEnterWinwdowArea(1, 1);
242     ASSERT_EQ(result, WSError::WS_OK);
243 
244     scensession->sessionInfo_.isSystem_ = true;
245     result = scensession->HandleEnterWinwdowArea(1, 1);
246     result = scensession->HandleEnterWinwdowArea(1, 1);
247     ASSERT_EQ(result, WSError::WS_OK);
248 
249     property = new(std::nothrow) WindowSessionProperty();
250     property->SetWindowType(WindowType::ABOVE_APP_SYSTEM_WINDOW_END);
251     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
252     scensession->SetSessionProperty(property);
253     result = scensession->HandleEnterWinwdowArea(1, 1);
254     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_TYPE);
255 
256     property = new(std::nothrow) WindowSessionProperty();
257     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
258     property->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
259     scensession->SetSessionProperty(property);
260     result = scensession->HandleEnterWinwdowArea(1, 1);
261     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_TYPE);
262 
263     property = new(std::nothrow) WindowSessionProperty();
264     property->SetWindowType(WindowType::APP_SUB_WINDOW_BASE);
265     property->SetWindowMode(WindowMode::WINDOW_MODE_UNDEFINED);
266     scensession->SetSessionProperty(property);
267     result = scensession->HandleEnterWinwdowArea(1, 1);
268     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_TYPE);
269 }
270 
271 /**
272  * @tc.name: TransferPointerEvent
273  * @tc.desc: TransferPointerEvent
274  * @tc.type: FUNC
275  */
276 HWTEST_F(SceneSessionTest2, TransferPointerEvent01, Function | SmallTest | Level2)
277 {
278     SessionInfo info;
279     info.abilityName_ = "Background01";
280     info.bundleName_ = "IsFloatingWindowAppType";
281     info.windowType_ = 1;
282     sptr<Rosen::ISession> session_;
283     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
284         new (std::nothrow) SceneSession::SpecificSessionCallback();
285     EXPECT_NE(specificCallback_, nullptr);
286     sptr<SceneSession> scensession;
287     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
288     EXPECT_NE(scensession, nullptr);
289     std::shared_ptr<MMI::PointerEvent> pointerEvent = nullptr;
290     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent), WSError::WS_ERROR_NULLPTR);
291 
292     sptr<WindowSessionProperty> property = new WindowSessionProperty();
293     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
294     property->SetMaximizeMode(MaximizeMode::MODE_FULL_FILL);
295     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
296     property->SetPersistentId(11);
297     scensession->property_ = property;
298 
299     std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
300     pointerEvent_->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_ENTER_WINDOW);
301     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent_), WSError::WS_ERROR_INVALID_SESSION);
302 
303     scensession->sessionInfo_.isSystem_ = true;
304     pointerEvent_->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_BUTTON_DOWN);
305     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent_),
306     WSError::WS_ERROR_NULLPTR);
307 
308     pointerEvent_->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_ENTER_WINDOW);
309     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent_),
310     WSError::WS_ERROR_NULLPTR);
311 
312     scensession->sessionInfo_.isSystem_ = false;
313     pointerEvent_->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_BUTTON_DOWN);
314     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent_),
315     WSError::WS_ERROR_INVALID_SESSION);
316 
317     pointerEvent_->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_ENTER_WINDOW);
318     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent_),
319     WSError::WS_ERROR_INVALID_SESSION);
320 }
321 
322 /**
323  * @tc.name: TransferPointerEvent
324  * @tc.desc: TransferPointerEvent
325  * @tc.type: FUNC
326  */
327 HWTEST_F(SceneSessionTest2, TransferPointerEvent02, Function | SmallTest | Level2)
328 {
329     SessionInfo info;
330     info.abilityName_ = "Background01";
331     info.bundleName_ = "IsSubWindowAppType";
332     info.windowType_ = 1;
333     sptr<Rosen::ISession> session_;
334     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
335         new (std::nothrow) SceneSession::SpecificSessionCallback();
336     EXPECT_NE(specificCallback_, nullptr);
337     sptr<SceneSession> scensession;
338     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
339     EXPECT_NE(scensession, nullptr);
340     std::shared_ptr<MMI::PointerEvent> pointerEvent = nullptr;
341     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent), WSError::WS_ERROR_NULLPTR);
342 
343     sptr<WindowSessionProperty> property = new WindowSessionProperty();
344     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
345     property->SetMaximizeMode(MaximizeMode::MODE_FULL_FILL);
346     property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
347     property->SetPersistentId(11);
348     scensession->property_ = property;
349 
350     std::shared_ptr<MMI::PointerEvent> pointerEvent_ = MMI::PointerEvent::Create();
351     pointerEvent_->SetPointerAction(MMI::PointerEvent::POINTER_ACTION_DOWN);
352     ASSERT_EQ(scensession->TransferPointerEvent(pointerEvent_), WSError::WS_ERROR_INVALID_SESSION);
353 }
354 
355 /**
356  * @tc.name: RequestSessionBack
357  * @tc.desc: normal function
358  * @tc.type: FUNC
359  */
360 HWTEST_F(SceneSessionTest2, RequestSessionBack, Function | SmallTest | Level2)
361 {
362     SessionInfo info;
363     info.abilityName_ = "RequestSessionBack";
364     info.bundleName_ = "RequestSessionBack";
365     sptr<Rosen::ISession> session_;
366     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
367         new (std::nothrow) SceneSession::SpecificSessionCallback();
368     EXPECT_NE(specificCallback_, nullptr);
369     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
370     EXPECT_NE(scensession, nullptr);
371     scensession->isActive_ = true;
372 
373     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
374     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
375     uint32_t p = 10;
376     property->SetKeyboardSessionGravity(SessionGravity::SESSION_GRAVITY_BOTTOM, p);
377     scensession->SetSessionProperty(property);
378 
379     WSError result = scensession->RequestSessionBack(true);
380     ASSERT_EQ(result, WSError::WS_OK);
381 
382     struct RSSurfaceNodeConfig config;
383     std::shared_ptr<RSSurfaceNode> surfaceNode = RSSurfaceNode::Create(config);
384     EXPECT_NE(nullptr, surfaceNode);
385     scensession->SetLeashWinSurfaceNode(surfaceNode);
386     result = scensession->RequestSessionBack(true);
387     ASSERT_EQ(result, WSError::WS_OK);
388 }
389 
390 /**
391  * @tc.name: SetParentPersistentId
392  * @tc.desc: normal function
393  * @tc.type: FUNC
394  */
395 HWTEST_F(SceneSessionTest2, SetParentPersistentId, Function | SmallTest | Level2)
396 {
397     SessionInfo info;
398     info.abilityName_ = "SetParentPersistentId";
399     info.bundleName_ = "SetParentPersistentId";
400     sptr<Rosen::ISession> session_;
401     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
402         new (std::nothrow) SceneSession::SpecificSessionCallback();
403     EXPECT_NE(specificCallback_, nullptr);
404     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
405     EXPECT_NE(scensession, nullptr);
406     scensession->isActive_ = true;
407 
408     scensession->SetParentPersistentId(0);
409     int32_t result = scensession->GetParentPersistentId();
410     ASSERT_EQ(result, 0);
411 
412     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
413     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
414 
415     scensession->SetSessionProperty(property);
416     scensession->SetParentPersistentId(0);
417     result = scensession->GetParentPersistentId();
418     ASSERT_EQ(result, 0);
419 
420     scensession->SetSessionProperty(nullptr);
421     scensession->SetParentPersistentId(0);
422     ASSERT_EQ(0, scensession->GetParentPersistentId());
423 }
424 
425 /**
426  * @tc.name: GetMainSessionId
427  * @tc.desc: GetMainSessionId Test
428  * @tc.type: FUNC
429  */
430 HWTEST_F(SceneSessionTest2, GetMainSessionId, Function | SmallTest | Level2)
431 {
432     SessionInfo info;
433     info.abilityName_ = "GetMainSessionId";
434     info.moduleName_ = "GetMainSessionId";
435     info.bundleName_ = "GetMainSessionId";
436 
437     sptr<Session> session = sptr<Session>::MakeSptr(info);
438     EXPECT_NE(session, nullptr);
439     sptr<WindowSessionProperty> property = sptr<WindowSessionProperty>::MakeSptr();
440     EXPECT_NE(property, nullptr);
441     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
442     property->SetPersistentId(0);
443     session->SetSessionProperty(property);
444 
445     sptr<Session> subSession = sptr<Session>::MakeSptr(info);
446     EXPECT_NE(subSession, nullptr);
447     subSession->SetParentSession(session);
448     sptr<WindowSessionProperty> subProperty = sptr<WindowSessionProperty>::MakeSptr();
449     EXPECT_NE(subProperty, nullptr);
450     subProperty->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
451     subProperty->SetPersistentId(1);
452     subSession->SetSessionProperty(subProperty);
453 
454     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
455     EXPECT_NE(sceneSession, nullptr);
456     sceneSession->SetParentSession(subSession);
457     sptr<WindowSessionProperty> sceneProperty = sptr<WindowSessionProperty>::MakeSptr();
458     EXPECT_NE(sceneProperty, nullptr);
459     sceneProperty->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
460     sceneProperty->SetPersistentId(2);
461     sceneSession->SetSessionProperty(sceneProperty);
462     auto result = sceneSession->GetMainSessionId();
463     ASSERT_EQ(result, 0);
464 }
465 
466 /**
467  * @tc.name: GetSessionSnapshotFilePath
468  * @tc.desc: normal function
469  * @tc.type: FUNC
470  */
471 HWTEST_F(SceneSessionTest2, GetSessionSnapshotFilePath, Function | SmallTest | Level2)
472 {
473     SessionInfo info;
474     info.abilityName_ = "GetSessionSnapshotFilePath";
475     info.bundleName_ = "GetSessionSnapshotFilePath";
476     sptr<Rosen::ISession> session_;
477     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
478         new (std::nothrow) SceneSession::SpecificSessionCallback();
479     EXPECT_NE(specificCallback_, nullptr);
480     sptr<SceneSession> scensession = new (std::nothrow) SceneSession(info, nullptr);
481     EXPECT_NE(scensession, nullptr);
482     scensession->isActive_ = true;
483 
484     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
485     property->SetWindowType(WindowType::WINDOW_TYPE_INPUT_METHOD_FLOAT);
486     scensession->SetSessionProperty(property);
487 
488     std::string result = scensession->GetSessionSnapshotFilePath();
489     ASSERT_NE(result, "0");
490 }
491 
492 /**
493  * @tc.name: AddSubSession
494  * @tc.desc: AddSubSession Test
495  * @tc.type: FUNC
496  */
497 HWTEST_F(SceneSessionTest2, AddSubSession, Function | SmallTest | Level2)
498 {
499     SessionInfo info;
500     info.abilityName_ = "NotifySessionException";
501     info.bundleName_ = "NotifySessionException";
502 
503     sptr<SceneSession> session = new (std::nothrow) SceneSession(info, nullptr);
504     EXPECT_NE(session, nullptr);
505 
506     sptr<SceneSession> subSession = nullptr;
507     bool res = session->AddSubSession(subSession);
508     ASSERT_EQ(res, false);
509 
510     subSession = new (std::nothrow) SceneSession(info, nullptr);
511     EXPECT_NE(subSession, nullptr);
512 
513     res = session->AddSubSession(subSession);
514     ASSERT_EQ(res, true);
515 
516     res = session->AddSubSession(subSession);
517     ASSERT_EQ(res, false);
518 }
519 
520 /**
521  * @tc.name: RemoveSubSession
522  * @tc.desc: RemoveSubSession Test
523  * @tc.type: FUNC
524  */
525 HWTEST_F(SceneSessionTest2, RemoveSubSession, Function | SmallTest | Level2)
526 {
527     SessionInfo info;
528     info.abilityName_ = "NotifySessionException";
529     info.bundleName_ = "NotifySessionException";
530 
531     sptr<SceneSession> session = new (std::nothrow) SceneSession(info, nullptr);
532     EXPECT_NE(session, nullptr);
533 
534     bool res = session->RemoveSubSession(0);
535     ASSERT_EQ(res, false);
536 
537     sptr<SceneSession> subSession = new (std::nothrow) SceneSession(info, nullptr);
538     EXPECT_NE(subSession, nullptr);
539 
540     res = session->AddSubSession(subSession);
541     ASSERT_EQ(res, true);
542 
543     res = session->RemoveSubSession(subSession->GetPersistentId());
544     ASSERT_EQ(res, true);
545 }
546 
547 /**
548  * @tc.name: AddToastSession
549  * @tc.desc: AddToastSession Test
550  * @tc.type: FUNC
551  */
552 HWTEST_F(SceneSessionTest2, AddToastSession, Function | SmallTest | Level2)
553 {
554     SessionInfo info;
555     info.abilityName_ = "NotifySessionException";
556     info.bundleName_ = "NotifySessionException";
557 
558     sptr<SceneSession> session = new (std::nothrow) SceneSession(info, nullptr);
559     EXPECT_NE(session, nullptr);
560 
561     sptr<SceneSession> toastSession = nullptr;
562     bool res = session->AddToastSession(toastSession);
563     ASSERT_EQ(res, false);
564 
565     toastSession = new (std::nothrow) SceneSession(info, nullptr);
566     EXPECT_NE(toastSession, nullptr);
567 
568     res = session->AddToastSession(toastSession);
569     ASSERT_EQ(res, true);
570 
571     res = session->AddToastSession(toastSession);
572     ASSERT_EQ(res, false);
573 }
574 
575 /**
576  * @tc.name: RemoveToastSession
577  * @tc.desc: RemoveToastSession Test
578  * @tc.type: FUNC
579  */
580 HWTEST_F(SceneSessionTest2, RemoveToastSession, Function | SmallTest | Level2)
581 {
582     SessionInfo info;
583     info.abilityName_ = "NotifySessionException";
584     info.bundleName_ = "NotifySessionException";
585 
586     sptr<SceneSession> session = new (std::nothrow) SceneSession(info, nullptr);
587     EXPECT_NE(session, nullptr);
588 
589     bool res = session->RemoveToastSession(0);
590     ASSERT_EQ(res, false);
591 
592     sptr<SceneSession> toastSession = new (std::nothrow) SceneSession(info, nullptr);
593     EXPECT_NE(toastSession, nullptr);
594 
595     res = session->AddToastSession(toastSession);
596     ASSERT_EQ(res, true);
597 
598     res = session->RemoveToastSession(toastSession->GetPersistentId());
599     ASSERT_EQ(res, true);
600 }
601 
602 /**
603  * @tc.name: NotifySessionFullScreen01
604  * @tc.desc: NotifySessionFullScreen
605  * @tc.type: FUNC
606  */
607 HWTEST_F(SceneSessionTest2, NotifySessionFullScreen, Function | SmallTest | Level2)
608 {
609     SessionInfo info;
610     info.abilityName_ = "FullScreen01";
611     info.bundleName_ = "IsFloatingWindowAppType";
612     info.windowType_ = 1;
613     sptr<SceneSession::SpecificSessionCallback> specificCallback =
614         new (std::nothrow) SceneSession::SpecificSessionCallback();
615     EXPECT_NE(specificCallback, nullptr);
616     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
617     EXPECT_NE(sceneSession, nullptr);
618     sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
619     ASSERT_NE(mockSessionStage, nullptr);
620     bool fullScreen = true;
621     int ret = 1;
622     sceneSession->sessionStage_ = mockSessionStage;
623     sceneSession->NotifySessionFullScreen(fullScreen);
624     ASSERT_EQ(ret, 1);
625 }
626 
627 /**
628  * @tc.name: NotifyClientToUpdateRect01
629  * @tc.desc: NotifyClientToUpdateRect
630  * @tc.type: FUNC
631  */
632 HWTEST_F(SceneSessionTest2, NotifyClientToUpdateRect01, Function | SmallTest | Level2)
633 {
634     SessionInfo info;
635     info.abilityName_ = "NotifyClientToUpdateRect01";
636     info.bundleName_ = "NotifyClientToUpdateRect01";
637     info.windowType_ = 1;
638     sptr<Rosen::ISession> session_;
639     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
640         new (std::nothrow) SceneSession::SpecificSessionCallback();
641     EXPECT_NE(specificCallback_, nullptr);
642     sptr<SceneSession> scensession;
643     scensession = new (std::nothrow) SceneSession(info, nullptr);
644     EXPECT_NE(scensession, nullptr);
645     sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
646     ASSERT_NE(mockSessionStage, nullptr);
647     scensession->dirtyFlags_ |= static_cast<uint32_t>(SessionUIDirtyFlag::RECT);
648     scensession->sessionStage_ = mockSessionStage;
649     auto ret = scensession->NotifyClientToUpdateRect("SceneSessionTest2", nullptr);
650     ASSERT_EQ(ret, WSError::WS_OK);
651 }
652 
653 /**
654  * @tc.name: UpdateSizeChangeReason01
655  * @tc.desc: UpdateSizeChangeReason01
656  * @tc.type: FUNC
657  */
658 HWTEST_F(SceneSessionTest2, UpdateSizeChangeReason01, Function | SmallTest | Level2)
659 {
660     SessionInfo info;
661     info.abilityName_ = "UpdateSizeChangeReason01";
662     info.bundleName_ = "UpdateSizeChangeReason01";
663     info.windowType_ = 1;
664     sptr<Rosen::ISession> session_;
665     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
666         new (std::nothrow) SceneSession::SpecificSessionCallback();
667     EXPECT_NE(specificCallback_, nullptr);
668     sptr<SceneSession> scensession;
669     scensession = new (std::nothrow) SceneSession(info, nullptr);
670     EXPECT_NE(scensession, nullptr);
671     sptr<SessionStageMocker> mockSessionStage = new (std::nothrow) SessionStageMocker();
672     ASSERT_NE(mockSessionStage, nullptr);
673     scensession->dirtyFlags_ |= static_cast<uint32_t>(SessionUIDirtyFlag::RECT);
674     scensession->sessionStage_ = mockSessionStage;
675     scensession->UpdateSizeChangeReason(SizeChangeReason::ROTATION);
676     ASSERT_EQ(scensession->reason_, SizeChangeReason::ROTATION);
677     ASSERT_EQ(WSError::WS_OK, scensession->UpdateSizeChangeReason(SizeChangeReason::UNDEFINED));
678 }
679 
680 /**
681  * @tc.name: UpdatePiPRect01
682  * @tc.desc: UpdatePiPRect
683  * @tc.type: FUNC
684  */
685 HWTEST_F(SceneSessionTest2, UpdatePiPRect, Function | SmallTest | Level2)
686 {
687     SessionInfo info;
688     info.abilityName_ = "UpdatePiPRect01";
689     info.bundleName_ = "UpdatePiPRect";
690     sptr<Rosen::ISession> session_;
691     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
692         new (std::nothrow) SceneSession::SpecificSessionCallback();
693     EXPECT_NE(specificCallback_, nullptr);
694     sptr<SceneSession> scenesession;
695     scenesession = new (std::nothrow) SceneSession(info, nullptr);
696     EXPECT_NE(scenesession, nullptr);
697     scenesession->isActive_ = true;
698 
699     sptr<WindowSessionProperty> property = new(std::nothrow) WindowSessionProperty();
700     property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
701     scenesession->SetSessionProperty(property);
702 
703     Rect rect = {0, 0, 800, 600};
704     SizeChangeReason reason = SizeChangeReason::PIP_START;
705     WSError result = scenesession->UpdatePiPRect(rect, reason);
706     ASSERT_EQ(result, WSError::WS_OK);
707 
708     property->SetWindowType(WindowType::WINDOW_TYPE_FLOAT);
709     scenesession->SetSessionProperty(property);
710     result = scenesession->UpdatePiPRect(rect, reason);
711     ASSERT_EQ(result, WSError::WS_DO_NOTHING);
712 
713     property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
714     scenesession->SetSessionProperty(property);
715     scenesession->isTerminating_ = true;
716     result = scenesession->UpdatePiPRect(rect, reason);
717     ASSERT_EQ(result, WSError::WS_OK);
718 
719     scenesession->isTerminating_ = false;
720     result = scenesession->UpdatePiPRect(rect, reason);
721     ASSERT_EQ(result, WSError::WS_OK);
722 }
723 
724 /**
725  * @tc.name: UpdatePiPControlStatus
726  * @tc.desc: UpdatePiPControlStatus
727  * @tc.type: FUNC
728  */
729 HWTEST_F(SceneSessionTest2, UpdatePiPControlStatus, Function | SmallTest | Level2)
730 {
731     SessionInfo info;
732     info.abilityName_ = "UpdatePiPControlStatus";
733     info.bundleName_ = "UpdatePiPControlStatus";
734     auto sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
735     EXPECT_NE(sceneSession, nullptr);
736     sceneSession->isActive_ = true;
737 
738     auto property = sptr<WindowSessionProperty>::MakeSptr();
739     EXPECT_NE(property, nullptr);
740     property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
741     sceneSession->SetSessionProperty(property);
742 
743     auto controlType = WsPiPControlType::VIDEO_PLAY_PAUSE;
744     auto status = WsPiPControlStatus::PLAY;
745     WSError result = sceneSession->UpdatePiPControlStatus(controlType, status);
746     ASSERT_EQ(result, WSError::WS_OK);
747 
748     property->SetWindowType(WindowType::WINDOW_TYPE_FLOAT);
749     sceneSession->SetSessionProperty(property);
750     result = sceneSession->UpdatePiPControlStatus(controlType, status);
751     ASSERT_EQ(result, WSError::WS_DO_NOTHING);
752 }
753 
754 /**
755  * @tc.name: SetScale
756  * @tc.desc: SetScale
757  * @tc.type: FUNC
758  */
759 HWTEST_F(SceneSessionTest2, SetScale, Function | SmallTest | Level2)
760 {
761     SessionInfo info;
762     info.abilityName_ = "SetScale";
763     info.bundleName_ = "SetScale";
764     sptr<Rosen::ISession> session_;
765     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
766         new (std::nothrow) SceneSession::SpecificSessionCallback();
767     EXPECT_NE(specificCallback_, nullptr);
768     int resultValue = 0;
769     sptr<SceneSession> scensession;
770     scensession = new (std::nothrow) SceneSession(info, nullptr);
771     EXPECT_NE(scensession, nullptr);
772     scensession->SetScale(1.0f, 1.0f, 0.0f, 0.0f);
773     ASSERT_EQ(0, resultValue);
774 }
775 
776 /**
777  * @tc.name: RequestHideKeyboard
778  * @tc.desc:  * @tc.name: RequestHideKeyboard
779  * @tc.type: FUNC
780  */
781 HWTEST_F(SceneSessionTest2, RequestHideKeyboard, Function | SmallTest | Level2)
782 {
783     SessionInfo info;
784     info.abilityName_ = "RequestHideKeyboard";
785     info.bundleName_ = "RequestHideKeyboard";
786     sptr<Rosen::ISession> session_;
787     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
788         new (std::nothrow) SceneSession::SpecificSessionCallback();
789     EXPECT_NE(specificCallback_, nullptr);
790     int resultValue = 0;
791     sptr<SceneSession> scensession;
792     scensession = new (std::nothrow) SceneSession(info, nullptr);
793     EXPECT_NE(scensession, nullptr);
794     scensession->RequestHideKeyboard();
795     ASSERT_EQ(0, resultValue);
796 }
797 
798 /**
799  * @tc.name: SetIsDisplayStatusBarTemporarily
800  * @tc.desc:  * @tc.name: SetIsDisplayStatusBarTemporarily
801  * @tc.type: FUNC
802  */
803 HWTEST_F(SceneSessionTest2, SetIsDisplayStatusBarTemporarily, Function | SmallTest | Level2)
804 {
805     SessionInfo info;
806     info.abilityName_ = "SetIsDisplayStatusBarTemporarily";
807     info.bundleName_ = "SetIsDisplayStatusBarTemporarily";
808     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
809     EXPECT_NE(sceneSession, nullptr);
810     sceneSession->SetIsDisplayStatusBarTemporarily(true);
811     ASSERT_EQ(true, sceneSession->GetIsDisplayStatusBarTemporarily());
812     sceneSession->SetIsDisplayStatusBarTemporarily(false);
813     ASSERT_EQ(false, sceneSession->GetIsDisplayStatusBarTemporarily());
814 }
815 
816 /**
817  * @tc.name: UpdateAvoidArea
818  * @tc.desc:  * @tc.name: UpdateAvoidArea
819  * @tc.type: FUNC
820  */
821 HWTEST_F(SceneSessionTest2, UpdateAvoidArea, Function | SmallTest | Level2)
822 {
823     SessionInfo info;
824     info.abilityName_ = "UpdateAvoidArea";
825     info.bundleName_ = "UpdateAvoidArea";
826     sptr<SceneSession> scensession;
827     scensession = new (std::nothrow) SceneSession(info, nullptr);
828     scensession->sessionStage_ = nullptr;
829     WSError result = scensession->UpdateAvoidArea(nullptr, AvoidAreaType::TYPE_SYSTEM);
830     EXPECT_EQ(WSError::WS_ERROR_NULLPTR, result);
831 
832     scensession->sessionStage_ = new SessionStageMocker();
833     EXPECT_NE(nullptr, scensession->sessionStage_);
834     result = scensession->UpdateAvoidArea(nullptr, AvoidAreaType::TYPE_SYSTEM);
835     EXPECT_EQ(WSError::WS_OK, result);
836 }
837 
838 /**
839  * @tc.name: ChangeSessionVisibilityWithStatusBar
840  * @tc.desc: normal function
841  * @tc.type: FUNC
842  */
843 HWTEST_F(SceneSessionTest2, ChangeSessionVisibilityWithStatusBar, Function | SmallTest | Level2)
844 {
845     SessionInfo info;
846     info.abilityName_ = "ChangeSessionVisibilityWithStatusBar";
847     info.bundleName_ = "ChangeSessionVisibilityWithStatusBar";
848     sptr<Rosen::ISession> session_;
849 
850     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
851     EXPECT_NE(sceneSession, nullptr);
852     sceneSession->isActive_ = true;
853 
854     sptr<AAFwk::SessionInfo> info1 = nullptr;
855     WSError result = sceneSession->ChangeSessionVisibilityWithStatusBar(info1, false);
856     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_PERMISSION);
857 
858     sptr<AAFwk::SessionInfo> abilitySessionInfo = new AAFwk::SessionInfo();
859     result = sceneSession->ChangeSessionVisibilityWithStatusBar(abilitySessionInfo, false);
860     ASSERT_EQ(result, WSError::WS_ERROR_INVALID_PERMISSION);
861 }
862 
863 /**
864  * @tc.name: SetShouldHideNonSecureWindows
865  * @tc.desc: SetShouldHideNonSecureWindows
866  * @tc.type: FUNC
867  */
868 HWTEST_F(SceneSessionTest2, SetShouldHideNonSecureWindows, Function | SmallTest | Level2)
869 {
870     SessionInfo info;
871     info.abilityName_ = "SetShouldHideNonSecureWindows";
872     info.bundleName_ = "SetShouldHideNonSecureWindows";
873 
874     sptr<SceneSession> sceneSession;
875     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
876     EXPECT_NE(sceneSession, nullptr);
877 
878     EXPECT_FALSE(sceneSession->shouldHideNonSecureWindows_.load());
879     sceneSession->SetShouldHideNonSecureWindows(true);
880     EXPECT_TRUE(sceneSession->shouldHideNonSecureWindows_.load());
881 }
882 
883 /**
884  * @tc.name: UpdateExtWindowFlags
885  * @tc.desc: update uiextension window flags
886  * @tc.type: FUNC
887  */
888 HWTEST_F(SceneSessionTest2, UpdateExtWindowFlags, Function | SmallTest | Level2)
889 {
890     SessionInfo info;
891     info.abilityName_ = "UpdateExtWindowFlags";
892     info.bundleName_ = "UpdateExtWindowFlags";
893 
894     sptr<SceneSession> sceneSession;
895     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
896     EXPECT_NE(sceneSession, nullptr);
897 
898     EXPECT_TRUE(sceneSession->extWindowFlagsMap_.empty());
899     int32_t persistentId = 12345;
900     ExtensionWindowFlags flags(7);
901     ExtensionWindowFlags actions(7);
902     sceneSession->UpdateExtWindowFlags(persistentId, flags, actions);
903     EXPECT_EQ(sceneSession->extWindowFlagsMap_.size(), 1);
904     EXPECT_EQ(sceneSession->extWindowFlagsMap_.begin()->first, persistentId);
905     EXPECT_EQ(sceneSession->extWindowFlagsMap_.begin()->second.bitData, 7);
906     flags.bitData = 0;
907     actions.bitData = 3;
908     sceneSession->UpdateExtWindowFlags(persistentId, flags, actions);
909     EXPECT_EQ(sceneSession->extWindowFlagsMap_.size(), 1);
910     EXPECT_EQ(sceneSession->extWindowFlagsMap_.begin()->first, persistentId);
911     EXPECT_EQ(sceneSession->extWindowFlagsMap_.begin()->second.bitData, 4);
912     actions.bitData = 4;
913     sceneSession->UpdateExtWindowFlags(persistentId, flags, actions);
914     EXPECT_TRUE(sceneSession->extWindowFlagsMap_.empty());
915 }
916 
917 /**
918  * @tc.name: GetCombinedExtWindowFlags
919  * @tc.desc: get combined uiextension window flags
920  * @tc.type: FUNC
921  */
922 HWTEST_F(SceneSessionTest2, GetCombinedExtWindowFlags, Function | SmallTest | Level2)
923 {
924     SessionInfo info;
925     info.abilityName_ = "GetCombinedExtWindowFlags";
926     info.bundleName_ = "GetCombinedExtWindowFlags";
927 
928     sptr<SceneSession> sceneSession;
929     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
930     EXPECT_NE(sceneSession, nullptr);
931 
932     auto combinedExtWindowFlags = sceneSession->GetCombinedExtWindowFlags();
933     EXPECT_EQ(combinedExtWindowFlags.bitData, 0);
934     sceneSession->UpdateExtWindowFlags(1234, ExtensionWindowFlags(3), ExtensionWindowFlags(3));
935     sceneSession->UpdateExtWindowFlags(5678, ExtensionWindowFlags(4), ExtensionWindowFlags(4));
936 
937     sceneSession->state_ = SessionState::STATE_FOREGROUND;
938     combinedExtWindowFlags = sceneSession->GetCombinedExtWindowFlags();
939     EXPECT_EQ(combinedExtWindowFlags.bitData, 7);
940 
941     sceneSession->state_ = SessionState::STATE_BACKGROUND;
942     combinedExtWindowFlags = sceneSession->GetCombinedExtWindowFlags();
943     EXPECT_EQ(combinedExtWindowFlags.bitData, 6);
944 }
945 
946 /**
947  * @tc.name: RemoveExtWindowFlags
948  * @tc.desc: remove uiextension window flags
949  * @tc.type: FUNC
950  */
951 HWTEST_F(SceneSessionTest2, RemoveExtWindowFlags, Function | SmallTest | Level2)
952 {
953     SessionInfo info;
954     info.abilityName_ = "RemoveExtWindowFlags";
955     info.bundleName_ = "RemoveExtWindowFlags";
956 
957     sptr<SceneSession> sceneSession;
958     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
959     EXPECT_NE(sceneSession, nullptr);
960 
961     EXPECT_TRUE(sceneSession->extWindowFlagsMap_.empty());
962     sceneSession->UpdateExtWindowFlags(1234, ExtensionWindowFlags(3), ExtensionWindowFlags(3));
963     EXPECT_EQ(sceneSession->extWindowFlagsMap_.size(), 1);
964     sceneSession->RemoveExtWindowFlags(1234);
965     EXPECT_TRUE(sceneSession->extWindowFlagsMap_.empty());
966 }
967 
968 /**
969  * @tc.name: ClearExtWindowFlags
970  * @tc.desc: clear uiextension window flags
971  * @tc.type: FUNC
972  */
973 HWTEST_F(SceneSessionTest2, ClearExtWindowFlags, Function | SmallTest | Level2)
974 {
975     SessionInfo info;
976     info.abilityName_ = "ClearExtWindowFlags";
977     info.bundleName_ = "ClearExtWindowFlags";
978 
979     sptr<SceneSession> sceneSession;
980     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
981     EXPECT_NE(sceneSession, nullptr);
982 
983     EXPECT_TRUE(sceneSession->extWindowFlagsMap_.empty());
984     sceneSession->UpdateExtWindowFlags(1234, ExtensionWindowFlags(3), ExtensionWindowFlags(3));
985     sceneSession->UpdateExtWindowFlags(5678, ExtensionWindowFlags(4), ExtensionWindowFlags(4));
986     EXPECT_EQ(sceneSession->extWindowFlagsMap_.size(), 2);
987     sceneSession->ClearExtWindowFlags();
988     EXPECT_TRUE(sceneSession->extWindowFlagsMap_.empty());
989 }
990 
991 /**
992  * @tc.name: CalculateCombinedExtWindowFlags
993  * @tc.desc: calculate combined uiextension window flags
994  * @tc.type: FUNC
995  */
996 HWTEST_F(SceneSessionTest2, CalculateCombinedExtWindowFlags, Function | SmallTest | Level2)
997 {
998     SessionInfo info;
999     info.abilityName_ = "CalculateCombinedExtWindowFlags";
1000     info.bundleName_ = "CalculateCombinedExtWindowFlags";
1001 
1002     sptr<SceneSession> sceneSession;
1003     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1004     EXPECT_NE(sceneSession, nullptr);
1005 
1006     EXPECT_EQ(sceneSession->combinedExtWindowFlags_.bitData, 0);
1007     sceneSession->UpdateExtWindowFlags(1234, ExtensionWindowFlags(3), ExtensionWindowFlags(3));
1008     sceneSession->UpdateExtWindowFlags(5678, ExtensionWindowFlags(4), ExtensionWindowFlags(4));
1009     sceneSession->CalculateCombinedExtWindowFlags();
1010     EXPECT_EQ(sceneSession->combinedExtWindowFlags_.bitData, 7);
1011 }
1012 
1013 /**
1014  * @tc.name: SaveUpdatedIcon
1015  * @tc.desc:  * @tc.name: SaveUpdatedIcon
1016  * @tc.type: FUNC
1017  */
1018 HWTEST_F(SceneSessionTest2, SaveUpdatedIcon, Function | SmallTest | Level2)
1019 {
1020     SessionInfo info;
1021     info.abilityName_ = "SaveUpdatedIcon";
1022     info.bundleName_ = "SaveUpdatedIcon";
1023     sptr<SceneSession> scensession;
1024     scensession = new (std::nothrow) SceneSession(info, nullptr);
1025 
1026     scensession->scenePersistence_ = new ScenePersistence("OpenHarmony", 1);
1027     EXPECT_NE(nullptr, scensession->scenePersistence_);
1028     scensession->SaveUpdatedIcon(nullptr);
1029 }
1030 
1031 /**
1032  * @tc.name: NotifyTouchOutside
1033  * @tc.desc:  * @tc.name: NotifyTouchOutside
1034  * @tc.type: FUNC
1035  */
1036 HWTEST_F(SceneSessionTest2, NotifyTouchOutside, Function | SmallTest | Level2)
1037 {
1038     SessionInfo info;
1039     info.abilityName_ = "NotifyTouchOutside";
1040     info.bundleName_ = "NotifyTouchOutside";
1041     sptr<SceneSession> scensession;
1042     scensession = new (std::nothrow) SceneSession(info, nullptr);
1043 
1044     scensession->sessionStage_ = new SessionStageMocker();
1045     EXPECT_NE(nullptr, scensession->sessionStage_);
1046     scensession->NotifyTouchOutside();
1047 
1048     scensession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1049     EXPECT_NE(nullptr, scensession->sessionChangeCallback_);
__anon7d4e209c0202() 1050     auto func = [scensession]() {
1051         scensession->SaveUpdatedIcon(nullptr);
1052     };
1053     scensession->sessionChangeCallback_->OnTouchOutside_ = func;
1054     EXPECT_NE(nullptr, &func);
1055     scensession->sessionStage_ = nullptr;
1056     scensession->NotifyTouchOutside();
1057 
1058     scensession->sessionChangeCallback_->OnTouchOutside_ = nullptr;
1059     scensession->sessionStage_ = nullptr;
1060     scensession->NotifyTouchOutside();
1061 }
1062 
1063 /**
1064  * @tc.name: CheckOutTouchOutsideRegister
1065  * @tc.desc:  * @tc.name: CheckOutTouchOutsideRegister
1066  * @tc.type: FUNC
1067  */
1068 HWTEST_F(SceneSessionTest2, CheckOutTouchOutsideRegister, Function | SmallTest | Level2)
1069 {
1070     SessionInfo info;
1071     info.abilityName_ = "CheckOutTouchOutsideRegister";
1072     info.bundleName_ = "CheckOutTouchOutsideRegister";
1073     sptr<SceneSession> scensession;
1074     scensession = new (std::nothrow) SceneSession(info, nullptr);
1075 
1076     scensession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1077     EXPECT_NE(nullptr, scensession->sessionChangeCallback_);
__anon7d4e209c0302() 1078     auto func = [scensession]() {
1079         scensession->NotifyWindowVisibility();
1080     };
1081     scensession->sessionChangeCallback_->OnTouchOutside_ = func;
1082     bool result = scensession->CheckOutTouchOutsideRegister();
1083     EXPECT_EQ(true, result);
1084 
1085     scensession->sessionChangeCallback_->OnTouchOutside_ = nullptr;
1086     result = scensession->CheckOutTouchOutsideRegister();
1087     EXPECT_EQ(false, result);
1088 
1089     scensession->sessionChangeCallback_ = nullptr;
1090     result = scensession->CheckOutTouchOutsideRegister();
1091     EXPECT_EQ(false, result);
1092 }
1093 
1094 /**
1095  * @tc.name: UpdateRotationAvoidArea
1096  * @tc.desc:  * @tc.name: UpdateRotationAvoidArea
1097  * @tc.type: FUNC
1098  */
1099 HWTEST_F(SceneSessionTest2, UpdateRotationAvoidArea, Function | SmallTest | Level2)
1100 {
1101     SessionInfo info;
1102     info.abilityName_ = "UpdateRotationAvoidArea";
1103     info.bundleName_ = "UpdateRotationAvoidArea";
1104     sptr<SceneSession> scensession;
1105     scensession = new (std::nothrow) SceneSession(info, nullptr);
1106     scensession->specificCallback_ = new SceneSession::SpecificSessionCallback();
1107     EXPECT_NE(nullptr, scensession->specificCallback_);
__anon7d4e209c0402(const int32_t& persistentId) 1108     auto func = [scensession](const int32_t& persistentId) {
1109         scensession->SetParentPersistentId(persistentId);
1110         scensession->GetParentPersistentId();
1111     };
1112     scensession->specificCallback_->onUpdateAvoidArea_ = func;
1113     sptr<Session> session;
1114     session = new (std::nothrow) Session(info);
1115     int result = session->GetPersistentId();
1116     EXPECT_EQ(0, result);
1117     scensession->UpdateRotationAvoidArea();
1118 
1119     scensession->specificCallback_ = nullptr;
1120     scensession->UpdateRotationAvoidArea();
1121 }
1122 
1123 /**
1124  * @tc.name: NotifyForceHideChange
1125  * @tc.desc:  * @tc.name: NotifyForceHideChange
1126  * @tc.type: FUNC
1127  */
1128 HWTEST_F(SceneSessionTest2, NotifyForceHideChange, Function | SmallTest | Level2)
1129 {
1130     SessionInfo info;
1131     info.abilityName_ = "NotifyForceHideChange";
1132     info.bundleName_ = "NotifyForceHideChange";
1133     sptr<SceneSession> scensession;
1134     scensession = new (std::nothrow) SceneSession(info, nullptr);
1135     scensession->NotifyForceHideChange(true);
1136 
1137     sptr<Session> session;
1138     session = new (std::nothrow) Session(info);
1139     scensession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
__anon7d4e209c0502(bool hide) 1140     auto func = [scensession](bool hide) {
1141         scensession->SetPrivacyMode(hide);
1142     };
1143     scensession->onForceHideChangeFunc_ = func;
1144     EXPECT_NE(nullptr, &func);
1145     scensession->NotifyForceHideChange(true);
1146 
1147     scensession->SetSessionProperty(nullptr);
1148     scensession->NotifyForceHideChange(true);
1149     ASSERT_EQ(scensession->property_, nullptr);
1150 }
1151 
1152 /**
1153  * @tc.name: RegisterSessionChangeCallback
1154  * @tc.desc:  * @tc.name: RegisterSessionChangeCallback
1155  * @tc.type: FUNC
1156  */
1157 HWTEST_F(SceneSessionTest2, RegisterSessionChangeCallback, Function | SmallTest | Level2)
1158 {
1159     SessionInfo info;
1160     info.abilityName_ = "RegisterSessionChangeCallback";
1161     info.bundleName_ = "RegisterSessionChangeCallback";
1162     sptr<SceneSession> scensession;
1163     scensession = new (std::nothrow) SceneSession(info, nullptr);
1164     sptr<SceneSession::SessionChangeCallback> callback = new SceneSession::SessionChangeCallback();
1165     EXPECT_NE(nullptr, callback);
1166     scensession->RegisterSessionChangeCallback(callback);
1167 }
1168 
1169 /**
1170  * @tc.name: ClearSpecificSessionCbMap
1171  * @tc.desc:  * @tc.name: ClearSpecificSessionCbMap
1172  * @tc.type: FUNC
1173  */
1174 HWTEST_F(SceneSessionTest2, ClearSpecificSessionCbMap, Function | SmallTest | Level2)
1175 {
1176     SessionInfo info;
1177     info.abilityName_ = "ClearSpecificSessionCbMap";
1178     info.bundleName_ = "ClearSpecificSessionCbMap";
1179     sptr<SceneSession> scensession;
1180     scensession = new (std::nothrow) SceneSession(info, nullptr);
1181     EXPECT_NE(nullptr, scensession);
1182     scensession->ClearSpecificSessionCbMap();
1183 }
1184 
1185 /**
1186  * @tc.name: SendPointerEventToUI
1187  * @tc.desc:  * @tc.name: SendPointerEventToUI
1188  * @tc.type: FUNC
1189  */
1190 HWTEST_F(SceneSessionTest2, SendPointerEventToUI, Function | SmallTest | Level2)
1191 {
1192     SessionInfo info;
1193     info.abilityName_ = "SendPointerEventToUI";
1194     info.bundleName_ = "SendPointerEventToUI";
1195     sptr<SceneSession> scensession;
1196     scensession = new (std::nothrow) SceneSession(info, nullptr);
1197     EXPECT_NE(nullptr, scensession);
__anon7d4e209c0602(std::shared_ptr<MMI::PointerEvent> pointerEvent) 1198     auto pointerEventFunc = [scensession](std::shared_ptr<MMI::PointerEvent> pointerEvent) {
1199         scensession->NotifyOutsideDownEvent(pointerEvent);
1200     };
1201     scensession->systemSessionPointerEventFunc_ = pointerEventFunc;
1202     std::shared_ptr<MMI::PointerEvent> pointerEvent =
1203          MMI::PointerEvent::Create();
1204     scensession->SendPointerEventToUI(pointerEvent);
1205     EXPECT_NE(nullptr, pointerEvent);
1206 }
1207 
1208 /**
1209  * @tc.name: SetFloatingScale
1210  * @tc.desc:  * @tc.name: SetFloatingScale
1211  * @tc.type: FUNC
1212  */
1213 HWTEST_F(SceneSessionTest2, SetFloatingScale, Function | SmallTest | Level2)
1214 {
1215     SessionInfo info;
1216     info.abilityName_ = "SetFloatingScale";
1217     info.bundleName_ = "SetFloatingScale";
1218     sptr<SceneSession> scensession;
1219     scensession = new (std::nothrow) SceneSession(info, nullptr);
1220     scensession->specificCallback_ = new SceneSession::SpecificSessionCallback();
__anon7d4e209c0702(int32_t persistentId, WindowUpdateType type) 1221     auto windowInfoUpdateFun = [scensession](int32_t persistentId, WindowUpdateType type) {
1222         if (WindowUpdateType::WINDOW_UPDATE_PROPERTY == type) {
1223             scensession->SetCollaboratorType(persistentId);
1224             return;
1225         } else {
1226             persistentId++;
1227             scensession->SetParentPersistentId(persistentId);
1228             return;
1229         }
1230     };
__anon7d4e209c0802(const int32_t& persistentId) 1231     auto updateAvoidAreaFun = [scensession](const int32_t& persistentId) {
1232         bool result = scensession->RemoveSubSession(persistentId);
1233         scensession->SetWindowAnimationFlag(result);
1234     };
1235     scensession->specificCallback_->onWindowInfoUpdate_ = windowInfoUpdateFun;
1236     scensession->specificCallback_->onUpdateAvoidArea_ = updateAvoidAreaFun;
1237     scensession->SetFloatingScale(3.14f);
1238     EXPECT_EQ(3.14f, scensession->floatingScale_);
1239 
1240     scensession->floatingScale_ = 3.0f;
1241     scensession->SetFloatingScale(3.0f);
1242     EXPECT_EQ(3.0f, scensession->floatingScale_);
1243 }
1244 
1245 /**
1246  * @tc.name: ProcessPointDownSession
1247  * @tc.desc:  * @tc.name: ProcessPointDownSession
1248  * @tc.type: FUNC
1249  */
1250 HWTEST_F(SceneSessionTest2, ProcessPointDownSession, Function | SmallTest | Level2)
1251 {
1252     SessionInfo info;
1253     info.abilityName_ = "ProcessPointDownSession";
1254     info.bundleName_ = "ProcessPointDownSession";
1255     sptr<SceneSession> scensession;
1256     scensession = new (std::nothrow) SceneSession(info, nullptr);
1257     scensession->specificCallback_ = new SceneSession::SpecificSessionCallback();
1258     EXPECT_NE(nullptr, scensession->specificCallback_);
__anon7d4e209c0902(int32_t persistentId) 1259     auto sessionTouchOutsideFun = [scensession](int32_t persistentId) {
1260         scensession->SetCollaboratorType(persistentId);
1261     };
__anon7d4e209c0a02(int32_t x, int32_t y) 1262     auto outsideDownEventFun = [scensession](int32_t x, int32_t y) {
1263         int z = x + y;
1264         scensession->SetCollaboratorType(z);
1265     };
1266     scensession->specificCallback_->onSessionTouchOutside_ = sessionTouchOutsideFun;
1267     scensession->specificCallback_->onOutsideDownEvent_ = outsideDownEventFun;
1268     EXPECT_EQ(WSError::WS_OK, scensession->ProcessPointDownSession(3, 4));
1269 
1270     scensession->specificCallback_->onSessionTouchOutside_ = nullptr;
1271     EXPECT_EQ(WSError::WS_OK, scensession->ProcessPointDownSession(3, 4));
1272 
1273     scensession->sessionInfo_.bundleName_ = "SCBGestureBack";
1274     scensession->specificCallback_->onOutsideDownEvent_ = nullptr;
1275     EXPECT_EQ(WSError::WS_OK, scensession->ProcessPointDownSession(3, 4));
1276 }
1277 
1278 /**
1279  * @tc.name: SetSelfToken
1280  * @tc.desc:  * @tc.name: SetSelfToken
1281  * @tc.type: FUNC
1282  */
1283 HWTEST_F(SceneSessionTest2, SetSelfToken, Function | SmallTest | Level2)
1284 {
1285     SessionInfo info;
1286     info.abilityName_ = "SetSelfToken";
1287     info.bundleName_ = "SetSelfToken";
1288     sptr<SceneSession> scensession;
1289     sptr<SceneSession::SpecificSessionCallback> specificSession =
1290         new SceneSession::SpecificSessionCallback();
1291     scensession = new (std::nothrow) SceneSession(info, specificSession);
1292     EXPECT_NE(nullptr, scensession);
1293     scensession->SetSessionState(SessionState::STATE_DISCONNECT);
1294     scensession->UpdateSessionState(SessionState::STATE_CONNECT);
1295     scensession->UpdateSessionState(SessionState::STATE_ACTIVE);
1296     scensession->isVisible_ = true;
1297     EXPECT_EQ(true, scensession->IsVisibleForAccessibility());
1298     scensession->SetSystemTouchable(false);
1299     EXPECT_EQ(false, scensession->IsVisibleForAccessibility());
1300     scensession->SetForegroundInteractiveStatus(true);
1301     scensession->NotifyAccessibilityVisibilityChange();
__anon7d4e209c0b02(int32_t persistentId, WindowUpdateType type) 1302     auto windowInfoUpdateFun = [scensession](int32_t persistentId, WindowUpdateType type) {
1303         if (WindowUpdateType::WINDOW_UPDATE_PROPERTY == type) {
1304             scensession->SetCollaboratorType(persistentId);
1305             return;
1306         } else {
1307             persistentId++;
1308             scensession->SetParentPersistentId(persistentId);
1309             return;
1310         }
1311     };
1312     scensession->specificCallback_->onWindowInfoUpdate_ = windowInfoUpdateFun;
1313     scensession->NotifyAccessibilityVisibilityChange();
1314     EXPECT_NE(nullptr, scensession->specificCallback_);
1315 }
1316 
1317 /**
1318  * @tc.name: SetLastSafeRect
1319  * @tc.desc:  * @tc.name: SetLastSafeRect
1320  * @tc.type: FUNC
1321  */
1322 HWTEST_F(SceneSessionTest2, SetLastSafeRect, Function | SmallTest | Level2)
1323 {
1324     SessionInfo info;
1325     info.abilityName_ = "SetLastSafeRect";
1326     info.bundleName_ = "SetLastSafeRect";
1327     sptr<SceneSession> scensession;
1328     sptr<SceneSession::SpecificSessionCallback> specificSession =
1329         new SceneSession::SpecificSessionCallback();
1330     scensession = new (std::nothrow) SceneSession(info, specificSession);
1331     WSRect rect = {3, 4, 5, 6};
1332     scensession->SetLastSafeRect(rect);
1333     WSRect result = scensession->GetLastSafeRect();
1334     EXPECT_EQ(3, result.posX_);
1335     EXPECT_EQ(4, result.posY_);
1336     EXPECT_EQ(5, result.width_);
1337     EXPECT_EQ(6, result.height_);
1338 }
1339 
1340 /**
1341  * @tc.name: GetSessionTargetRect
1342  * @tc.desc:  * @tc.name: GetSessionTargetRect
1343  * @tc.type: FUNC
1344  */
1345 HWTEST_F(SceneSessionTest2, GetSessionTargetRect, Function | SmallTest | Level2)
1346 {
1347     SessionInfo info;
1348     info.abilityName_ = "GetSubSession";
1349     info.bundleName_ = "GetSessionTargetRect";
1350     sptr<SceneSession> scensession;
1351     sptr<SceneSession::SpecificSessionCallback> specificSession =
1352         new SceneSession::SpecificSessionCallback();
1353     scensession = new (std::nothrow) SceneSession(info, specificSession);
1354     bool res = scensession->AddSubSession(scensession);
1355     EXPECT_EQ(true, res);
1356     EXPECT_EQ(scensession, (scensession->GetSubSession())[0]);
1357     scensession->moveDragController_ = new MoveDragController(1024);
1358     WSRect rectResult = scensession->GetSessionTargetRect();
1359     EXPECT_EQ(0, rectResult.posX_);
1360     EXPECT_EQ(0, rectResult.width_);
__anon7d4e209c0c02(int32_t type, const SizeChangeReason& reason) 1361     auto dragHotAreaFunc = [scensession](int32_t type, const SizeChangeReason& reason) {
1362         if (SizeChangeReason::END == reason) {
1363             GTEST_LOG_(INFO) << "type = " << type;
1364         }
1365         return;
1366     };
1367     scensession->SetWindowDragHotAreaListener(dragHotAreaFunc);
1368     EXPECT_NE(nullptr,  scensession->moveDragController_);
1369     scensession->moveDragController_ = nullptr;
1370     rectResult = scensession->GetSessionTargetRect();
1371     scensession->SetWindowDragHotAreaListener(dragHotAreaFunc);
1372     ASSERT_EQ(0, rectResult.width_);
1373 }
1374 
1375 /**
1376  * @tc.name: SetPipActionEvent
1377  * @tc.desc:  * @tc.name: SetPipActionEvent
1378  * @tc.type: FUNC
1379  */
1380 HWTEST_F(SceneSessionTest2, SetPipActionEvent, Function | SmallTest | Level2)
1381 {
1382     SessionInfo info;
1383     info.abilityName_ = "SetPipActionEvent";
1384     info.bundleName_ = "SetPipActionEvent";
1385     auto sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1386     EXPECT_NE(sceneSession, nullptr);
1387 
1388     WSError res = sceneSession->SetPipActionEvent("close", 0);
1389     ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
1390     auto mockSessionStage = sptr<SessionStageMocker>::MakeSptr();
1391     sceneSession->sessionStage_ = mockSessionStage;
1392     res = sceneSession->SetPipActionEvent("close", 0);
1393     ASSERT_EQ(res, WSError::WS_OK);
1394 }
1395 
1396 /*
1397  * @tc.name: SetPiPControlEvent
1398  * @tc.desc:  * @tc.name: SetPiPControlEvent
1399  * @tc.type: FUNC
1400  */
1401 HWTEST_F(SceneSessionTest2, SetPiPControlEvent, Function | SmallTest | Level2)
1402 {
1403     SessionInfo info;
1404     info.abilityName_ = "SetPiPControlEvent";
1405     info.bundleName_ = "SetPiPControlEvent";
1406     auto sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1407     EXPECT_NE(sceneSession, nullptr);
1408 
1409     auto property = sptr<WindowSessionProperty>::MakeSptr();
1410     EXPECT_NE(property, nullptr);
1411     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
1412     sceneSession->SetSessionProperty(property);
1413     auto controlType = WsPiPControlType::VIDEO_PLAY_PAUSE;
1414     auto status = WsPiPControlStatus::PLAY;
1415     WSError res = sceneSession->SetPiPControlEvent(controlType, status);
1416     ASSERT_EQ(res, WSError::WS_ERROR_INVALID_TYPE);
1417 
1418     auto sessionStage = sptr<SessionStageMocker>::MakeSptr();
1419     ASSERT_NE(sessionStage, nullptr);
1420 
1421     property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
1422     property->SetWindowMode(WindowMode::WINDOW_MODE_PIP);
1423     sceneSession->SetSessionProperty(property);
1424     res = sceneSession->SetPiPControlEvent(controlType, status);
1425     ASSERT_EQ(res, WSError::WS_ERROR_NULLPTR);
1426 }
1427 
1428 /**
1429  * @tc.name: SetForceHideState
1430  * @tc.desc: SetForceHideState
1431  * @tc.type: FUNC
1432  */
1433 HWTEST_F(SceneSessionTest2, SetForceHideState, Function | SmallTest | Level2)
1434 {
1435     SessionInfo info;
1436     info.abilityName_ = "SetForceHideState";
1437     info.bundleName_ = "SetForceHideState";
1438     sptr<SceneSession> sceneSession;
1439     sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1440     EXPECT_NE(sceneSession, nullptr);
1441 
1442     sceneSession->SetForceHideState(ForceHideState::NOT_HIDDEN);
1443     bool hide = sceneSession->GetForceHideState();
1444     ASSERT_EQ(hide, ForceHideState::NOT_HIDDEN);
1445     sceneSession->SetForceHideState(ForceHideState::HIDDEN_WHEN_FOCUSED);
1446     hide = sceneSession->GetForceHideState();
1447     ASSERT_EQ(hide, ForceHideState::HIDDEN_WHEN_FOCUSED);
1448 }
1449 
1450 /**
1451  * @tc.name: ClearSpecificSessionCbMap
1452  * @tc.desc:  * @tc.name: ClearSpecificSessionCbMap
1453  * @tc.type: FUNC
1454  */
1455 HWTEST_F(SceneSessionTest2, ClearSpecificSessionCbMap01, Function | SmallTest | Level2)
1456 {
1457     SessionInfo info;
1458     info.abilityName_ = "ClearSpecificSessionCbMap01";
1459     info.bundleName_ = "ClearSpecificSessionCbMap01";
1460     sptr<SceneSession> scensession;
1461     scensession = new (std::nothrow) SceneSession(info, nullptr);
1462     EXPECT_NE(nullptr, scensession);
1463     sptr<Session> session;
1464     session = new (std::nothrow) Session(info);
1465     scensession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1466     scensession->ClearSpecificSessionCbMap();
1467 
1468     bool isFromClient = true;
1469     scensession->needSnapshot_ = true;
1470     scensession->specificCallback_ = new (std::nothrow) SceneSession::SpecificSessionCallback();
1471     scensession->Disconnect(isFromClient);
1472 
1473     bool isActive = false;
1474     scensession->UpdateActiveStatus(isActive);
1475     isActive = true;
1476     Session ssession(info);
1477     ssession.state_ = SessionState::STATE_FOREGROUND;
1478     isActive = false;
1479     ssession.state_ = SessionState::STATE_ACTIVE;
1480 }
1481 
1482 /**
1483  * @tc.name: OnSessionEvent01
1484  * @tc.desc:  * @tc.name: OnSessionEvent
1485  * @tc.type: FUNC
1486  */
1487 HWTEST_F(SceneSessionTest2, OnSessionEvent01, Function | SmallTest | Level2)
1488 {
1489     SessionInfo info;
1490     info.abilityName_ = "OnSessionEvent01";
1491     info.bundleName_ = "OnSessionEvent01";
1492 
1493     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1494     EXPECT_NE(sceneSession, nullptr);
1495 
1496     SessionEvent event = SessionEvent::EVENT_START_MOVE;
1497     sceneSession->moveDragController_ = new MoveDragController(1);
1498     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1499     sceneSession->OnSessionEvent(event);
1500 
1501     sceneSession->moveDragController_->isStartDrag_ = true;
1502     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1503     EXPECT_NE(sceneSession->sessionChangeCallback_, nullptr);
1504     auto result = sceneSession->OnSessionEvent(event);
1505     ASSERT_EQ(result, WSError::WS_OK);
1506 }
1507 
1508 /**
1509  * @tc.name: SetSessionRectChangeCallback
1510  * @tc.desc:  * @tc.name: SetSessionRectChangeCallback
1511  * @tc.type: FUNC
1512  */
1513 HWTEST_F(SceneSessionTest2, SetSessionRectChangeCallback, Function | SmallTest | Level2)
1514 {
1515     SessionInfo info;
1516     info.abilityName_ = "SetSessionRectChangeCallback";
1517     info.bundleName_ = "SetSessionRectChangeCallback";
1518 
1519     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1520     EXPECT_NE(sceneSession, nullptr);
1521 
1522     NotifySessionRectChangeFunc func;
1523     sceneSession->SetSessionRectChangeCallback(func);
1524     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1525 
1526     sceneSession->RaiseToAppTop();
1527     sceneSession = nullptr;
1528     GTEST_LOG_(INFO) << "2";
1529     sceneSession->BindDialogSessionTarget(sceneSession);
1530 
1531     Session ssession(info);
1532     ssession.property_ = nullptr;
1533 }
1534 
1535 /**
1536  * @tc.name: SetSessionPiPControlStatusChangeCallback
1537  * @tc.desc:  * @tc.name: SetSessionPiPControlStatusChangeCallback
1538  * @tc.type: FUNC
1539  */
1540 HWTEST_F(SceneSessionTest2, SetSessionPiPControlStatusChangeCallback, Function | SmallTest | Level2)
1541 {
1542     SessionInfo info;
1543     info.abilityName_ = "SetSessionPiPControlStatusChangeCallback";
1544     info.bundleName_ = "SetSessionPiPControlStatusChangeCallback";
1545     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1546     EXPECT_NE(sceneSession, nullptr);
1547     NotifySessionPiPControlStatusChangeFunc func;
1548     sceneSession->SetSessionPiPControlStatusChangeCallback(func);
1549 }
1550 
1551 /**
1552  * @tc.name: SetAutoStartPiPStatusChangeCallback
1553  * @tc.desc: SetAutoStartPiPStatusChangeCallback
1554  * @tc.type: FUNC
1555  */
1556 HWTEST_F(SceneSessionTest2, SetAutoStartPiPStatusChangeCallback, Function | SmallTest | Level2)
1557 {
1558     SessionInfo info;
1559     info.abilityName_ = "SetAutoStartPiPStatusChangeCallback";
1560     info.bundleName_ = "SetAutoStartPiPStatusChangeCallback";
1561     auto sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1562     EXPECT_NE(sceneSession, nullptr);
1563     NotifyAutoStartPiPStatusChangeFunc func;
1564     sceneSession->SetAutoStartPiPStatusChangeCallback(func);
1565 }
1566 
1567 /**
1568  * @tc.name: RaiseAppMainWindowToTop
1569  * @tc.desc:  * @tc.name: RaiseAppMainWindowToTop
1570  * @tc.type: FUNC
1571  */
1572 HWTEST_F(SceneSessionTest2, RaiseAppMainWindowToTop, Function | SmallTest | Level2)
1573 {
1574     SessionInfo info;
1575     info.abilityName_ = "RaiseAppMainWindowToTop";
1576     info.bundleName_ = "RaiseAppMainWindowToTop";
1577 
1578     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1579     EXPECT_NE(sceneSession, nullptr);
1580 
1581     sceneSession->RaiseAppMainWindowToTop();
1582     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1583     bool status = true;
1584     sceneSession->OnNeedAvoid(status);
1585 
1586     bool showWhenLocked = true;
1587     sceneSession->OnShowWhenLocked(showWhenLocked);
1588     sceneSession->NotifyPropertyWhenConnect();
1589 }
1590 
1591 /**
1592  * @tc.name: GetKeyboardAvoidArea
1593  * @tc.desc:  * @tc.name: GetKeyboardAvoidArea01
1594  * @tc.type: FUNC
1595  */
1596 HWTEST_F(SceneSessionTest2, GetKeyboardAvoidArea01, Function | SmallTest | Level2)
1597 {
1598     SessionInfo info;
1599     info.abilityName_ = "GetKeyboardAvoidArea";
1600     info.bundleName_ = "GetKeyboardAvoidArea";
1601 
1602     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1603     EXPECT_NE(sceneSession, nullptr);
1604 
1605     WSRect rect;
1606     AvoidArea avoidArea;
1607     GTEST_LOG_(INFO) << "1";
1608     sceneSession->GetKeyboardAvoidArea(rect, avoidArea);
1609 }
1610 
1611 /**
1612  * @tc.name: GetCutoutAvoidArea
1613  * @tc.desc:  * @tc.name: GetCutoutAvoidArea
1614  * @tc.type: FUNC
1615  */
1616 HWTEST_F(SceneSessionTest2, GetCutoutAvoidArea01, Function | SmallTest | Level2)
1617 {
1618     SessionInfo info;
1619     info.abilityName_ = "GetCutoutAvoidArea";
1620     info.bundleName_ = "GetCutoutAvoidArea";
1621 
1622     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1623     EXPECT_NE(sceneSession, nullptr);
1624 
1625     WSRect rect;
1626     AvoidArea avoidArea;
1627     DisplayManager displayManager;
1628     Session ssession(info);
1629     auto display = DisplayManager::GetInstance().GetDisplayById(
1630         ssession.GetSessionProperty()->GetDisplayId());
1631     sceneSession->GetCutoutAvoidArea(rect, avoidArea);
1632 }
1633 
1634 /**
1635  * @tc.name: GetAINavigationBarArea
1636  * @tc.desc:  * @tc.name: GetAINavigationBarArea
1637  * @tc.type: FUNC
1638  */
1639 HWTEST_F(SceneSessionTest2, GetAINavigationBarArea, Function | SmallTest | Level2)
1640 {
1641     SessionInfo info;
1642     info.abilityName_ = "GetAINavigationBarArea";
1643     info.bundleName_ = "GetAINavigationBarArea";
1644 
1645     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1646     EXPECT_NE(sceneSession, nullptr);
1647 
1648     WSRect rect;
1649     AvoidArea avoidArea;
1650     sceneSession->GetAINavigationBarArea(rect, avoidArea);
1651 
1652     sceneSession->SetIsDisplayStatusBarTemporarily(true);
1653     sceneSession->GetAINavigationBarArea(rect, avoidArea);
1654     ASSERT_EQ(sceneSession->GetIsDisplayStatusBarTemporarily(), true);
1655 
1656     auto property = sptr<WindowSessionProperty>::MakeSptr();
1657     EXPECT_NE(property, nullptr);
1658     property->SetWindowMode(WindowMode::WINDOW_MODE_PIP);
1659     sceneSession->property_ = property;
1660     sceneSession->GetAINavigationBarArea(rect, avoidArea);
1661 
1662     sceneSession->SetSessionProperty(nullptr);
1663     sceneSession->GetAINavigationBarArea(rect, avoidArea);
1664 
1665     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1666     sceneSession->SetSessionProperty(property);
1667     sceneSession->specificCallback_ = new SceneSession::SpecificSessionCallback();
1668     ASSERT_NE(nullptr, sceneSession->specificCallback_);
__anon7d4e209c0d02(uint64_t displayId) 1669     sceneSession->specificCallback_->onGetAINavigationBarArea_ = [](uint64_t displayId) {
1670         WSRect rect = {1, 1, 1, 1};
1671         return rect;
1672     };
1673     sceneSession->GetAINavigationBarArea(rect, avoidArea);
1674 }
1675 
1676 /**
1677  * @tc.name: TransferPointerEvent
1678  * @tc.desc:  * @tc.name: TransferPointerEvent
1679  * @tc.type: FUNC
1680  */
1681 HWTEST_F(SceneSessionTest2, TransferPointerEvent03, Function | SmallTest | Level2)
1682 {
1683     SessionInfo info;
1684     info.abilityName_ = "TransferPointerEvent";
1685     info.bundleName_ = "TransferPointerEvent";
1686 
1687     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1688     EXPECT_NE(sceneSession, nullptr);
1689 
1690     std::shared_ptr<MMI::PointerEvent> pointerEvent = nullptr;
1691     sceneSession->specificCallback_ = new (std::nothrow) SceneSession::SpecificSessionCallback();
1692 
1693     sceneSession->TransferPointerEvent(pointerEvent);
1694 
1695     WindowLimits limits;
1696     WSRect rect;
1697     float ratio = 0.0;
1698     bool isDecor = true;
1699     float vpr = 0.0;
1700     sceneSession->FixRectByLimits(limits, rect, ratio, isDecor, vpr);
1701     sceneSession->SetPipActionEvent("pointerEvent", 0);
1702 
1703     auto property = sptr<WindowSessionProperty>::MakeSptr();
1704     EXPECT_NE(property, nullptr);
1705     property->SetWindowType(WindowType::WINDOW_TYPE_FLOAT);
1706     sceneSession->SetSessionProperty(property);
1707     ASSERT_EQ(WSError::WS_ERROR_NULLPTR, sceneSession->SetPipActionEvent("pointerEvent", 0));
1708 
1709     sceneSession->sessionStage_ = sptr<SessionStageMocker>::MakeSptr();
1710     property->SetWindowType(WindowType::WINDOW_TYPE_PIP);
1711     property->SetWindowMode(WindowMode::WINDOW_MODE_PIP);
1712     ASSERT_EQ(WSError::WS_OK, sceneSession->SetPipActionEvent("pointerEvent", 0));
1713 
1714     sceneSession->FixRectByLimits(limits, rect, ratio, false, vpr);
1715 }
1716 
1717 /**
1718  * @tc.name: OnMoveDragCallback
1719  * @tc.desc:  * @tc.name: OnMoveDragCallback
1720  * @tc.type: FUNC
1721  */
1722 HWTEST_F(SceneSessionTest2, OnMoveDragCallback, Function | SmallTest | Level2)
1723 {
1724     SessionInfo info;
1725     info.abilityName_ = "OnMoveDragCallback";
1726     info.bundleName_ = "OnMoveDragCallback";
1727 
1728     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1729     EXPECT_NE(sceneSession, nullptr);
1730 
1731     Session session(info);
1732     WSRect rect;
1733     sceneSession->UpdateWinRectForSystemBar(rect);
1734     sceneSession->SetSurfaceBounds(rect);
1735     sceneSession->GetWindowNameAllType();
1736     session.scenePersistence_ = new ScenePersistence("aa", 0);
1737     sceneSession->GetUpdatedIconPath();
1738 
1739     bool visible = true;
1740     sceneSession->UpdateNativeVisibility(visible);
1741 
1742     sceneSession->scenePersistence_ = new (std::nothrow) ScenePersistence(info.bundleName_, 0);
1743     EXPECT_NE(sceneSession->scenePersistence_, nullptr);
1744     sceneSession->GetUpdatedIconPath();
1745 }
1746 
1747 /**
1748  * @tc.name: OnMoveDragCallback
1749  * @tc.desc:  * @tc.name: OnMoveDragCallback
1750  * @tc.type: FUNC
1751  */
1752 HWTEST_F(SceneSessionTest2, OnMoveDragCallback01, Function | SmallTest | Level2)
1753 {
1754     SessionInfo info;
1755     info.abilityName_ = "OnMoveDragCallback01";
1756     info.bundleName_ = "OnMoveDragCallback01";
1757 
1758     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1759     EXPECT_NE(sceneSession, nullptr);
1760 
1761     double alpha = 0.5;
1762     Session session(info);
1763 
1764     sceneSession->SetSystemSceneOcclusionAlpha(alpha);
1765     sceneSession->IsNeedDefaultAnimation();
1766     bool isPlaying = true;
1767     sceneSession->NotifyIsCustomAnimationPlaying(isPlaying);
1768 
1769     sptr<AAFwk::SessionInfo> abilitySessionInfo = nullptr;
1770     bool visible = true;
1771     sceneSession->ChangeSessionVisibilityWithStatusBar(abilitySessionInfo, visible);
1772 }
1773 
1774 /**
1775  * @tc.name: OnMoveDragCallback
1776  * @tc.desc:  * @tc.name: OnMoveDragCallback
1777  * @tc.type: FUNC
1778  */
1779 HWTEST_F(SceneSessionTest2, OnMoveDragCallback02, Function | SmallTest | Level2)
1780 {
1781     SessionInfo info;
1782     info.abilityName_ = "OnMoveDragCallback02";
1783     info.bundleName_ = "OnMoveDragCallback02";
1784 
1785     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1786     EXPECT_NE(sceneSession, nullptr);
1787     sptr<SceneSession> ssession = nullptr;
1788     sceneSession->HandleCastScreenConnection(info, ssession);
1789 
1790     Session session(info);
1791     sptr<AAFwk::SessionInfo> abilitySessionInfo = nullptr;
1792     session.isTerminating_ = true;
1793     sceneSession->TerminateSession(abilitySessionInfo);
1794 
1795     bool needRemoveSession = true;
1796     session.sessionExceptionFunc_ = std::make_shared<NotifySessionExceptionFunc>();
1797     session.jsSceneSessionExceptionFunc_ = std::make_shared<NotifySessionExceptionFunc>();
1798     sceneSession->NotifySessionException(abilitySessionInfo, needRemoveSession);
1799 
1800     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
1801     sceneSession->NotifyPiPWindowPrepareClose();
1802 
1803     bool isLandscapeMultiWindow = true;
1804     sceneSession->SetLandscapeMultiWindow(isLandscapeMultiWindow);
1805 
1806     std::shared_ptr<MMI::KeyEvent> keyEvent = std::make_shared<MMI::KeyEvent>(MMI::KeyEvent::KEYCODE_BACK);
1807     bool isPreImeEvent = true;
1808     sceneSession->SendKeyEventToUI(keyEvent, isPreImeEvent);
1809     sceneSession->IsDirtyWindow();
1810     sceneSession->moveDragController_ = new MoveDragController(0);
1811     sceneSession->NotifyUILostFocus();
1812 }
1813 
1814 /**
1815  * @tc.name: IsStartMoving
1816  * @tc.desc:  * @tc.name: IsStartMoving
1817  * @tc.type: FUNC
1818  */
1819 HWTEST_F(SceneSessionTest2, IsStartMoving, Function | SmallTest | Level2)
1820 {
1821     SessionInfo info;
1822     info.abilityName_ = "IsStartMoving";
1823     info.bundleName_ = "IsStartMoving";
1824 
1825     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1826     EXPECT_NE(sceneSession, nullptr);
1827 
1828     sceneSession->IsStartMoving();
1829     bool startMoving = true;
1830     sceneSession->SetIsStartMoving(startMoving);
1831     DisplayId from = 0;
1832     DisplayId to = 0;
1833     sceneSession->NotifyDisplayMove(from, to);
1834     sceneSession->ClearExtWindowFlags();
1835     bool isRegister = true;
1836     sceneSession->UpdateRectChangeListenerRegistered(isRegister);
1837 
1838     sceneSession->sessionStage_ = new SessionStageMocker();
1839     EXPECT_NE(nullptr, sceneSession->sessionStage_);
1840     sceneSession->NotifyDisplayMove(from, to);
1841 }
1842 
1843 /**
1844  * @tc.name: IsSystemSpecificSession
1845  * @tc.desc: IsSystemSpecificSession
1846  * @tc.type: FUNC
1847  */
1848 HWTEST_F(SceneSessionTest2, IsSystemSpecificSession, Function | SmallTest | Level2)
1849 {
1850     SessionInfo info;
1851     info.abilityName_ = "IsSystemSpecificSession";
1852     info.bundleName_ = "IsSystemSpecificSession";
1853 
1854     sptr<SceneSession> sceneSession = sptr<SceneSession>::MakeSptr(info, nullptr);
1855     ASSERT_NE(sceneSession, nullptr);
1856 
1857     ASSERT_FALSE(sceneSession->IsSystemSpecificSession());
1858     sceneSession->SetIsSystemSpecificSession(true);
1859     ASSERT_TRUE(sceneSession->IsSystemSpecificSession());
1860 }
1861 
1862 /**
1863  * @tc.name: SetTemporarilyShowWhenLocked
1864  * @tc.desc:  * @tc.name: SetTemporarilyShowWhenLocked
1865  * @tc.type: FUNC
1866  */
1867 HWTEST_F(SceneSessionTest2, SetTemporarilyShowWhenLocked, Function | SmallTest | Level2)
1868 {
1869     SessionInfo info;
1870     info.abilityName_ = "SetTemporarilyShowWhenLocked";
1871     info.bundleName_ = "SetTemporarilyShowWhenLocked";
1872     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1873     EXPECT_NE(sceneSession, nullptr);
1874     bool isTemporarilyShowWhenLocked = sceneSession->IsTemporarilyShowWhenLocked();
1875     ASSERT_EQ(isTemporarilyShowWhenLocked, false);
1876     sceneSession->SetTemporarilyShowWhenLocked(true);
1877     isTemporarilyShowWhenLocked = sceneSession->IsTemporarilyShowWhenLocked();
1878     ASSERT_EQ(isTemporarilyShowWhenLocked, true);
1879     sceneSession->SetTemporarilyShowWhenLocked(false);
1880     isTemporarilyShowWhenLocked = sceneSession->IsTemporarilyShowWhenLocked();
1881     ASSERT_EQ(isTemporarilyShowWhenLocked, false);
1882 
1883     sceneSession->isTemporarilyShowWhenLocked_.store(true);
1884     sceneSession->SetTemporarilyShowWhenLocked(true);
1885     ASSERT_EQ(sceneSession->IsTemporarilyShowWhenLocked(), true);
1886 }
1887 
1888 /**
1889  * @tc.name: GetShowWhenLockedFlagValue
1890  * @tc.desc:  * @tc.name: GetShowWhenLockedFlagValue
1891  * @tc.type: FUNC
1892  */
1893 HWTEST_F(SceneSessionTest2, GetShowWhenLockedFlagValue, Function | SmallTest | Level2)
1894 {
1895     SessionInfo info;
1896     info.abilityName_ = "GetShowWhenLockedFlagValue";
1897     info.bundleName_ = "GetShowWhenLockedFlagValue";
1898     info.windowType_ = 1;
1899     sptr<SceneSession::SpecificSessionCallback> specificCallback_ =
1900         new (std::nothrow) SceneSession::SpecificSessionCallback();
1901     EXPECT_NE(specificCallback_, nullptr);
1902     sptr<SceneSession> scensession;
1903     scensession = new (std::nothrow) SceneSession(info, specificCallback_);
1904     EXPECT_NE(scensession, nullptr);
1905     sptr<WindowSessionProperty> property = new WindowSessionProperty();
1906     EXPECT_NE(property, nullptr);
1907     property->SetWindowMode(WindowMode::WINDOW_MODE_FLOATING);
1908     property->SetWindowType(WindowType::WINDOW_TYPE_APP_MAIN_WINDOW);
1909     ASSERT_EQ(scensession->GetShowWhenLockedFlagValue(), false);
1910     scensession->property_ = property;
1911     property->SetWindowFlags(4);
1912     ASSERT_EQ(scensession->GetShowWhenLockedFlagValue(), true);
1913 }
1914 
1915 /**
1916  * @tc.name: SetClientIdentityToken
1917  * @tc.desc: SetClientIdentityToken
1918  * @tc.type: FUNC
1919  */
1920 HWTEST_F(SceneSessionTest2, SetClientIdentityToken, Function | SmallTest | Level2)
1921 {
1922     SessionInfo info;
1923     info.abilityName_ = "SetClientIdentityToken";
1924     info.bundleName_ = "SetClientIdentityToken";
1925     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1926     EXPECT_NE(sceneSession, nullptr);
1927     std::string token = "testToken";
1928     sceneSession->SetClientIdentityToken(token);
1929     ASSERT_EQ(sceneSession->GetClientIdentityToken(), token);
1930 }
1931 
1932 /**
1933  * @tc.name: SetSkipDraw
1934  * @tc.desc: SetSkipDraw
1935  * @tc.type: FUNC
1936  */
1937 HWTEST_F(SceneSessionTest2, SetSkipDraw, Function | SmallTest | Level2)
1938 {
1939     SessionInfo info;
1940     info.abilityName_ = "SetSkipDraw";
1941     info.bundleName_ = "SetSkipDraw";
1942     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1943     EXPECT_NE(sceneSession, nullptr);
1944     sceneSession->SetSkipDraw(true);
1945     sceneSession->SetSkipDraw(false);
1946 }
1947 
1948 /**
1949  * @tc.name: GetWindowDragHotAreaType
1950  * @tc.desc: GetWindowDragHotAreaType
1951  * @tc.type: FUNC
1952  */
1953 HWTEST_F(SceneSessionTest2, GetWindowDragHotAreaType, Function | SmallTest | Level2)
1954 {
1955     SessionInfo info;
1956     info.abilityName_ = "HotAreaType";
1957     info.bundleName_ = "HotAreaType";
1958     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1959     EXPECT_NE(sceneSession, nullptr);
1960     WSRect rect = {0, 0, 10, 10};
1961     sceneSession->AddOrUpdateWindowDragHotArea(1, rect);
1962     sceneSession->AddOrUpdateWindowDragHotArea(1, rect);
1963     auto type = sceneSession->GetWindowDragHotAreaType(1, 2, 2);
1964     ASSERT_EQ(type, 1);
1965 }
1966 
1967 /**
1968  * @tc.name: GetSubWindowModalType
1969  * @tc.desc: GetSubWindowModalType
1970  * @tc.type: FUNC
1971  */
1972 HWTEST_F(SceneSessionTest2, GetSubWindowModalType, Function | SmallTest | Level2)
1973 {
1974     SessionInfo info;
1975     info.abilityName_ = "ModalType";
1976     info.bundleName_ = "ModalType";
1977     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
1978     EXPECT_NE(sceneSession, nullptr);
1979 
1980     sceneSession->SetSessionProperty(nullptr);
1981     auto result = sceneSession->GetSubWindowModalType();
1982     ASSERT_EQ(result, SubWindowModalType::TYPE_UNDEFINED);
1983 
1984     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
1985     EXPECT_NE(property, nullptr);
1986     property->SetWindowType(WindowType::WINDOW_TYPE_DIALOG);
1987     sceneSession->SetSessionProperty(property);
1988     result = sceneSession->GetSubWindowModalType();
1989     ASSERT_EQ(result, SubWindowModalType::TYPE_DIALOG);
1990 }
1991 
1992 /**
1993  * @tc.name: CheckGetAvoidAreaAvailable
1994  * @tc.desc: CheckGetAvoidAreaAvailable
1995  * @tc.type: FUNC
1996  */
1997 HWTEST_F(SceneSessionTest2, CheckGetAvoidAreaAvailable, Function | SmallTest | Level2)
1998 {
1999     SessionInfo info;
2000     info.abilityName_ = "CheckGetAvoidAreaAvailable";
2001     info.bundleName_ = "CheckGetAvoidAreaAvailable";
2002     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
2003     EXPECT_NE(sceneSession, nullptr);
2004 
2005     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
2006     EXPECT_NE(property, nullptr);
2007     property->SetWindowType(WindowType::APP_MAIN_WINDOW_BASE);
2008     sceneSession->SetSessionProperty(property);
2009     sceneSession->CheckGetAvoidAreaAvailable(AvoidAreaType::TYPE_SYSTEM);
2010 
2011     property->SetWindowType(WindowType::WINDOW_TYPE_APP_SUB_WINDOW);
2012     sceneSession->SetSessionProperty(property);
2013     sceneSession->CheckGetAvoidAreaAvailable(AvoidAreaType::TYPE_SYSTEM);
2014 }
2015 
2016 /**
2017  * @tc.name: SetWindowAnimationFlag
2018  * @tc.desc: SetWindowAnimationFlag
2019  * @tc.type: FUNC
2020  */
2021 HWTEST_F(SceneSessionTest2, SetWindowAnimationFlag, Function | SmallTest | Level2)
2022 {
2023     SessionInfo info;
2024     info.abilityName_ = "SetWindowAnimationFlag";
2025     info.bundleName_ = "SetWindowAnimationFlag";
2026     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
2027     EXPECT_NE(sceneSession, nullptr);
2028 
2029     sceneSession->sessionChangeCallback_ = new SceneSession::SessionChangeCallback();
2030     EXPECT_NE(sceneSession->sessionChangeCallback_, nullptr);
2031     sceneSession->sessionChangeCallback_->onWindowAnimationFlagChange_ = [](
__anon7d4e209c0e02( bool isNeedDefaultAnimationFlag) 2032         bool isNeedDefaultAnimationFlag) {};
2033     sceneSession->SetWindowAnimationFlag(true);
2034     ASSERT_EQ(true, sceneSession->needDefaultAnimationFlag_);
2035 }
2036 
2037 }
2038 
2039 /**
2040  * @tc.name: IsFullScreenMovable
2041  * @tc.desc: IsFullScreenMovable
2042  * @tc.type: FUNC
2043  */
2044 HWTEST_F(SceneSessionTest2, IsFullScreenMovable, Function | SmallTest | Level2)
2045 {
2046     SessionInfo info;
2047     info.abilityName_ = "IsFullScreenMovable";
2048     info.bundleName_ = "IsFullScreenMovable";
2049     sptr<SceneSession> sceneSession = new (std::nothrow) SceneSession(info, nullptr);
2050     EXPECT_NE(sceneSession, nullptr);
2051 
2052     sceneSession->SetSessionProperty(nullptr);
2053     auto result = sceneSession->IsFullScreenMovable();
2054     ASSERT_EQ(false, result);
2055 }
2056 }
2057 }