1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 // gtest
17 #include <gtest/gtest.h>
18 #include "ability_context_impl.h"
19 #include "ipc_skeleton.h"
20 #include "window.h"
21 #include "window_manager.h"
22 #include "window_option.h"
23 #include "window_scene.h"
24 #include "common_test_utils.h"
25 #include "window_test_utils.h"
26 #include "wm_common.h"
27 
28 using namespace testing;
29 using namespace testing::ext;
30 
31 namespace OHOS {
32 namespace Rosen {
33 namespace {
34 constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowAppFloatingWindowTest"};
35 }
36 
37 class TestCameraFloatWindowChangedListener : public ICameraFloatWindowChangedListener {
38 public:
39     uint32_t accessTokenId_ = 0;
40     bool isShowing_ = false;
41     void OnCameraFloatWindowChange(uint32_t accessTokenId, bool isShowing) override;
42 };
43 
44 class WindowAppFloatingWindowTest : public testing::Test {
45 public:
46     static void SetUpTestCase();
47     static void TearDownTestCase();
48     virtual void SetUp() override;
49     virtual void TearDown() override;
50 
51     static inline float virtualPixelRatio_ = 1.0;
52     static inline Rect displayRect_ {0, 0, 0, 0};
53     static inline std::shared_ptr<AbilityRuntime::AbilityContext> abilityContext_ = nullptr;
54     static sptr<TestCameraFloatWindowChangedListener> testCameraFloatWindowChangedListener_;
55 };
56 
57 sptr<TestCameraFloatWindowChangedListener> WindowAppFloatingWindowTest::testCameraFloatWindowChangedListener_ =
58     new TestCameraFloatWindowChangedListener();
59 
OnCameraFloatWindowChange(uint32_t accessTokenId, bool isShowing)60 void TestCameraFloatWindowChangedListener::OnCameraFloatWindowChange(uint32_t accessTokenId, bool isShowing)
61 {
62     WLOGI("TestCameraFloatWindowChangedListener [%{public}u, %{public}u]", accessTokenId, isShowing);
63     accessTokenId_ = accessTokenId;
64     isShowing_ = isShowing;
65 }
66 
SetUpTestCase()67 void WindowAppFloatingWindowTest::SetUpTestCase()
68 {
69     auto display = DisplayManager::GetInstance().GetDisplayById(0);
70     ASSERT_TRUE((display != nullptr));
71     displayRect_.width_ = display->GetWidth();
72     displayRect_.height_ = display->GetHeight();
73     WindowTestUtils::InitByDisplayRect(displayRect_);
74     virtualPixelRatio_ = WindowTestUtils::GetVirtualPixelRatio(0);
75 }
76 
TearDownTestCase()77 void WindowAppFloatingWindowTest::TearDownTestCase()
78 {
79 }
80 
SetUp()81 void WindowAppFloatingWindowTest::SetUp()
82 {
83     CommonTestUtils::GuaranteeFloatWindowPermission("wms_window_app_floating_window_test");
84 }
85 
TearDown()86 void WindowAppFloatingWindowTest::TearDown()
87 {
88 }
89 
CreateWindowScene()90 static sptr<WindowScene> CreateWindowScene()
91 {
92     sptr<IWindowLifeCycle> listener = nullptr;
93     WindowAppFloatingWindowTest::abilityContext_ = std::make_shared<AbilityRuntime::AbilityContextImpl>();
94 
95     sptr<WindowScene> scene = new WindowScene();
96     scene->Init(0, WindowAppFloatingWindowTest::abilityContext_, listener);
97     return scene;
98 }
99 
CreateAppFloatingWindow(WindowType type, Rect rect, std::string name = �)100 static sptr<Window> CreateAppFloatingWindow(WindowType type, Rect rect, std::string name = "")
101 {
102     sptr<WindowOption> option = new WindowOption();
103     option->SetWindowType(type);
104     option->SetWindowRect(rect);
105 
106     static int cnt = 0;
107     std::string winName = (name == "") ? "FloatingWindowTest" + std::to_string(cnt++) : name;
108 
109     return Window::Create(winName, option, WindowAppFloatingWindowTest::abilityContext_);
110 }
111 
GetRectWithVpr(int32_t x, int32_t y, uint32_t w, uint32_t h)112 static inline Rect GetRectWithVpr(int32_t x, int32_t y, uint32_t w, uint32_t h)
113 {
114     auto vpr = WindowAppFloatingWindowTest::virtualPixelRatio_;
115     return {x, y, static_cast<uint32_t>(w * vpr), static_cast<uint32_t>(h * vpr)};
116 }
117 
118 /**
119  * @tc.name: AppFloatingWindow01
120  * @tc.desc: AppFloatingWindow life cycle
121  * @tc.type: FUNC
122  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow01, Function | MediumTest | Level2)123 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow01, Function | MediumTest | Level2)
124 {
125     sptr<WindowScene> scene = CreateWindowScene();
126     ASSERT_NE(nullptr, scene);
127 
128     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
129     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT, fltWindRect);
130     ASSERT_NE(nullptr, fltWin);
131     if (scene->GoForeground() == WMError::WM_OK) {
132         ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
133     }
134 
135     ASSERT_EQ(WMError::WM_OK, fltWin->Show());
136 
137     ASSERT_EQ(WMError::WM_OK, fltWin->Hide());
138     if (scene->GoForeground() == WMError::WM_OK) {
139         ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
140     } else {
141         ASSERT_NE(WMError::WM_OK, scene->GoForeground());
142     }
143 
144     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
145 
146     if (scene->GoDestroy() == WMError::WM_OK) {
147         ASSERT_EQ(WMError::WM_ERROR_NULLPTR, scene->GoDestroy());
148     } else {
149         ASSERT_NE(WMError::WM_OK, scene->GoDestroy());
150     }
151 }
152 
153 /**
154  * @tc.name: AppFloatingWindow02
155  * @tc.desc: AppFloatingWindow life cycle, main window hide first
156  * @tc.type: FUNC
157  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow02, Function | MediumTest | Level3)158 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow02, Function | MediumTest | Level3)
159 {
160     sptr<WindowScene> scene = CreateWindowScene();
161     ASSERT_NE(nullptr, scene);
162 
163     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
164     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT, fltWindRect);
165     if (fltWin == nullptr) {
166         return;
167     }
168     ASSERT_NE(nullptr, fltWin);
169     if (scene->GoForeground() == WMError::WM_OK) {
170         ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
171     } else {
172         ASSERT_NE(WMError::WM_OK, scene->GoForeground());
173     }
174 
175     ASSERT_EQ(WMError::WM_OK, fltWin->Show());
176 
177     if (scene->GoForeground() == WMError::WM_OK) {
178         ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
179     } else {
180         ASSERT_NE(WMError::WM_OK, scene->GoForeground());
181     }
182 
183     if (scene->GetMainWindow() == nullptr) {
184         return;
185     }
186     ASSERT_EQ(true, scene->GetMainWindow()->GetWindowState() == WindowState::STATE_SHOWN);
187     ASSERT_EQ(true, fltWin->GetWindowState() == WindowState::STATE_SHOWN);
188     ASSERT_EQ(WMError::WM_OK, fltWin->Hide());
189 
190     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
191     ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
192 }
193 
194 /**
195  * @tc.name: AppFloatingWindow03
196  * @tc.desc: AppFloatingWindow life cycle, app floating window hide first
197  * @tc.type: FUNC
198  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow03, Function | MediumTest | Level3)199 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow03, Function | MediumTest | Level3)
200 {
201     sptr<WindowScene> scene = CreateWindowScene();
202     ASSERT_NE(nullptr, scene);
203 
204     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
205     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT, fltWindRect);
206     if (fltWin == nullptr) {
207         return;
208     }
209     ASSERT_NE(nullptr, fltWin);
210     if (scene->GoForeground() == WMError::WM_OK) {
211         ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
212     } else {
213         ASSERT_NE(WMError::WM_OK, scene->GoForeground());
214     }
215 
216     ASSERT_EQ(WMError::WM_OK, fltWin->Show());
217 
218     ASSERT_EQ(WMError::WM_OK, fltWin->Hide());
219     ASSERT_EQ(false, fltWin->GetWindowState() == WindowState::STATE_SHOWN);
220     if (scene->GetMainWindow() == nullptr) {
221         return;
222     }
223     ASSERT_EQ(true, scene->GetMainWindow()->GetWindowState() == WindowState::STATE_SHOWN);
224     ASSERT_EQ(WMError::WM_OK, scene->GoBackground());
225 
226     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
227     ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
228 }
229 
230 /**
231  * @tc.name: AppFloatingWindow04
232  * @tc.desc: AppFloatingWindow life cycle, main window destroy first
233  * @tc.type: FUNC
234  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow04, Function | MediumTest | Level3)235 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow04, Function | MediumTest | Level3)
236 {
237     sptr<WindowScene> scene = CreateWindowScene();
238     ASSERT_NE(nullptr, scene);
239 
240     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
241     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT, fltWindRect);
242     if (fltWin == nullptr) {
243         return;
244     }
245     ASSERT_NE(nullptr, fltWin);
246 
247     if (scene->GoForeground() == WMError::WM_OK) {
248         ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
249         ASSERT_EQ(WMError::WM_OK, fltWin->Show());
250         ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
251     } else {
252         ASSERT_NE(WMError::WM_OK, scene->GoForeground());
253     }
254 
255     if (scene->GetMainWindow() == nullptr) {
256         return;
257     }
258     ASSERT_EQ(nullptr, scene->GetMainWindow());
259     ASSERT_EQ(false, fltWin->GetWindowState() == WindowState::STATE_SHOWN);
260     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
261 }
262 
263 /**
264  * @tc.name: AppFloatingWindow05
265  * @tc.desc: Camera AppFloatingWindow life cycle
266  * @tc.type: FUNC
267  * @tc.require: issueI5NEHO
268  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow05, Function | MediumTest | Level2)269 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow05, Function | MediumTest | Level2)
270 {
271     sptr<WindowScene> scene = CreateWindowScene();
272     ASSERT_NE(nullptr, scene);
273 
274     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
275     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
276     if (fltWin == nullptr) {
277         return;
278     }
279     ASSERT_NE(nullptr, fltWin);
280 
281     if (scene->GoForeground() == WMError::WM_OK) {
282         ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
283         ASSERT_EQ(WMError::WM_OK, fltWin->Show());
284         ASSERT_EQ(WMError::WM_OK, fltWin->Hide());
285         ASSERT_EQ(WMError::WM_OK, scene->GoBackground());
286         ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
287         ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
288     } else {
289         ASSERT_NE(WMError::WM_OK, scene->GoForeground());
290     }
291 }
292 
293 /**
294  * @tc.name: AppFloatingWindow06
295  * @tc.desc: Camera AppFloatingWindow life cycle, main window hide first
296  * @tc.type: FUNC
297  * @tc.require: issueI5NEHO
298  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow06, Function | MediumTest | Level3)299 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow06, Function | MediumTest | Level3)
300 {
301     sptr<WindowScene> scene = CreateWindowScene();
302     ASSERT_NE(nullptr, scene);
303 
304     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
305     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
306     if (fltWin == nullptr) {
307         return;
308     }
309     ASSERT_NE(nullptr, fltWin);
310 
311     ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
312     ASSERT_EQ(WMError::WM_OK, fltWin->Show());
313 
314     ASSERT_EQ(WMError::WM_OK, scene->GoBackground());
315     if (scene->GetMainWindow() == nullptr) {
316         return;
317     }
318     ASSERT_EQ(false, scene->GetMainWindow()->GetWindowState() == WindowState::STATE_SHOWN);
319     ASSERT_EQ(true, fltWin->GetWindowState() == WindowState::STATE_SHOWN);
320     ASSERT_EQ(WMError::WM_OK, fltWin->Hide());
321 
322     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
323     ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
324 }
325 
326 /**
327  * @tc.name: AppFloatingWindow07
328  * @tc.desc: Camera AppFloatingWindow life cycle, app floating window hide first
329  * @tc.type: FUNC
330  * @tc.require: issueI5NEHO
331  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow07, Function | MediumTest | Level3)332 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow07, Function | MediumTest | Level3)
333 {
334     sptr<WindowScene> scene = CreateWindowScene();
335     ASSERT_NE(nullptr, scene);
336 
337     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
338     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
339     if (fltWin == nullptr) {
340         return;
341     }
342     ASSERT_NE(nullptr, fltWin);
343 
344     ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
345     ASSERT_EQ(WMError::WM_OK, fltWin->Show());
346 
347     ASSERT_EQ(WMError::WM_OK, fltWin->Hide());
348     ASSERT_EQ(false, fltWin->GetWindowState() == WindowState::STATE_SHOWN);
349     if (scene->GetMainWindow() == nullptr) {
350         return;
351     }
352     ASSERT_EQ(true, scene->GetMainWindow()->GetWindowState() == WindowState::STATE_SHOWN);
353     ASSERT_EQ(WMError::WM_OK, scene->GoBackground());
354 
355     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
356     ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
357 }
358 
359 /**
360  * @tc.name: AppFloatingWindow08
361  * @tc.desc: Camera AppFloatingWindow life cycle, main window destroy first
362  * @tc.type: FUNC
363  * @tc.require: issueI5NEHO
364  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow08, Function | MediumTest | Level3)365 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow08, Function | MediumTest | Level3)
366 {
367     sptr<WindowScene> scene = CreateWindowScene();
368     ASSERT_NE(nullptr, scene);
369 
370     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
371     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
372     if (fltWin == nullptr) {
373         return;
374     }
375     ASSERT_NE(nullptr, fltWin);
376 
377     ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
378     ASSERT_EQ(WMError::WM_OK, fltWin->Show());
379 
380     ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
381 
382     ASSERT_EQ(nullptr, scene->GetMainWindow());
383     ASSERT_EQ(false, fltWin->GetWindowState() == WindowState::STATE_SHOWN);
384     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
385 }
386 
387 /**
388  * @tc.name: AppFloatingWindow09
389  * @tc.desc: Camera AppFloatingWindow rect check
390  * @tc.type: FUNC
391  * @tc.require: issueI5NEHO
392  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow09, Function | MediumTest | Level3)393 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow09, Function | MediumTest | Level3)
394 {
395     sptr<WindowScene> scene = CreateWindowScene();
396     ASSERT_NE(nullptr, scene);
397 
398     Rect fltWindRect = GetRectWithVpr(10, 20, 10, 10);
399     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
400     if (fltWin == nullptr) {
401         return;
402     }
403     ASSERT_NE(nullptr, fltWin);
404 
405     ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
406     ASSERT_EQ(WMError::WM_OK, fltWin->Show());
407 
408     Rect exceptRect = {10, 20, 0, 0};
409     uint32_t smallWidth = displayRect_.height_ <= displayRect_.width_ ? displayRect_.height_ : displayRect_.width_;
410     float hwRatio = static_cast<float>(displayRect_.height_) / static_cast<float>(displayRect_.width_);
411     if (smallWidth <= static_cast<uint32_t>(600 * virtualPixelRatio_)) { // sw <= 600dp
412         if (displayRect_.width_ <= displayRect_.height_) {
413             exceptRect.width_= static_cast<uint32_t>(smallWidth * 0.3);
414         } else {
415             exceptRect.width_ = static_cast<uint32_t>(smallWidth * 0.5);
416         }
417     } else {
418         if (displayRect_.width_ <= displayRect_.height_) {
419             exceptRect.width_ = static_cast<uint32_t>(smallWidth * 0.12);
420         } else {
421             exceptRect.width_ = static_cast<uint32_t>(smallWidth * 0.3);
422         }
423     }
424     exceptRect.height_ = static_cast<uint32_t>(exceptRect.width_ * hwRatio);
425     ASSERT_TRUE(WindowTestUtils::RectEqualTo(fltWin, exceptRect));
426 
427     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
428     ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
429 }
430 
431 /**
432  * @tc.name: AppFloatingWindow10
433  * @tc.desc: Camera AppFloatingWindow multi create
434  * @tc.type: FUNC
435  * @tc.require: issueI5NEHO
436  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow10, Function | MediumTest | Level3)437 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow10, Function | MediumTest | Level3)
438 {
439     sptr<WindowScene> scene = CreateWindowScene();
440     ASSERT_NE(nullptr, scene);
441 
442     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
443     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
444     if (fltWin == nullptr) {
445         return;
446     }
447     ASSERT_NE(nullptr, fltWin);
448 
449     sptr<Window> fltWin2 = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
450     ASSERT_EQ(nullptr, fltWin2);
451 
452     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
453     sptr<Window> fltWin3 = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
454     ASSERT_NE(nullptr, fltWin3);
455 
456     ASSERT_EQ(WMError::WM_OK, fltWin3->Destroy());
457     ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
458 }
459 
460 /**
461  * @tc.name: AppFloatingWindow11
462  * @tc.desc: Camera AppFloatingWindow listener
463  * @tc.type: FUNC
464  * @tc.require: issueI5NEHR
465  */
HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow11, Function | MediumTest | Level2)466 HWTEST_F(WindowAppFloatingWindowTest, AppFloatingWindow11, Function | MediumTest | Level2)
467 {
468     uint32_t tokenId = static_cast<uint32_t>(IPCSkeleton::GetCallingTokenID());
469     WindowManager::GetInstance().RegisterCameraFloatWindowChangedListener(testCameraFloatWindowChangedListener_);
470     sptr<WindowScene> scene = CreateWindowScene();
471     ASSERT_NE(nullptr, scene);
472 
473     Rect fltWindRect = GetRectWithVpr(0, 0, 400, 600);
474     sptr<Window> fltWin = CreateAppFloatingWindow(WindowType::WINDOW_TYPE_FLOAT_CAMERA, fltWindRect);
475     if (fltWin == nullptr) {
476         return;
477     }
478     ASSERT_NE(nullptr, fltWin);
479 
480     ASSERT_EQ(WMError::WM_OK, scene->GoForeground());
481     ASSERT_EQ(WMError::WM_OK, fltWin->Show());
482 
483     usleep(500000); // 500000us = 0.5s
484     ASSERT_EQ(tokenId, testCameraFloatWindowChangedListener_->accessTokenId_);
485     ASSERT_EQ(true, testCameraFloatWindowChangedListener_->isShowing_);
486 
487     ASSERT_EQ(WMError::WM_OK, fltWin->Hide());
488 
489     usleep(500000); // 500000us = 0.5s
490     ASSERT_EQ(tokenId, testCameraFloatWindowChangedListener_->accessTokenId_);
491     ASSERT_EQ(false, testCameraFloatWindowChangedListener_->isShowing_);
492 
493     ASSERT_EQ(WMError::WM_OK, fltWin->Destroy());
494     ASSERT_EQ(WMError::WM_OK, scene->GoDestroy());
495 
496     WindowManager::GetInstance().UnregisterCameraFloatWindowChangedListener(testCameraFloatWindowChangedListener_);
497 }
498 } // namespace Rosen
499 } // namespace OHOS
500