• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <gtest/gtest.h>
17 
18 #include <transaction/rs_transaction.h>
19 #include "accessibility_event_info.h"
20 #include "window_manager_hilog.h"
21 #include "window_impl.h"
22 #include "native_engine.h"
23 #include "window_extension_session_impl.h"
24 #include "mock_uicontent.h"
25 
26 using namespace testing;
27 using namespace testing::ext;
28 using namespace OHOS::Accessibility;
29 using namespace std;
30 namespace OHOS {
31 namespace Rosen {
32 class WindowExtensionSessionImplTest : public testing::Test {
33 public:
34     static void SetUpTestCase();
35     static void TearDownTestCase();
36     void SetUp() override;
37     void TearDown() override;
38 };
39 
SetUpTestCase()40 void WindowExtensionSessionImplTest::SetUpTestCase()
41 {
42 }
43 
TearDownTestCase()44 void WindowExtensionSessionImplTest::TearDownTestCase()
45 {
46 }
47 
SetUp()48 void WindowExtensionSessionImplTest::SetUp()
49 {
50 }
51 
TearDown()52 void WindowExtensionSessionImplTest::TearDown()
53 {
54 }
55 
56 namespace {
57 /**
58  * @tc.name: Create01
59  * @tc.desc: context is nullptr
60  * @tc.type: FUNC
61  */
62 HWTEST_F(WindowExtensionSessionImplTest, Create01, Function | SmallTest | Level3)
63 {
64     sptr<WindowOption> option = new WindowOption();
65     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
66     sptr<Rosen::ISession> iSession = nullptr;
67     ASSERT_EQ(WMError::WM_ERROR_NULLPTR, windowExtensionSessionImpl.Create(nullptr, iSession));
68 }
69 
70 /**
71  * @tc.name: MoveTo01
72  * @tc.desc: MoveTo
73  * @tc.type: FUNC
74  */
75 HWTEST_F(WindowExtensionSessionImplTest, MoveTo01, Function | SmallTest | Level3)
76 {
77     sptr<WindowOption> option = new WindowOption();
78     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
79     ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, windowExtensionSessionImpl.MoveTo(0, 1));
80 }
81 
82 /**
83  * @tc.name: Resize01
84  * @tc.desc: Resize
85  * @tc.type: FUNC
86  */
87 HWTEST_F(WindowExtensionSessionImplTest, Resize01, Function | SmallTest | Level3)
88 {
89     sptr<WindowOption> option = new WindowOption();
90     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
91     ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW, windowExtensionSessionImpl.Resize(0, 1));
92 }
93 
94 /**
95  * @tc.name: TransferAbilityResult01
96  * @tc.desc: TransferAbilityResult
97  * @tc.type: FUNC
98  */
99 HWTEST_F(WindowExtensionSessionImplTest, TransferAbilityResult01, Function | SmallTest | Level3)
100 {
101     sptr<WindowOption> option = new WindowOption();
102     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
103     AAFwk::Want want;
104     ASSERT_EQ(WMError::WM_ERROR_REPEAT_OPERATION, windowExtensionSessionImpl.TransferAbilityResult(1, want));
105 }
106 
107 /**
108  * @tc.name: TransferExtensionData01
109  * @tc.desc: TransferExtensionData
110  * @tc.type: FUNC
111  */
112 HWTEST_F(WindowExtensionSessionImplTest, TransferExtensionData01, Function | SmallTest | Level3)
113 {
114     sptr<WindowOption> option = new WindowOption();
115     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
116     AAFwk::WantParams wantParams;
117     ASSERT_EQ(WMError::WM_ERROR_REPEAT_OPERATION, windowExtensionSessionImpl.TransferExtensionData(wantParams));
118 }
119 
120 /**
121  * @tc.name: RegisterTransferComponentDataListener
122  * @tc.desc: RegisterTransferComponentDataListener Test
123  * @tc.type: FUNC
124  */
125 HWTEST_F(WindowExtensionSessionImplTest, RegisterTransferComponentDataListener, Function | SmallTest | Level3)
126 {
127     sptr<WindowOption> option = new WindowOption();
128     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
129     NotifyTransferComponentDataFunc func;
130     windowExtensionSessionImpl.RegisterTransferComponentDataListener(func);
131 
132     AAFwk::WantParams wantParams;
133     ASSERT_EQ(WMError::WM_ERROR_REPEAT_OPERATION, windowExtensionSessionImpl.TransferExtensionData(wantParams));
134 }
135 
136 /**
137  * @tc.name: NotifyTransferComponentData
138  * @tc.desc: NotifyTransferComponentData Test
139  * @tc.type: FUNC
140  */
141 HWTEST_F(WindowExtensionSessionImplTest, NotifyTransferComponentData, Function | SmallTest | Level3)
142 {
143     sptr<WindowOption> option = new WindowOption();
144     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
145     AAFwk::WantParams wantParams;
146     ASSERT_EQ(WSError::WS_OK, windowExtensionSessionImpl.NotifyTransferComponentData(wantParams));
147 }
148 
149 /**
150  * @tc.name: SetPrivacyMode01
151  * @tc.desc: SetPrivacyMode Test
152  * @tc.type: FUNC
153  */
154 HWTEST_F(WindowExtensionSessionImplTest, SetPrivacyMode01, Function | SmallTest | Level3)
155 {
156     sptr<WindowOption> option = new WindowOption();
157     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
158     ASSERT_EQ(WMError::WM_OK, windowExtensionSessionImpl.SetPrivacyMode(false));
159 }
160 
161 /**
162  * @tc.name: NotifyFocusStateEvent
163  * @tc.desc: NotifyFocusStateEvent Test
164  * @tc.type: FUNC
165  */
166 HWTEST_F(WindowExtensionSessionImplTest, NotifyFocusStateEvent, Function | SmallTest | Level3)
167 {
168     sptr<WindowOption> option = new WindowOption();
169     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
170     windowExtensionSessionImpl.NotifyFocusStateEvent(false);
171 
172     ASSERT_EQ(WMError::WM_OK, windowExtensionSessionImpl.SetPrivacyMode(false));
173 }
174 
175 /**
176  * @tc.name: NotifyFocusActiveEvent
177  * @tc.desc: NotifyFocusActiveEvent Test
178  * @tc.type: FUNC
179  */
180 HWTEST_F(WindowExtensionSessionImplTest, NotifyFocusActiveEvent, Function | SmallTest | Level3)
181 {
182     sptr<WindowOption> option = new WindowOption();
183     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
184     windowExtensionSessionImpl.NotifyFocusActiveEvent(false);
185 
186     ASSERT_EQ(WMError::WM_OK, windowExtensionSessionImpl.SetPrivacyMode(false));
187 }
188 
189 /**
190  * @tc.name: NotifySearchElementInfoByAccessibilityId01
191  * @tc.desc: NotifySearchElementInfoByAccessibilityId Test
192  * @tc.type: FUNC
193  */
194 HWTEST_F(WindowExtensionSessionImplTest, NotifySearchElementInfoByAccessibilityId01, Function | SmallTest | Level3)
195 {
196     sptr<WindowOption> option = new WindowOption();
197     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
198     windowExtensionSessionImpl.uiContent_ = std::make_unique<Ace::UIContentMocker>();
199     int64_t elementId = 0;
200     int32_t mode = 0;
201     int64_t baseParent = 0;
202     list<AccessibilityElementInfo> infos;
203 
204     ASSERT_EQ(WSError::WS_OK,
205         windowExtensionSessionImpl.NotifySearchElementInfoByAccessibilityId(elementId, mode, baseParent, infos));
206 }
207 
208 /**
209  * @tc.name: NotifySearchElementInfoByAccessibilityId02
210  * @tc.desc: NotifySearchElementInfoByAccessibilityId Test
211  * @tc.type: FUNC
212  */
213 HWTEST_F(WindowExtensionSessionImplTest, NotifySearchElementInfoByAccessibilityId02, Function | SmallTest | Level3)
214 {
215     sptr<WindowOption> option = new WindowOption();
216     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
217     int64_t elementId = 0;
218     int32_t mode = 0;
219     int64_t baseParent = 0;
220     list<AccessibilityElementInfo> infos;
221 
222     ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
223         windowExtensionSessionImpl.NotifySearchElementInfoByAccessibilityId(elementId, mode, baseParent, infos));
224 }
225 
226 /**
227  * @tc.name: NotifySearchElementInfosByText01
228  * @tc.desc: NotifySearchElementInfosByText Test
229  * @tc.type: FUNC
230  */
231 HWTEST_F(WindowExtensionSessionImplTest, NotifySearchElementInfosByText01, Function | SmallTest | Level3)
232 {
233     sptr<WindowOption> option = new WindowOption();
234     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
235     windowExtensionSessionImpl.uiContent_ = std::make_unique<Ace::UIContentMocker>();
236     int64_t elementId = 0;
237     string text;
238     int64_t baseParent = 0;
239     list<AccessibilityElementInfo> infos;
240 
241     ASSERT_EQ(WSError::WS_OK,
242         windowExtensionSessionImpl.NotifySearchElementInfosByText(elementId, text, baseParent, infos));
243 }
244 
245 /**
246  * @tc.name: NotifySearchElementInfosByText02
247  * @tc.desc: NotifySearchElementInfosByText Test
248  * @tc.type: FUNC
249  */
250 HWTEST_F(WindowExtensionSessionImplTest, NotifySearchElementInfosByText02, Function | SmallTest | Level3)
251 {
252     sptr<WindowOption> option = new WindowOption();
253     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
254     int64_t elementId = 0;
255     string text;
256     int64_t baseParent = 0;
257     list<AccessibilityElementInfo> infos;
258 
259     ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
260         windowExtensionSessionImpl.NotifySearchElementInfosByText(elementId, text, baseParent, infos));
261 }
262 
263 /**
264  * @tc.name: NotifyFindFocusedElementInfo01
265  * @tc.desc: NotifyFindFocusedElementInfo Test
266  * @tc.type: FUNC
267  */
268 HWTEST_F(WindowExtensionSessionImplTest, NotifyFindFocusedElementInfo01, Function | SmallTest | Level3)
269 {
270     sptr<WindowOption> option = new WindowOption();
271     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
272     windowExtensionSessionImpl.uiContent_ = std::make_unique<Ace::UIContentMocker>();
273     int64_t elementId = 0;
274     int32_t focusType = 0;
275     int64_t baseParent = 0;
276     AccessibilityElementInfo info;
277 
278     ASSERT_EQ(WSError::WS_OK,
279         windowExtensionSessionImpl.NotifyFindFocusedElementInfo(elementId, focusType, baseParent, info));
280 }
281 
282 /**
283  * @tc.name: NotifyFindFocusedElementInfo02
284  * @tc.desc: NotifyFindFocusedElementInfo Test
285  * @tc.type: FUNC
286  */
287 HWTEST_F(WindowExtensionSessionImplTest, NotifyFindFocusedElementInfo02, Function | SmallTest | Level3)
288 {
289     sptr<WindowOption> option = new WindowOption();
290     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
291     int64_t elementId = 0;
292     int32_t focusType = 0;
293     int64_t baseParent = 0;
294     AccessibilityElementInfo info;
295 
296     ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
297         windowExtensionSessionImpl.NotifyFindFocusedElementInfo(elementId, focusType, baseParent, info));
298 }
299 
300 /**
301  * @tc.name: NotifyFocusMoveSearch01
302  * @tc.desc: NotifyFocusMoveSearch Test
303  * @tc.type: FUNC
304  */
305 HWTEST_F(WindowExtensionSessionImplTest, NotifyFocusMoveSearch01, Function | SmallTest | Level3)
306 {
307     sptr<WindowOption> option = new WindowOption();
308     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
309     windowExtensionSessionImpl.uiContent_ = std::make_unique<Ace::UIContentMocker>();
310     int64_t elementId = 0;
311     int32_t direction = 0;
312     int64_t baseParent = 0;
313     AccessibilityElementInfo info;
314 
315     ASSERT_EQ(WSError::WS_OK,
316         windowExtensionSessionImpl.NotifyFocusMoveSearch(elementId, direction, baseParent, info));
317 }
318 
319 /**
320  * @tc.name: NotifyFocusMoveSearch02
321  * @tc.desc: NotifyFocusMoveSearch Test
322  * @tc.type: FUNC
323  */
324 HWTEST_F(WindowExtensionSessionImplTest, NotifyFocusMoveSearch02, Function | SmallTest | Level3)
325 {
326     sptr<WindowOption> option = new WindowOption();
327     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
328     int64_t elementId = 0;
329     int32_t direction = 0;
330     int64_t baseParent = 0;
331     AccessibilityElementInfo info;
332 
333     ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
334         windowExtensionSessionImpl.NotifyFocusMoveSearch(elementId, direction, baseParent, info));
335 }
336 
337 /**
338  * @tc.name: NotifyExecuteAction01
339  * @tc.desc: NotifyExecuteAction Test
340  * @tc.type: FUNC
341  */
342 HWTEST_F(WindowExtensionSessionImplTest, NotifyExecuteAction01, Function | SmallTest | Level3)
343 {
344     sptr<WindowOption> option = new WindowOption();
345     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
346     windowExtensionSessionImpl.uiContent_ = std::make_unique<Ace::UIContentMocker>();
347     int64_t elementId = 0;
348     std::map<std::string, std::string> actionAguments;
349     int32_t action = 0;
350     int64_t baseParent = 0;
351     ASSERT_EQ(WSError::WS_ERROR_INTERNAL_ERROR,
352         windowExtensionSessionImpl.NotifyExecuteAction(elementId, actionAguments, action, baseParent));
353 }
354 
355 /**
356  * @tc.name: NotifyExecuteAction02
357  * @tc.desc: NotifyExecuteAction Test
358  * @tc.type: FUNC
359  */
360 HWTEST_F(WindowExtensionSessionImplTest, NotifyExecuteAction02, Function | SmallTest | Level3)
361 {
362     sptr<WindowOption> option = new WindowOption();
363     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
364     int64_t elementId = 0;
365     std::map<std::string, std::string> actionAguments;
366     int32_t action = 0;
367     int64_t baseParent = 0;
368     ASSERT_EQ(WSError::WS_ERROR_NO_UI_CONTENT_ERROR,
369         windowExtensionSessionImpl.NotifyExecuteAction(elementId, actionAguments, action, baseParent));
370 }
371 
372 /**
373  * @tc.name: TransferAccessibilityEvent
374  * @tc.desc: TransferAccessibilityEvent Test
375  * @tc.type: FUNC
376  */
377 HWTEST_F(WindowExtensionSessionImplTest, TransferAccessibilityEvent, Function | SmallTest | Level3)
378 {
379     sptr<WindowOption> option = new WindowOption();
380     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
381     AccessibilityEventInfo info;
382     int64_t uiExtensionIdLevel = 0;
383 
384     ASSERT_EQ(WMError::WM_ERROR_INVALID_WINDOW,
385         windowExtensionSessionImpl.TransferAccessibilityEvent(info, uiExtensionIdLevel));
386 }
387 
388 /**
389  * @tc.name: RegisterAvoidAreaChangeListener
390  * @tc.desc: RegisterAvoidAreaChangeListener Test
391  * @tc.type: FUNC
392  */
393 HWTEST_F(WindowExtensionSessionImplTest, RegisterAvoidAreaChangeListener, Function | SmallTest | Level3)
394 {
395     sptr<WindowOption> option = new WindowOption();
396     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
397     sptr<IAvoidAreaChangedListener> listener = nullptr;
398     ASSERT_EQ(WMError::WM_ERROR_NULLPTR, windowExtensionSessionImpl.RegisterAvoidAreaChangeListener(listener));
399 }
400 
401 /**
402  * @tc.name: UnregisterAvoidAreaChangeListener
403  * @tc.desc: UnregisterAvoidAreaChangeListener Test
404  * @tc.type: FUNC
405  */
406 HWTEST_F(WindowExtensionSessionImplTest, UnregisterAvoidAreaChangeListener, Function | SmallTest | Level3)
407 {
408     sptr<WindowOption> option = new WindowOption();
409     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
410     sptr<IAvoidAreaChangedListener> listener = nullptr;
411     ASSERT_EQ(WMError::WM_ERROR_NULLPTR, windowExtensionSessionImpl.UnregisterAvoidAreaChangeListener(listener));
412 }
413 
414 /**
415  * @tc.name: UpdateConfiguration
416  * @tc.desc: UpdateConfiguration Test
417  * @tc.type: FUNC
418  */
419 HWTEST_F(WindowExtensionSessionImplTest, UpdateConfiguration, Function | SmallTest | Level3)
420 {
421     sptr<WindowOption> option = new WindowOption();
422     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
423     std::shared_ptr<AppExecFwk::Configuration> configuration = nullptr;
424 
425     int res = 0;
426     std::function<void()> func = [&]()
__anon213e04010202() 427     {
428         windowExtensionSessionImpl.UpdateConfiguration(configuration);
429         res = 1;
430     };
431     func();
432     ASSERT_EQ(1, res);
433 }
434 
435 /**
436  * @tc.name: Destroy
437  * @tc.desc: Destroy Test
438  * @tc.type: FUNC
439  */
440 HWTEST_F(WindowExtensionSessionImplTest, Destroy, Function | SmallTest | Level3)
441 {
442     sptr<WindowOption> option = new WindowOption();
443     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
444     bool needNotifyServer = true;
445     bool needClearListener = true;
446     ASSERT_NE(WMError::WM_OK, windowExtensionSessionImpl.Destroy(needNotifyServer, needClearListener));
447 }
448 
449 /**
450  * @tc.name: Resize
451  * @tc.desc: Resize Test
452  * @tc.type: FUNC
453  */
454 HWTEST_F(WindowExtensionSessionImplTest, Resize, Function | SmallTest | Level3)
455 {
456     sptr<WindowOption> option = new WindowOption();
457     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
458     uint32_t width = 0;
459     uint32_t height = 0;
460 
461     auto res = windowExtensionSessionImpl.Resize(width, height);
462     ASSERT_NE(WMError::WM_DO_NOTHING, static_cast<WMError>(res));
463 }
464 
465 /**
466  * @tc.name: TransferAbilityResult
467  * @tc.desc: TransferAbilityResult Test
468  * @tc.type: FUNC
469  */
470 HWTEST_F(WindowExtensionSessionImplTest, TransferAbilityResult, Function | SmallTest | Level3)
471 {
472     sptr<WindowOption> option = new WindowOption();
473     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
474     uint32_t resultCod = 0;
475     AAFwk::Want want;
476     sptr<ISession> hostSession_ = nullptr;
477 
478     auto res = windowExtensionSessionImpl.TransferAbilityResult(resultCod, want);
479     ASSERT_NE(WMError::WM_DO_NOTHING, static_cast<WMError>(res));
480 }
481 
482 /**
483  * @tc.name: TransferExtensionData
484  * @tc.desc: TransferExtensionData Test
485  * @tc.type: FUNC
486  */
487 HWTEST_F(WindowExtensionSessionImplTest, TransferExtensionData, Function | SmallTest | Level3)
488 {
489     sptr<WindowOption> option = new WindowOption();
490     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
491     AAFwk::WantParams wantParams;
492 
493     auto res = windowExtensionSessionImpl.TransferExtensionData(wantParams);
494     ASSERT_NE(WMError::WM_DO_NOTHING, static_cast<WMError>(res));
495 }
496 
497 /**
498  * @tc.name: RegisterTransferComponentDataListener1
499  * @tc.desc: RegisterTransferComponentDataListener1 Test
500  * @tc.type: FUNC
501  */
502 HWTEST_F(WindowExtensionSessionImplTest, RegisterTransferComponentDataListener1, Function | SmallTest | Level3)
503 {
504     sptr<WindowOption> option = new WindowOption();
505     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
506     NotifyTransferComponentDataFunc func;
507 
508     auto res = 0;
509     std::function<void()> func1 = [&]()
__anon213e04010302() 510     {
511         windowExtensionSessionImpl.RegisterTransferComponentDataListener(func);
512         res = 1;
513     };
514     func1();
515     ASSERT_EQ(1, res);
516 }
517 
518 /**
519  * @tc.name: NotifyTransferComponentData2
520  * @tc.desc: NotifyTransferComponentData2 Test
521  * @tc.type: FUNC
522  */
523 HWTEST_F(WindowExtensionSessionImplTest, NotifyTransferComponentData2, Function | SmallTest | Level3)
524 {
525     sptr<WindowOption> option = new WindowOption();
526     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
527     AAFwk::WantParams wantParams;
528 
529     auto res = windowExtensionSessionImpl.NotifyTransferComponentData(wantParams);
530     ASSERT_EQ(WSError::WS_OK, res);
531 }
532 
533 /**
534  * @tc.name: NotifyTransferComponentDataSync
535  * @tc.desc: NotifyTransferComponentDataSync Test
536  * @tc.type: FUNC
537  */
538 HWTEST_F(WindowExtensionSessionImplTest, NotifyTransferComponentDataSync, Function | SmallTest | Level3)
539 {
540     sptr<WindowOption> option = new WindowOption();
541     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
542     AAFwk::WantParams wantParams;
543     AAFwk::WantParams reWantParams;
544 
545     auto res = windowExtensionSessionImpl.NotifyTransferComponentDataSync(wantParams, reWantParams);
546     ASSERT_EQ(WSErrorCode::WS_ERROR_NOT_REGISTER_SYNC_CALLBACK, res);
547 }
548 
549 /**
550  * @tc.name: RegisterTransferComponentDataForResultListener
551  * @tc.desc: RegisterTransferComponentDataForResultListener Test
552  * @tc.type: FUNC
553  */
554 HWTEST_F(WindowExtensionSessionImplTest, RegisterTransferComponentDataForResultListener, Function | SmallTest | Level3)
555 {
556     sptr<WindowOption> option = new WindowOption();
557     WindowExtensionSessionImpl windowExtensionSessionImpl(option);
558     NotifyTransferComponentDataForResultFunc func;
559 
560     auto res = 0;
561     std::function<void()> func1 = [&]()
__anon213e04010402() 562     {
563         windowExtensionSessionImpl.RegisterTransferComponentDataForResultListener(func);
564         res = 1;
565     };
566     ASSERT_EQ(0, res);
567 }
568 }
569 } // namespace Rosen
570 } // namespace OHOS