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 #include "iremote_object_mocker.h"
18 #include "mock/mock_session.h"
19 #include "mock/mock_session_stage.h"
20 #include "mock/mock_window_event_channel.h"
21 #include "session_manager/include/scene_session_manager.h"
22 #include "session_manager/include/zidl/scene_session_manager_interface.h"
23 #include "session_manager/include/zidl/scene_session_manager_proxy.h"
24 #include "window_manager_agent.h"
25 #include "zidl/window_manager_agent_interface.h"
26 
27 using namespace testing;
28 using namespace testing::ext;
29 namespace OHOS {
30 namespace Rosen {
31 class sceneSessionManagerProxyTest : public testing::Test {
32 public:
33     static void SetUpTestCase();
34     static void TearDownTestCase();
35     void SetUp() override;
36     void TearDown() override;
37     sptr<IRemoteObject> iRemoteObjectMocker;
38 };
39 
SetUpTestCase()40 void sceneSessionManagerProxyTest::SetUpTestCase()
41 {
42 }
43 
TearDownTestCase()44 void sceneSessionManagerProxyTest::TearDownTestCase()
45 {
46 }
47 
SetUp()48 void sceneSessionManagerProxyTest::SetUp()
49 {
50 }
51 
TearDown()52 void sceneSessionManagerProxyTest::TearDown()
53 {
54 }
55 
56 namespace {
57 /**
58  * @tc.name: CreateAndConnectSpecificSession
59  * @tc.desc: normal function
60  * @tc.type: FUNC
61  */
62 HWTEST_F(sceneSessionManagerProxyTest, CreateAndConnectSpecificSession, Function | SmallTest | Level2)
63 {
64     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
65     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
66         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
67     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
68 
69     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
70     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
71     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
72     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
73     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
74     int32_t persistentId = 0;
75     SessionInfo info;
76     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
77     SystemSessionConfig systemConfig;
78     sptr<IRemoteObject> token = new (std::nothrow) IRemoteObjectMocker();
79 
80     sceneSessionManagerProxy_->CreateAndConnectSpecificSession(sessionStage, eventChannel, node, property,
81         persistentId, session, systemConfig, token);
82     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
83 }
84 
85 /**
86  * @tc.name: CreateAndConnectSpecificSession2
87  * @tc.desc: normal function
88  * @tc.type: FUNC
89  */
90 HWTEST_F(sceneSessionManagerProxyTest, CreateAndConnectSpecificSession2, Function | SmallTest | Level2)
91 {
92     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
93     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
94         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
95     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
96 
97     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
98     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
99     std::shared_ptr<RSSurfaceNode> node = nullptr;
100     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
101     int32_t persistentId = 0;
102     SessionInfo info;
103     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
104     SystemSessionConfig systemConfig;
105     sptr<IRemoteObject> token = new (std::nothrow) IRemoteObjectMocker();
106 
107     sceneSessionManagerProxy_->CreateAndConnectSpecificSession(sessionStage, eventChannel, node, property,
108         persistentId, session, systemConfig, token);
109     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
110 }
111 
112 /**
113  * @tc.name: CreateAndConnectSpecificSession3
114  * @tc.desc: normal function
115  * @tc.type: FUNC
116  */
117 HWTEST_F(sceneSessionManagerProxyTest, CreateAndConnectSpecificSession3, Function | SmallTest | Level2)
118 {
119     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
120     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
121         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
122     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
123 
124     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
125     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
126     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
127     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
128     sptr<WindowSessionProperty> property = nullptr;
129     int32_t persistentId = 0;
130     SessionInfo info;
131     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
132     SystemSessionConfig systemConfig;
133     sptr<IRemoteObject> token = new (std::nothrow) IRemoteObjectMocker();
134 
135     sceneSessionManagerProxy_->CreateAndConnectSpecificSession(sessionStage, eventChannel, node, property,
136         persistentId, session, systemConfig, token);
137     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
138 }
139 
140 /**
141  * @tc.name: CreateAndConnectSpecificSession4
142  * @tc.desc: normal function
143  * @tc.type: FUNC
144  */
145 HWTEST_F(sceneSessionManagerProxyTest, CreateAndConnectSpecificSession4, Function | SmallTest | Level2)
146 {
147     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
148     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
149         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
150     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
151 
152     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
153     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
154     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
155     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
156     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
157     int32_t persistentId = 0;
158     SessionInfo info;
159     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
160     SystemSessionConfig systemConfig;
161     sptr<IRemoteObject> token = nullptr;
162 
163     sceneSessionManagerProxy_->CreateAndConnectSpecificSession(sessionStage, eventChannel, node, property,
164         persistentId, session, systemConfig, token);
165     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
166 }
167 
168 /**
169  * @tc.name: RecoverAndConnectSpecificSession
170  * @tc.desc: normal function
171  * @tc.type: FUNC
172  */
173 HWTEST_F(sceneSessionManagerProxyTest, RecoverAndConnectSpecificSession, Function | SmallTest | Level2)
174 {
175     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
176     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
177         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
178     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
179 
180     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
181     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
182     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
183     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
184     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
185     SessionInfo info;
186     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
187     sptr<IRemoteObject> token = new (std::nothrow) IRemoteObjectMocker();
188 
189     sceneSessionManagerProxy_->RecoverAndConnectSpecificSession(sessionStage, eventChannel, node, property,
190         session, token);
191     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
192 }
193 
194 /**
195  * @tc.name: RecoverAndConnectSpecificSession2
196  * @tc.desc: normal function
197  * @tc.type: FUNC
198  */
199 HWTEST_F(sceneSessionManagerProxyTest, RecoverAndConnectSpecificSession2, Function | SmallTest | Level2)
200 {
201     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
202     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
203         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
204     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
205 
206     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
207     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
208     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
209     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
210     sptr<WindowSessionProperty> property = nullptr;
211     SessionInfo info;
212     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
213     sptr<IRemoteObject> token = new (std::nothrow) IRemoteObjectMocker();
214 
215     sceneSessionManagerProxy_->RecoverAndConnectSpecificSession(sessionStage, eventChannel, node, property,
216         session, token);
217     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
218 }
219 
220 /**
221  * @tc.name: RecoverAndConnectSpecificSession3
222  * @tc.desc: normal function
223  * @tc.type: FUNC
224  */
225 HWTEST_F(sceneSessionManagerProxyTest, RecoverAndConnectSpecificSession3, Function | SmallTest | Level2)
226 {
227     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
228     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
229         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
230     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
231 
232     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
233     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
234     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
235     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
236     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
237     SessionInfo info;
238     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
239     sptr<IRemoteObject> token = nullptr;
240 
241     sceneSessionManagerProxy_->RecoverAndConnectSpecificSession(sessionStage, eventChannel, node, property,
242         session, token);
243     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
244 }
245 
246 /**
247  * @tc.name: RecoverAndReconnectSceneSession
248  * @tc.desc: normal function
249  * @tc.type: FUNC
250  */
251 HWTEST_F(sceneSessionManagerProxyTest, RecoverAndReconnectSceneSession, Function | SmallTest | Level2)
252 {
253     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
254     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
255         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
256     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
257 
258     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
259     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
260     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
261     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
262     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
263     SessionInfo info;
264     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
265     sptr<IRemoteObject> token = new (std::nothrow) IRemoteObjectMocker();
266 
267     sceneSessionManagerProxy_->RecoverAndReconnectSceneSession(sessionStage, eventChannel, node, session,
268         property, token);
269     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
270 }
271 
272 /**
273  * @tc.name: RecoverAndReconnectSceneSession2
274  * @tc.desc: normal function
275  * @tc.type: FUNC
276  */
277 HWTEST_F(sceneSessionManagerProxyTest, RecoverAndReconnectSceneSession2, Function | SmallTest | Level2)
278 {
279     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
280     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
281         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
282     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
283 
284     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
285     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
286     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
287     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
288     sptr<WindowSessionProperty> property = nullptr;
289     SessionInfo info;
290     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
291     sptr<IRemoteObject> token = new (std::nothrow) IRemoteObjectMocker();
292 
293     sceneSessionManagerProxy_->RecoverAndReconnectSceneSession(sessionStage, eventChannel, node, session,
294         property, token);
295     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
296 }
297 
298 /**
299  * @tc.name: RecoverAndReconnectSceneSession3
300  * @tc.desc: normal function
301  * @tc.type: FUNC
302  */
303 HWTEST_F(sceneSessionManagerProxyTest, RecoverAndReconnectSceneSession3, Function | SmallTest | Level2)
304 {
305     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
306     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
307         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
308     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
309 
310     sptr<ISessionStage> sessionStage = new (std::nothrow) SessionStageMocker();
311     sptr<IWindowEventChannel> eventChannel = new (std::nothrow) WindowEventChannelMocker(sessionStage);
312     struct RSSurfaceNodeConfig rsSurfaceNodeConfig;
313     std::shared_ptr<RSSurfaceNode> node = RSSurfaceNode::Create(rsSurfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
314     sptr<WindowSessionProperty> property = new (std::nothrow) WindowSessionProperty();
315     SessionInfo info;
316     sptr<ISession> session = new (std::nothrow) SessionMocker(info);
317     sptr<IRemoteObject> token = nullptr;
318 
319     sceneSessionManagerProxy_->RecoverAndReconnectSceneSession(sessionStage, eventChannel, node, session,
320         property, token);
321     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
322 }
323 
324 /**
325  * @tc.name: DestroyAndDisconnectSpecificSession
326  * @tc.desc: normal function
327  * @tc.type: FUNC
328  */
329 HWTEST_F(sceneSessionManagerProxyTest, DestroyAndDisconnectSpecificSession, Function | SmallTest | Level2)
330 {
331     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
332     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
333         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
334     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
335 
336     sceneSessionManagerProxy_->DestroyAndDisconnectSpecificSession(0);
337     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
338 }
339 
340 /**
341  * @tc.name: DestroyAndDisconnectSpecificSessionWithDetachCallback
342  * @tc.desc: normal function
343  * @tc.type: FUNC
344  */
345 HWTEST_F(
346     sceneSessionManagerProxyTest,
347     DestroyAndDisconnectSpecificSessionWithDetachCallback,
348     Function | SmallTest | Level2
349 )
350 {
351     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
352     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
353         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
354     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
355 
356     sptr<IRemoteObject> callback = new (std::nothrow) IRemoteObjectMocker();
357 
358     sceneSessionManagerProxy_->DestroyAndDisconnectSpecificSessionWithDetachCallback(0, callback);
359     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
360 }
361 
362 /**
363  * @tc.name: UpdateSessionTouchOutsideListener
364  * @tc.desc: normal function
365  * @tc.type: FUNC
366  */
367 HWTEST_F(sceneSessionManagerProxyTest, UpdateSessionTouchOutsideListener, Function | SmallTest | Level2)
368 {
369     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
370     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
371         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
372     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
373 
374     int32_t persistentId = 0;
375     sceneSessionManagerProxy_->UpdateSessionTouchOutsideListener(persistentId, true);
376     sceneSessionManagerProxy_->UpdateSessionTouchOutsideListener(persistentId, false);
377     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
378 }
379 
380 /**
381  * @tc.name: SetGestureNavigaionEnabled
382  * @tc.desc: normal function
383  * @tc.type: FUNC
384  */
385 HWTEST_F(sceneSessionManagerProxyTest, SetGestureNavigaionEnabled, Function | SmallTest | Level2)
386 {
387     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
388     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
389         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
390     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
391 
392     sceneSessionManagerProxy_->SetGestureNavigaionEnabled(true);
393     sceneSessionManagerProxy_->SetGestureNavigaionEnabled(false);
394     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
395 }
396 
397 /**
398  * @tc.name: GetFocusWindowInfo
399  * @tc.desc: normal function
400  * @tc.type: FUNC
401  */
402 HWTEST_F(sceneSessionManagerProxyTest, GetFocusWindowInfo, Function | SmallTest | Level2)
403 {
404     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
405     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
406         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
407     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
408 
409     FocusChangeInfo focusInfo{};
410     sceneSessionManagerProxy_->GetFocusWindowInfo(focusInfo);
411     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
412 }
413 
414 /**
415  * @tc.name: SetSessionIcon
416  * @tc.desc: normal function
417  * @tc.type: FUNC
418  */
419 HWTEST_F(sceneSessionManagerProxyTest, SetSessionIcon, Function | SmallTest | Level2)
420 {
421     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
422     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
423         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
424     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
425 
426     sptr<IRemoteObject> token = new (std::nothrow) IRemoteObjectMocker();
427     std::shared_ptr<Media::PixelMap> icon = nullptr;
428     sceneSessionManagerProxy_->SetSessionIcon(token, icon);
429     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
430 }
431 
432 /**
433  * @tc.name: GetAccessibilityWindowInfo
434  * @tc.desc: normal function
435  * @tc.type: FUNC
436  */
437 HWTEST_F(sceneSessionManagerProxyTest, GetAccessibilityWindowInfo, Function | SmallTest | Level2)
438 {
439     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
440     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
441         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
442     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
443 
444     std::vector<sptr<AccessibilityWindowInfo>> infos{};
445     sceneSessionManagerProxy_->GetAccessibilityWindowInfo(infos);
446     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
447 }
448 
449 /**
450  * @tc.name: GetUnreliableWindowInfo
451  * @tc.desc: normal function
452  * @tc.type: FUNC
453  */
454 HWTEST_F(sceneSessionManagerProxyTest, GetUnreliableWindowInfo, Function | SmallTest | Level2)
455 {
456     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
457     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
458         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
459     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
460 
461     std::vector<sptr<UnreliableWindowInfo>> infos{};
462     sceneSessionManagerProxy_->GetUnreliableWindowInfo(0, infos);
463     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
464 }
465 
466 /**
467  * @tc.name: GetSessionInfos
468  * @tc.desc: normal function
469  * @tc.type: FUNC
470  */
471 HWTEST_F(sceneSessionManagerProxyTest, GetSessionInfos, Function | SmallTest | Level2)
472 {
473     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
474     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
475         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
476     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
477 
478     std::string deviceId;
479     std::vector<SessionInfoBean> sessionInfos{};
480     sceneSessionManagerProxy_->GetSessionInfos(deviceId, 0, sessionInfos);
481     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
482 }
483 
484 /**
485  * @tc.name: GetSessionInfo
486  * @tc.desc: normal function
487  * @tc.type: FUNC
488  */
489 HWTEST_F(sceneSessionManagerProxyTest, GetSessionInfo, Function | SmallTest | Level2)
490 {
491     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
492     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
493         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
494     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
495 
496     std::string deviceId;
497     SessionInfoBean sessionInfo;
498     sceneSessionManagerProxy_->GetSessionInfo(deviceId, 0, sessionInfo);
499     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
500 }
501 
502 /**
503  * @tc.name: RegisterWindowManagerAgent01
504  * @tc.desc: normal function
505  * @tc.type: FUNC
506  */
507 HWTEST_F(sceneSessionManagerProxyTest, RegisterWindowManagerAgent01, Function | SmallTest | Level2)
508 {
509     sptr<IWindowManagerAgent> windowManagerAgent = new WindowManagerAgent();
510     WindowManagerAgentType type = WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS;
511     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
512     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
513         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
514     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
515 
516     ASSERT_EQ(WMError::WM_OK, sceneSessionManagerProxy_->RegisterWindowManagerAgent(type, windowManagerAgent));
517     ASSERT_EQ(WMError::WM_OK, sceneSessionManagerProxy_->UnregisterWindowManagerAgent(type, windowManagerAgent));
518     sceneSessionManagerProxy_ = nullptr;
519 }
520 
521 /**
522  * @tc.name: AddExtensionWindowStageToSCB
523  * @tc.desc: normal function
524  * @tc.type: FUNC
525  */
526 HWTEST_F(sceneSessionManagerProxyTest, AddExtensionWindowStageToSCB, Function | SmallTest | Level2)
527 {
528     sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr();
529     ASSERT_NE(iRemoteObjectMocker, nullptr);
530     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
531         sptr<SceneSessionManagerProxy>::MakeSptr(iRemoteObjectMocker);
532     ASSERT_NE(sceneSessionManagerProxy, nullptr);
533 
534     sptr<ISessionStage> sessionStage = sptr<SessionStageMocker>::MakeSptr();
535     ASSERT_NE(sessionStage, nullptr);
536     sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
537     ASSERT_NE(token, nullptr);
538     sceneSessionManagerProxy->AddExtensionWindowStageToSCB(sessionStage, token, 12345);
539     sceneSessionManagerProxy = nullptr;
540 }
541 
542 /**
543  * @tc.name: RemoveExtensionWindowStageFromSCB
544  * @tc.desc: normal function
545  * @tc.type: FUNC
546  */
547 HWTEST_F(sceneSessionManagerProxyTest, RemoveExtensionWindowStageFromSCB, Function | SmallTest | Level2)
548 {
549     sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr();
550     ASSERT_NE(iRemoteObjectMocker, nullptr);
551     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
552         sptr<SceneSessionManagerProxy>::MakeSptr(iRemoteObjectMocker);
553     ASSERT_NE(sceneSessionManagerProxy, nullptr);
554 
555     sptr<ISessionStage> sessionStage = sptr<SessionStageMocker>::MakeSptr();
556     ASSERT_NE(sessionStage, nullptr);
557     sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
558     ASSERT_NE(token, nullptr);
559     sceneSessionManagerProxy->RemoveExtensionWindowStageFromSCB(sessionStage, token);
560     sceneSessionManagerProxy = nullptr;
561 }
562 
563 /**
564  * @tc.name: AddOrRemoveSecureSession
565  * @tc.desc: normal function
566  * @tc.type: FUNC
567  */
568 HWTEST_F(sceneSessionManagerProxyTest, AddOrRemoveSecureSession001, Function | SmallTest | Level2)
569 {
570     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
571     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
572         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
573     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
574 
575     int32_t persistentId = 12345;
576     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy_->AddOrRemoveSecureSession(persistentId, true));
577     sceneSessionManagerProxy_ = nullptr;
578 }
579 
580 /**
581  * @tc.name: UpdateExtWindowFlags
582  * @tc.desc: normal function
583  * @tc.type: FUNC
584  */
585 HWTEST_F(sceneSessionManagerProxyTest, UpdateExtWindowFlags, Function | SmallTest | Level2)
586 {
587     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
588     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
589         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
590     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
591 
592     sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
593     ASSERT_NE(token, nullptr);
594     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy_->UpdateExtWindowFlags(token, 7, 7));
595     ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, sceneSessionManagerProxy_->UpdateExtWindowFlags(nullptr, 7, 7));
596     sceneSessionManagerProxy_ = nullptr;
597 }
598 
599 /**
600  * @tc.name: GetSessionInfoByContinueSessionId
601  * @tc.desc: normal function
602  * @tc.type: FUNC
603  */
604 HWTEST_F(sceneSessionManagerProxyTest, GetSessionInfoByContinueSessionId, Function | SmallTest | Level2)
605 {
606     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
607     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
608         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
609     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
610 
611     std::string continueSessionId = "test_01";
612     SessionInfoBean missionInfo;
613     ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED,
614         sceneSessionManagerProxy_->GetSessionInfoByContinueSessionId(continueSessionId, missionInfo));
615     sceneSessionManagerProxy_ = nullptr;
616 }
617 
618 /**
619  * @tc.name: RequestFocusStatus01
620  * @tc.desc: normal function
621  * @tc.type: FUNC
622  */
623 HWTEST_F(sceneSessionManagerProxyTest, RequestFocusStatus01, Function | SmallTest | Level2)
624 {
625     int32_t persistendId = 0;
626     bool isFocused = true;
627     bool byForeground = true;
628     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
629     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
630         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
631     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
632 
633     ASSERT_EQ(WMError::WM_OK, sceneSessionManagerProxy_->RequestFocusStatus(persistendId, isFocused, byForeground));
634     sceneSessionManagerProxy_ = nullptr;
635 }
636 
637 /**
638  * @tc.name: RaiseWindowToTop
639  * @tc.desc: normal function
640  * @tc.type: FUNC
641  */
642 HWTEST_F(sceneSessionManagerProxyTest, RaiseWindowToTop, Function | SmallTest | Level2)
643 {
644     int32_t persistendId = 0;
645     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
646     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
647         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
648     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
649 
650     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy_->RaiseWindowToTop(persistendId));
651     sceneSessionManagerProxy_ = nullptr;
652 }
653 
654 /**
655  * @tc.name: BindDialogSessionTarget
656  * @tc.desc: normal function
657  * @tc.type: FUNC
658  */
659 HWTEST_F(sceneSessionManagerProxyTest, BindDialogSessionTarget, Function | SmallTest | Level2)
660 {
661     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
662     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
663         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
664     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
665 
666     sptr<IRemoteObject> targetToken = new (std::nothrow) IRemoteObjectMocker();
667     sceneSessionManagerProxy_->BindDialogSessionTarget(0, targetToken);
668     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
669 }
670 
671 /**
672  * @tc.name: BindDialogSessionTarget2
673  * @tc.desc: normal function
674  * @tc.type: FUNC
675  */
676 HWTEST_F(sceneSessionManagerProxyTest, BindDialogSessionTarget2, Function | SmallTest | Level2)
677 {
678     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
679     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
680         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
681     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
682 
683     sptr<IRemoteObject> targetToken = nullptr;
684     sceneSessionManagerProxy_->BindDialogSessionTarget(0, targetToken);
685     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
686 }
687 
688 /**
689  * @tc.name: UpdateSessionAvoidAreaListener
690  * @tc.desc: normal function
691  * @tc.type: FUNC
692  */
693 HWTEST_F(sceneSessionManagerProxyTest, UpdateSessionAvoidAreaListener, Function | SmallTest | Level2)
694 {
695     int32_t persistendId = 0;
696     bool haveListener = true;
697     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
698     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
699         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
700     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
701 
702     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy_->UpdateSessionAvoidAreaListener(persistendId,
703         haveListener));
704     sceneSessionManagerProxy_ = nullptr;
705 }
706 
707 /**
708  * @tc.name: SetSessionLabel
709  * @tc.desc: normal function
710  * @tc.type: FUNC
711  */
712 HWTEST_F(sceneSessionManagerProxyTest, SetSessionLabel, Function | SmallTest | Level2)
713 {
714     sptr<IRemoteObject> token = nullptr;
715     std::string label = "SetSessionLabel";
716     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
717     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
718         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
719     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
720 
721     ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, sceneSessionManagerProxy_->SetSessionLabel(token, label));
722     sceneSessionManagerProxy_ = nullptr;
723 }
724 
725 /**
726  * @tc.name: IsValidSessionIds
727  * @tc.desc: normal function
728  * @tc.type: FUNC
729  */
730 HWTEST_F(sceneSessionManagerProxyTest, IsValidSessionIds, Function | SmallTest | Level2)
731 {
732     std::vector<int32_t> sessionIds;
733     std::vector<bool> results;
734     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
735     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
736         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
737     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
738 
739     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy_->IsValidSessionIds(sessionIds, results));
740     sceneSessionManagerProxy_ = nullptr;
741 }
742 
743 /**
744  * @tc.name: RegisterSessionListener01
745  * @tc.desc: normal function
746  * @tc.type: FUNC
747  */
748 HWTEST_F(sceneSessionManagerProxyTest, RegisterSessionListener01, Function | SmallTest | Level2)
749 {
750     sptr<ISessionListener> listener = nullptr;
751     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
752     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
753         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
754     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
755 
756     ASSERT_EQ(WSError::WS_ERROR_INVALID_PARAM, sceneSessionManagerProxy_->RegisterSessionListener(listener));
757     sceneSessionManagerProxy_ = nullptr;
758 }
759 
760 /**
761  * @tc.name: UnRegisterSessionListener
762  * @tc.desc: normal function
763  * @tc.type: FUNC
764  */
765 HWTEST_F(sceneSessionManagerProxyTest, UnRegisterSessionListener, Function | SmallTest | Level2)
766 {
767     sptr<ISessionListener> listener = nullptr;
768     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
769     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
770         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
771     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
772 
773     ASSERT_EQ(WSError::WS_ERROR_INVALID_PARAM, sceneSessionManagerProxy_->UnRegisterSessionListener(listener));
774     sceneSessionManagerProxy_ = nullptr;
775 }
776 
777 /**
778  * @tc.name: GetSnapshotByWindowId
779  * @tc.desc: normal function
780  * @tc.type: FUNC
781  */
782 HWTEST_F(sceneSessionManagerProxyTest, GetSnapshotByWindowId, Function | SmallTest | Level2)
783 {
784     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
785     ASSERT_NE(iRemoteObjectMocker, nullptr);
786     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy = new SceneSessionManagerProxy(iRemoteObjectMocker);
787     ASSERT_NE(sceneSessionManagerProxy, nullptr);
788     int32_t windowId = -1;
789     std::shared_ptr<Media::PixelMap> pixelMap = nullptr;
790     WMError ret = sceneSessionManagerProxy->GetSnapshotByWindowId(windowId, pixelMap);
791     ASSERT_EQ(WMError::WM_OK, ret);
792 }
793 
794 /**
795  * @tc.name: GetSessionSnapshotById
796  * @tc.desc: normal function
797  * @tc.type: FUNC
798  */
799 HWTEST_F(sceneSessionManagerProxyTest, GetSessionSnapshotById, Function | SmallTest | Level2)
800 {
801     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
802     ASSERT_NE(iRemoteObjectMocker, nullptr);
803     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy = new SceneSessionManagerProxy(iRemoteObjectMocker);
804     ASSERT_NE(sceneSessionManagerProxy, nullptr);
805     int32_t windowId = -1;
806     SessionSnapshot snapshot;
807     WMError ret = sceneSessionManagerProxy->GetSessionSnapshotById(windowId, snapshot);
808     ASSERT_EQ(WMError::WM_OK, ret);
809 }
810 
811 /*
812  * @tc.name: TerminateSessionNew
813  * @tc.desc: normal function
814  * @tc.type: FUNC
815  */
816 HWTEST_F(sceneSessionManagerProxyTest, TerminateSessionNew, Function | SmallTest | Level2)
817 {
818     sptr<ISessionListener> listener = nullptr;
819     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
820     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
821         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
822     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
823 
824     ASSERT_EQ(WSError::WS_ERROR_INVALID_SESSION, sceneSessionManagerProxy_->TerminateSessionNew(nullptr, true, true));
825     sceneSessionManagerProxy_ = nullptr;
826 }
827 
828 /**
829  * @tc.name: GetSessionDumpInfo
830  * @tc.desc: normal function
831  * @tc.type: FUNC
832  */
833 HWTEST_F(sceneSessionManagerProxyTest, GetSessionDumpInfo, Function | SmallTest | Level2)
834 {
835     std::vector<std::string> params;
836     std::string info = "info";
837     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
838     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
839         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
840     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
841 
842     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy_->GetSessionDumpInfo(params, info));
843     sceneSessionManagerProxy_ = nullptr;
844 }
845 
846 /**
847  * @tc.name: LockSession
848  * @tc.desc: normal function
849  * @tc.type: FUNC
850  */
851 HWTEST_F(sceneSessionManagerProxyTest, LockSession, Function | SmallTest | Level2)
852 {
853     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
854     ASSERT_NE(iRemoteObjectMocker, nullptr);
855     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy = new SceneSessionManagerProxy(iRemoteObjectMocker);
856     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy->LockSession(0));
857     sceneSessionManagerProxy = nullptr;
858 }
859 
860 /**
861  * @tc.name: GetUIContentRemoteObj
862  * @tc.desc: normal function
863  * @tc.type: FUNC
864  */
865 HWTEST_F(sceneSessionManagerProxyTest, GetUIContentRemoteObj, Function | SmallTest | Level2)
866 {
867     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
868     ASSERT_NE(iRemoteObjectMocker, nullptr);
869     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy = new SceneSessionManagerProxy(iRemoteObjectMocker);
870     sptr<IRemoteObject> remoteObj;
871     ASSERT_EQ(WSError::WS_ERROR_IPC_FAILED, sceneSessionManagerProxy->GetUIContentRemoteObj(1, remoteObj));
872 }
873 
874 /**
875  * @tc.name: ClearSession
876  * @tc.desc: normal function
877  * @tc.type: FUNC
878  */
879 HWTEST_F(sceneSessionManagerProxyTest, ClearSession, Function | SmallTest | Level2)
880 {
881     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
882     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
883         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
884     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
885 
886     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy_->LockSession(0));
887     sceneSessionManagerProxy_ = nullptr;
888 }
889 
890 /**
891  * @tc.name: RegisterIAbilityManagerCollaborator
892  * @tc.desc: normal function
893  * @tc.type: FUNC
894  */
895 HWTEST_F(sceneSessionManagerProxyTest, RegisterIAbilityManagerCollaborator, Function | SmallTest | Level2)
896 {
897     sptr<AAFwk::IAbilityManagerCollaborator> impl = nullptr;
898     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
899     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
900         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
901     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
902 
903     ASSERT_EQ(WSError::WS_ERROR_INVALID_PARAM, sceneSessionManagerProxy_->RegisterIAbilityManagerCollaborator(0, impl));
904     sceneSessionManagerProxy_ = nullptr;
905 }
906 
907 /**
908  * @tc.name: NotifyWindowExtensionVisibilityChange
909  * @tc.desc: normal function
910  * @tc.type: FUNC
911  */
912 HWTEST_F(sceneSessionManagerProxyTest, NotifyWindowExtensionVisibilityChange, Function | SmallTest | Level2)
913 {
914     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
915     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
916         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
917     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
918 
919     ASSERT_EQ(WSError::WS_OK, sceneSessionManagerProxy_->NotifyWindowExtensionVisibilityChange(0, 0, true));
920     sceneSessionManagerProxy_ = nullptr;
921 }
922 
923 /**
924  * @tc.name: GetTopWindowId
925  * @tc.desc: normal function
926  * @tc.type: FUNC
927  */
928 HWTEST_F(sceneSessionManagerProxyTest, GetTopWindowId, Function | SmallTest | Level2)
929 {
930     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
931     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
932         new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
933     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
934 
935     uint32_t topWinId = 1;
936     ASSERT_EQ(WMError::WM_OK, sceneSessionManagerProxy_->GetTopWindowId(0, topWinId));
937     sceneSessionManagerProxy_ = nullptr;
938 }
939 
940 /**
941  * @tc.name: UpdateModalExtensionRect
942  * @tc.desc: normal function
943  * @tc.type: FUNC
944  */
945 HWTEST_F(sceneSessionManagerProxyTest, UpdateModalExtensionRect, Function | SmallTest | Level2)
946 {
947     sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr();
948     ASSERT_NE(iRemoteObjectMocker, nullptr);
949     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
950         sptr<SceneSessionManagerProxy>::MakeSptr(iRemoteObjectMocker);
951     ASSERT_NE(sceneSessionManagerProxy, nullptr);
952 
953     sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
954     ASSERT_NE(token, nullptr);
955     Rect rect { 1, 2, 3, 4 };
956     sceneSessionManagerProxy->UpdateModalExtensionRect(token, rect);
957     sceneSessionManagerProxy->UpdateModalExtensionRect(nullptr, rect);
958     sceneSessionManagerProxy = nullptr;
959 }
960 
961 /**
962  * @tc.name: ProcessModalExtensionPointDown
963  * @tc.desc: normal function
964  * @tc.type: FUNC
965  */
966 HWTEST_F(sceneSessionManagerProxyTest, ProcessModalExtensionPointDown, Function | SmallTest | Level2)
967 {
968     sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr();
969     ASSERT_NE(iRemoteObjectMocker, nullptr);
970     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
971         sptr<SceneSessionManagerProxy>::MakeSptr(iRemoteObjectMocker);
972     ASSERT_NE(sceneSessionManagerProxy, nullptr);
973 
974     sptr<IRemoteObject> token = sptr<IRemoteObjectMocker>::MakeSptr();
975     ASSERT_NE(token, nullptr);
976     sceneSessionManagerProxy->ProcessModalExtensionPointDown(token, 0, 0);
977     sceneSessionManagerProxy->ProcessModalExtensionPointDown(nullptr, 0, 0);
978     sceneSessionManagerProxy = nullptr;
979 }
980 
981 /**
982  * @tc.name: GetWindowStyleType
983  * @tc.desc: normal function
984  * @tc.type: FUNC
985  */
986 HWTEST_F(sceneSessionManagerProxyTest, GetWindowStyleType, Function | SmallTest | Level2)
987 {
988     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
989     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
990             new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
991     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
992     WindowStyleType styleType;
993     ASSERT_EQ(WMError::WM_OK, sceneSessionManagerProxy_->GetWindowStyleType(styleType));
994     sceneSessionManagerProxy_ = nullptr;
995 }
996 
997 /**
998  * @tc.name: GetProcessSurfaceNodeIdByPersistentId
999  * @tc.desc: normal function
1000  * @tc.type: FUNC
1001  */
1002 HWTEST_F(sceneSessionManagerProxyTest, GetProcessSurfaceNodeIdByPersistentId, Function | SmallTest | Level2)
1003 {
1004     sptr<IRemoteObject> iRemoteObjectMocker = new (std::nothrow) IRemoteObjectMocker();
1005     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy_ =
1006             new (std::nothrow) SceneSessionManagerProxy(iRemoteObjectMocker);
1007     EXPECT_NE(sceneSessionManagerProxy_, nullptr);
1008 
1009     int32_t pid = 123;
1010     std::vector<int32_t> persistentIds = {1, 2, 3};
1011     std::vector<uint64_t> surfaceNodeIds;
1012     ASSERT_EQ(WMError::WM_OK, sceneSessionManagerProxy_->GetProcessSurfaceNodeIdByPersistentId(
1013         pid, persistentIds, surfaceNodeIds));
1014     sceneSessionManagerProxy_ = nullptr;
1015 }
1016 
1017 /**
1018  * @tc.name: ReleaseForegroundSessionScreenLock
1019  * @tc.desc: normal function
1020  * @tc.type: FUNC
1021  */
1022 HWTEST_F(sceneSessionManagerProxyTest, ReleaseForegroundSessionScreenLock, Function | SmallTest | Level2)
1023 {
1024     sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1025     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
1026         new SceneSessionManagerProxy(iRemoteObjectMocker);
1027     EXPECT_NE(sceneSessionManagerProxy, nullptr);
1028     ASSERT_EQ(sceneSessionManagerProxy->ReleaseForegroundSessionScreenLock(), WMError::WM_OK);
1029 }
1030 
1031 /**
1032  * @tc.name: IsWindowRectAutoSave
1033  * @tc.desc: IsWindowRectAutoSave
1034  * @tc.type: FUNC
1035  */
1036 HWTEST_F(sceneSessionManagerProxyTest, IsWindowRectAutoSave, Function | SmallTest | Level2)
1037 {
1038     sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr();
1039     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
1040         sptr<SceneSessionManagerProxy>::MakeSptr(iRemoteObjectMocker);
1041     bool enabled = false;
1042     std::string key = "com.example.recposentryEntryAbility";
1043     ASSERT_EQ(sceneSessionManagerProxy->IsWindowRectAutoSave(key, enabled), WMError::WM_ERROR_IPC_FAILED);
1044 }
1045 
1046 /**
1047  * @tc.name: GetDisplayIdByWindowId
1048  * @tc.desc: GetDisplayIdByWindowId
1049  * @tc.type: FUNC
1050  */
1051 HWTEST_F(sceneSessionManagerProxyTest, GetDisplayIdByWindowId, Function | SmallTest | Level2)
1052 {
1053     sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1054     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
1055         new SceneSessionManagerProxy(iRemoteObjectMocker);
1056     ASSERT_TRUE(sceneSessionManagerProxy != nullptr);
1057     const std::vector<uint64_t> windowIds = {1, 2};
1058     std::unordered_map<uint64_t, DisplayId> windowDisplayIdMap;
1059     sceneSessionManagerProxy->GetDisplayIdByWindowId(windowIds, windowDisplayIdMap);
1060 }
1061 
1062 /**
1063  * @tc.name: IsPcWindow
1064  * @tc.desc: IsPcWindow
1065  * @tc.type: FUNC
1066  */
1067 HWTEST_F(sceneSessionManagerProxyTest, IsPcWindow, Function | SmallTest | Level2)
1068 {
1069     sptr<IRemoteObject> iRemoteObjectMocker = sptr<IRemoteObjectMocker>::MakeSptr();
1070     auto sceneSessionManagerProxy = sptr<SceneSessionManagerProxy>::MakeSptr(iRemoteObjectMocker);
1071     bool isPcWindow = false;
1072     ASSERT_EQ(sceneSessionManagerProxy->IsPcWindow(isPcWindow),
1073         WMError::WM_ERROR_IPC_FAILED);
1074     ASSERT_EQ(isPcWindow, false);
1075 }
1076 
1077 /**
1078  * @tc.name: IsPcOrPadFreeMultiWindowMode
1079  * @tc.desc: IsPcOrPadFreeMultiWindowMode
1080  * @tc.type: FUNC
1081  */
1082 HWTEST_F(sceneSessionManagerProxyTest, IsPcOrPadFreeMultiWindowMode, Function | SmallTest | Level2)
1083 {
1084     sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1085     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
1086         new SceneSessionManagerProxy(iRemoteObjectMocker);
1087     EXPECT_NE(sceneSessionManagerProxy, nullptr);
1088     bool isPcOrPadFreeMultiWindowMode = false;
1089     ASSERT_EQ(sceneSessionManagerProxy->IsPcOrPadFreeMultiWindowMode(isPcOrPadFreeMultiWindowMode),
1090         WMError::WM_ERROR_IPC_FAILED);
1091     ASSERT_EQ(isPcOrPadFreeMultiWindowMode, false);
1092 }
1093 
1094 /**
1095  * @tc.name: SetGlobalDragResizeType
1096  * @tc.desc: SetGlobalDragResizeType
1097  * @tc.type: FUNC
1098  */
1099 HWTEST_F(sceneSessionManagerProxyTest, SetGlobalDragResizeType, Function | SmallTest | Level2)
1100 {
1101     sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1102     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
1103         new SceneSessionManagerProxy(iRemoteObjectMocker);
1104     ASSERT_TRUE(sceneSessionManagerProxy != nullptr);
1105     DragResizeType dragResizeType = DragResizeType::RESIZE_EACH_FRAME;
1106     sceneSessionManagerProxy->SetGlobalDragResizeType(dragResizeType);
1107 }
1108 
1109 /**
1110  * @tc.name: GetGlobalDragResizeType
1111  * @tc.desc: GetGlobalDragResizeType
1112  * @tc.type: FUNC
1113  */
1114 HWTEST_F(sceneSessionManagerProxyTest, GetGlobalDragResizeType, Function | SmallTest | Level2)
1115 {
1116     sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1117     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
1118         new SceneSessionManagerProxy(iRemoteObjectMocker);
1119     ASSERT_TRUE(sceneSessionManagerProxy != nullptr);
1120     DragResizeType dragResizeType = DragResizeType::RESIZE_TYPE_UNDEFINED;
1121     sceneSessionManagerProxy->GetGlobalDragResizeType(dragResizeType);
1122 }
1123 
1124 /**
1125  * @tc.name: SetAppDragResizeType
1126  * @tc.desc: SetAppDragResizeType
1127  * @tc.type: FUNC
1128  */
1129 HWTEST_F(sceneSessionManagerProxyTest, SetAppDragResizeType, Function | SmallTest | Level2)
1130 {
1131     sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1132     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
1133         new SceneSessionManagerProxy(iRemoteObjectMocker);
1134     ASSERT_TRUE(sceneSessionManagerProxy != nullptr);
1135     DragResizeType dragResizeType = DragResizeType::RESIZE_EACH_FRAME;
1136     const std::string bundleName = "test";
1137     sceneSessionManagerProxy->SetAppDragResizeType(bundleName, dragResizeType);
1138 }
1139 
1140 /**
1141  * @tc.name: GetAppDragResizeType
1142  * @tc.desc: GetAppDragResizeType
1143  * @tc.type: FUNC
1144  */
1145 HWTEST_F(sceneSessionManagerProxyTest, GetAppDragResizeType, Function | SmallTest | Level2)
1146 {
1147     sptr<IRemoteObject> iRemoteObjectMocker = new IRemoteObjectMocker();
1148     sptr<SceneSessionManagerProxy> sceneSessionManagerProxy =
1149         new SceneSessionManagerProxy(iRemoteObjectMocker);
1150     ASSERT_TRUE(sceneSessionManagerProxy != nullptr);
1151     DragResizeType toDragResizeType = DragResizeType::RESIZE_EACH_FRAME;
1152     DragResizeType dragResizeType = DragResizeType::RESIZE_TYPE_UNDEFINED;
1153     const std::string bundleName = "test";
1154     std::unordered_map<std::string, DragResizeType> appDragResizeTypeMap_;
1155     appDragResizeTypeMap_[bundleName] = toDragResizeType;
1156     sceneSessionManagerProxy->GetAppDragResizeType(bundleName, dragResizeType);
1157 }
1158 }  // namespace
1159 }
1160 }
1161