• 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 #include <message_option.h>
18 #include <message_parcel.h>
19 #include <common/rs_rect.h>
20 #include <transaction/rs_marshalling_helper.h>
21 #include <iremote_broker.h>
22 #include "session_manager/include/scene_session_manager.h"
23 #include "session_manager/include/zidl/scene_session_manager_interface.h"
24 #include "window_manager_agent.h"
25 #include "zidl/screen_session_manager_proxy.h"
26 #include "zidl/window_manager_agent_interface.h"
27 #include "display_manager_adapter.h"
28 #include "display_manager_agent_default.h"
29 #include "scene_board_judgement.h"
30 #include "screen_session_manager/include/screen_session_manager.h"
31 
32 using namespace testing;
33 using namespace testing::ext;
34 namespace OHOS {
35 namespace Rosen {
36 class ScreenSessionManagerProxyTest : public testing::Test {
37 public:
38     static void SetUpTestCase();
39     static void TearDownTestCase();
40     void SetUp() override;
41     void TearDown() override;
42 };
43 
SetUpTestCase()44 void ScreenSessionManagerProxyTest::SetUpTestCase()
45 {
46 }
47 
TearDownTestCase()48 void ScreenSessionManagerProxyTest::TearDownTestCase()
49 {
50 }
51 
SetUp()52 void ScreenSessionManagerProxyTest::SetUp()
53 {
54 }
55 
TearDown()56 void ScreenSessionManagerProxyTest::TearDown()
57 {
58 }
59 
60 namespace {
61 /**
62  * @tc.name: SetPrivacyStateByDisplayId
63  * @tc.desc: SetPrivacyStateByDisplayId
64  * @tc.type: FUNC
65  */
66 HWTEST_F(ScreenSessionManagerProxyTest, SetPrivacyStateByDisplayId, Function | SmallTest | Level1)
67 {
68     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
69     DisplayId id = 0;
70     bool hasPrivate = false;
71 
72     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
73     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
74 
75     int resultValue = 0;
76     std::function<void()> func = [&]()
__anon7fcf749a0202() 77     {
78         screenSessionManagerProxy->SetPrivacyStateByDisplayId(id, hasPrivate);
79         resultValue = 1;
80     };
81     func();
82     ASSERT_EQ(resultValue, 1);
83 }
84 
85 /**
86  * @tc.name: SetScreenPrivacyWindowList
87  * @tc.desc: SetScreenPrivacyWindowList
88  * @tc.type: FUNC
89  */
90 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenPrivacyWindowList, Function | SmallTest | Level1)
91 {
92     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
93     DisplayId id = 0;
94     std::vector<std::string> privacyWindowList{"win0", "win1"};
95 
96     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
97     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
98 
99     int resultValue = 0;
100     std::function<void()> func = [&]()
__anon7fcf749a0302() 101     {
102         screenSessionManagerProxy->SetScreenPrivacyWindowList(id, privacyWindowList);
103         resultValue = 1;
104     };
105     func();
106     ASSERT_EQ(resultValue, 1);
107 }
108 
109 /**
110  * @tc.name: SetVirtualScreenBlackList
111  * @tc.desc: SetVirtualScreenBlackList
112  * @tc.type: FUNC
113  */
114 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualScreenBlackList, Function | SmallTest | Level1)
115 {
116     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
117     ScreenId id = 1001;
118     std::vector<uint64_t> windowIdList{10, 20, 30};
119 
120     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
121     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
122 
123     int resultValue = 0;
124     std::function<void()> func = [&]()
__anon7fcf749a0402() 125     {
126         screenSessionManagerProxy->SetVirtualScreenBlackList(id, windowIdList);
127         resultValue = 1;
128     };
129     func();
130     ASSERT_EQ(resultValue, 1);
131 }
132 
133 /**
134  * @tc.name: ProxyForFreeze
135  * @tc.desc: ProxyForFreeze
136  * @tc.type: FUNC
137  */
138 HWTEST_F(ScreenSessionManagerProxyTest, ProxyForFreeze, Function | SmallTest | Level1)
139 {
140     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
141     const std::set<int32_t>& pidList = {1, 2, 3};
142     bool isProxy = true;
143 
144     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
145     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
146 
147     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
148         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
149                 screenSessionManagerProxy->ProxyForFreeze(pidList, isProxy));
150     } else {
151         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
152                 screenSessionManagerProxy->ProxyForFreeze(pidList, isProxy));
153     }
154 }
155 
156 /**
157  * @tc.name: SetVirtualScreenStatus
158  * @tc.desc: SetVirtualScreenStatus
159  * @tc.type: FUNC
160  */
161 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualScreenStatus, Function | SmallTest | Level1)
162 {
163     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
164     ScreenId id = 1001;
165     VirtualScreenStatus screenStatus = VirtualScreenStatus::VIRTUAL_SCREEN_PAUSE;
166 
167     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
168     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
169 
170     bool expectation = true;
171     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
172         EXPECT_NE(expectation, screenSessionManagerProxy->SetVirtualScreenStatus(id, screenStatus));
173     } else {
174         EXPECT_EQ(expectation, screenSessionManagerProxy->SetVirtualScreenStatus(id, screenStatus));
175     }
176 }
177 
178 /**
179  * @tc.name: SetVirtualScreenSecurityExemption
180  * @tc.desc: SetVirtualScreenSecurityExemption
181  * @tc.type: FUNC
182  */
183 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualScreenSecurityExemption, Function | SmallTest | Level1)
184 {
185     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
186     ScreenId id = 1001;
187     uint32_t pid = 1;
188     std::vector<uint64_t> windowIdList{10, 20, 30};
189 
190     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
191     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
192 
193     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
194         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
195                 screenSessionManagerProxy->SetVirtualScreenSecurityExemption(id, pid, windowIdList));
196     } else {
197         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
198                 screenSessionManagerProxy->SetVirtualScreenSecurityExemption(id, pid, windowIdList));
199     }
200 }
201 
202 /**
203  * @tc.name: GetAllDisplayPhysicalResolution
204  * @tc.desc: GetAllDisplayPhysicalResolution
205  * @tc.type: FUNC
206  */
207 HWTEST_F(ScreenSessionManagerProxyTest, GetAllDisplayPhysicalResolution, Function | SmallTest | Level1)
208 {
209     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
210     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
211     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
212 
213     std::vector<DisplayPhysicalResolution> allSize {};
214     std::function<void()> func = [&]()
__anon7fcf749a0502() 215     {
216         allSize = screenSessionManagerProxy->GetAllDisplayPhysicalResolution();
217     };
218     func();
219     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
220         ASSERT_TRUE(!allSize.empty());
221     } else {
222         ASSERT_FALSE(!allSize.empty());
223     }
224 }
225 
226 /**
227  * @tc.name: GetDefaultDisplayInfo
228  * @tc.desc: GetDefaultDisplayInfo
229  * @tc.type: FUNC
230  */
231 HWTEST_F(ScreenSessionManagerProxyTest, GetDefaultDisplayInfo, Function | SmallTest | Level1)
232 {
233     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
234 
235     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
236     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
237 
238     sptr<DisplayInfo> expectation = nullptr;
239     sptr<DisplayInfo> res = nullptr;
240     std::function<void()> func = [&]()
__anon7fcf749a0602() 241     {
242         res = screenSessionManagerProxy->GetDefaultDisplayInfo();
243     };
244     func();
245     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
246         ASSERT_NE(res, expectation);
247     } else {
248         ASSERT_EQ(res, expectation);
249     }
250 }
251 
252 /**
253  * @tc.name: SetScreenActiveMode
254  * @tc.desc: SetScreenActiveMode
255  * @tc.type: FUNC
256  */
257 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenActiveMode, Function | SmallTest | Level1)
258 {
259     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
260     ScreenId id = 1001;
261     uint32_t modeId = 1;
262 
263     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
264     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
265 
266 
267     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
268     std::function<void()> func = [&]()
__anon7fcf749a0702() 269     {
270         res = screenSessionManagerProxy->SetScreenActiveMode(id, modeId);
271     };
272     func();
273     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
274         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
275     } else {
276         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
277     }
278 }
279 
280 /**
281  * @tc.name: SetVirtualPixelRatio
282  * @tc.desc: SetVirtualPixelRatio
283  * @tc.type: FUNC
284  */
285 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualPixelRatio, Function | SmallTest | Level1)
286 {
287     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
288     ScreenId id = 1001;
289     float virtualPixelRatio = 1.0;
290 
291     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
292     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
293 
294 
295     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
296     std::function<void()> func = [&]()
__anon7fcf749a0802() 297     {
298         res = screenSessionManagerProxy->SetVirtualPixelRatio(id, virtualPixelRatio);
299     };
300     func();
301     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
302         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
303     } else {
304         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
305     }
306 }
307 
308 /**
309  * @tc.name: SetVirtualPixelRatioSystem
310  * @tc.desc: SetVirtualPixelRatioSystem
311  * @tc.type: FUNC
312  */
313 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualPixelRatioSystem, Function | SmallTest | Level1)
314 {
315     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
316     ScreenId id = 1001;
317     float virtualPixelRatio = 1.0;
318 
319     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
320     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
321 
322 
323     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
324     std::function<void()> func = [&]()
__anon7fcf749a0902() 325     {
326         res = screenSessionManagerProxy->SetVirtualPixelRatioSystem(id, virtualPixelRatio);
327     };
328     func();
329     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
330         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
331     } else {
332         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
333     }
334 }
335 
336 /**
337  * @tc.name: SetDefaultDensityDpi
338  * @tc.desc: SetDefaultDensityDpi
339  * @tc.type: FUNC
340  */
341 HWTEST_F(ScreenSessionManagerProxyTest, SetDefaultDensityDpi, Function | SmallTest | Level1)
342 {
343     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
344     ScreenId id = 1001;
345     float virtualPixelRatio = 1.0;
346 
347     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
348     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
349 
350 
351     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
352     std::function<void()> func = [&]()
__anon7fcf749a0a02() 353     {
354         res = screenSessionManagerProxy->SetDefaultDensityDpi(id, virtualPixelRatio);
355     };
356     func();
357     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
358         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
359     } else {
360         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
361     }
362 }
363 
364 /**
365  * @tc.name: SetResolution
366  * @tc.desc: SetResolution
367  * @tc.type: FUNC
368  */
369 HWTEST_F(ScreenSessionManagerProxyTest, SetResolution, Function | SmallTest | Level1)
370 {
371     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
372     ScreenId id = 1001;
373     uint32_t width = 1024;
374     uint32_t height = 1024;
375     float virtualPixelRatio = 1.0;
376 
377     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
378     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
379 
380 
381     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
382     std::function<void()> func = [&]()
__anon7fcf749a0b02() 383     {
384         res = screenSessionManagerProxy->SetResolution(id, width, height, virtualPixelRatio);
385     };
386     func();
387     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
388         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
389     } else {
390         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
391     }
392 }
393 
394 /**
395  * @tc.name: GetDensityInCurResolution
396  * @tc.desc: GetDensityInCurResolution
397  * @tc.type: FUNC
398  */
399 HWTEST_F(ScreenSessionManagerProxyTest, GetDensityInCurResolution, Function | SmallTest | Level1)
400 {
401     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
402     ScreenId id = 1001;
403     float virtualPixelRatio = 1.0;
404 
405     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
406     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
407 
408 
409     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
410     std::function<void()> func = [&]()
__anon7fcf749a0c02() 411     {
412         res = screenSessionManagerProxy->GetDensityInCurResolution(id, virtualPixelRatio);
413     };
414     func();
415     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
416         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
417     } else {
418         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
419     }
420 }
421 
422 /**
423  * @tc.name: GetScreenColorGamut
424  * @tc.desc: GetScreenColorGamut
425  * @tc.type: FUNC
426  */
427 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenColorGamut, Function | SmallTest | Level1)
428 {
429     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
430     ScreenId id = 1001;
431     ScreenColorGamut colorGamut {0};
432 
433     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
434     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
435 
436 
437     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
438     std::function<void()> func = [&]()
__anon7fcf749a0d02() 439     {
440         res = screenSessionManagerProxy->GetScreenColorGamut(id, colorGamut);
441     };
442     func();
443     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
444         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
445     } else {
446         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
447     }
448 }
449 
450 /**
451  * @tc.name: SetScreenColorGamut
452  * @tc.desc: SetScreenColorGamut
453  * @tc.type: FUNC
454  */
455 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenColorGamut, Function | SmallTest | Level1)
456 {
457     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
458     ScreenId id = 1001;
459     uint32_t colorGamut = 0;
460 
461     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
462     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
463 
464 
465     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
466     std::function<void()> func = [&]()
__anon7fcf749a0e02() 467     {
468         res = screenSessionManagerProxy->SetScreenColorGamut(id, colorGamut);
469     };
470     func();
471     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
472         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
473     } else {
474         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
475     }
476 }
477 
478 /**
479  * @tc.name: GetScreenGamutMap
480  * @tc.desc: GetScreenGamutMap
481  * @tc.type: FUNC
482  */
483 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenGamutMap, Function | SmallTest | Level1)
484 {
485     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
486     ScreenId id = 1001;
487     ScreenGamutMap colorGamut;
488 
489     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
490     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
491 
492 
493     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
494     std::function<void()> func = [&]()
__anon7fcf749a0f02() 495     {
496         res = screenSessionManagerProxy->GetScreenGamutMap(id, colorGamut);
497     };
498     func();
499     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
500         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
501     } else {
502         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
503     }
504 }
505 
506 /**
507  * @tc.name: SetScreenGamutMap
508  * @tc.desc: SetScreenGamutMap
509  * @tc.type: FUNC
510  */
511 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenGamutMap, Function | SmallTest | Level1)
512 {
513     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
514     ScreenId id = 1001;
515     ScreenGamutMap colorGamut {0};
516 
517     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
518     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
519 
520 
521     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
522     std::function<void()> func = [&]()
__anon7fcf749a1002() 523     {
524         res = screenSessionManagerProxy->SetScreenGamutMap(id, colorGamut);
525     };
526     func();
527     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
528         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
529     } else {
530         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
531     }
532 }
533 
534 /**
535  * @tc.name: SetScreenColorTransform
536  * @tc.desc: SetScreenColorTransform
537  * @tc.type: FUNC
538  */
539 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenColorTransform, Function | SmallTest | Level1)
540 {
541     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
542     ScreenId id = 1001;
543 
544     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
545     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
546 
547 
548     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
549     std::function<void()> func = [&]()
__anon7fcf749a1102() 550     {
551         res = screenSessionManagerProxy->SetScreenColorTransform(id);
552     };
553     func();
554     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
555         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
556     } else {
557         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
558     }
559 }
560 
561 /**
562  * @tc.name: GetPixelFormat
563  * @tc.desc: GetPixelFormat
564  * @tc.type: FUNC
565  */
566 HWTEST_F(ScreenSessionManagerProxyTest, GetPixelFormat, Function | SmallTest | Level1)
567 {
568     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
569     ScreenId id = 1001;
570     GraphicPixelFormat pixelFormat = GraphicPixelFormat {GRAPHIC_PIXEL_FMT_CLUT8};
571 
572     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
573     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
574 
575 
576     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
577     std::function<void()> func = [&]()
__anon7fcf749a1202() 578     {
579         res = screenSessionManagerProxy->GetPixelFormat(id, pixelFormat);
580     };
581     func();
582     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
583         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
584     } else {
585         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
586     }
587 }
588 
589 /**
590  * @tc.name: SetPixelFormat
591  * @tc.desc: SetPixelFormat
592  * @tc.type: FUNC
593  */
594 HWTEST_F(ScreenSessionManagerProxyTest, SetPixelFormat, Function | SmallTest | Level1)
595 {
596     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
597     ScreenId id = 1001;
598     GraphicPixelFormat pixelFormat = GraphicPixelFormat {GRAPHIC_PIXEL_FMT_CLUT8};
599 
600     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
601     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
602 
603 
604     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
605     std::function<void()> func = [&]()
__anon7fcf749a1302() 606     {
607         res = screenSessionManagerProxy->SetPixelFormat(id, pixelFormat);
608     };
609     func();
610     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
611         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
612     } else {
613         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
614     }
615 }
616 
617 /**
618  * @tc.name: GetSupportedHDRFormats
619  * @tc.desc: GetSupportedHDRFormats
620  * @tc.type: FUNC
621  */
622 HWTEST_F(ScreenSessionManagerProxyTest, GetSupportedHDRFormats, Function | SmallTest | Level1)
623 {
624     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
625     ScreenId id = 1001;
626     vector<ScreenHDRFormat> hdrFormats;
627 
628     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
629     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
630 
631 
632     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
633     std::function<void()> func = [&]()
__anon7fcf749a1402() 634     {
635         res = screenSessionManagerProxy->GetSupportedHDRFormats(id, hdrFormats);
636     };
637     func();
638     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
639         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
640     } else {
641         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
642     }
643 }
644 
645 /**
646  * @tc.name: GetScreenHDRFormat
647  * @tc.desc: GetScreenHDRFormat
648  * @tc.type: FUNC
649  */
650 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenHDRFormat, Function | SmallTest | Level1)
651 {
652     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
653     ScreenId id = 1001;
654     ScreenHDRFormat hdrFormatS {0};
655 
656     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
657     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
658 
659 
660     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
661     std::function<void()> func = [&]()
__anon7fcf749a1502() 662     {
663         res = screenSessionManagerProxy->GetScreenHDRFormat(id, hdrFormatS);
664     };
665     func();
666     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
667         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
668     } else {
669         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
670     }
671 }
672 
673 /**
674  * @tc.name: SetScreenHDRFormat
675  * @tc.desc: SetScreenHDRFormat
676  * @tc.type: FUNC
677  */
678 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenHDRFormat, Function | SmallTest | Level1)
679 {
680     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
681     ScreenId id = 1001;
682     ScreenHDRFormat hdrFormatS {0};
683 
684     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
685     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
686 
687 
688     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
689     std::function<void()> func = [&]()
__anon7fcf749a1602() 690     {
691         res = screenSessionManagerProxy->SetScreenHDRFormat(id, hdrFormatS);
692     };
693     func();
694     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
695         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
696     } else {
697         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
698     }
699 }
700 
701 /**
702  * @tc.name: RegisterDisplayManagerAgent
703  * @tc.desc: RegisterDisplayManagerAgent
704  * @tc.type: FUNC
705  */
706 HWTEST_F(ScreenSessionManagerProxyTest, RegisterDisplayManagerAgent, Function | SmallTest | Level1)
707 {
708     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
709     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
710     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
711     sptr<IDisplayManagerAgent> displayManagerAgent = new DisplayManagerAgentDefault();
712     DisplayManagerAgentType type = DisplayManagerAgentType::SCREEN_EVENT_LISTENER;
713     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
714         EXPECT_EQ(DMError::DM_OK, screenSessionManagerProxy->RegisterDisplayManagerAgent(displayManagerAgent, type));
715     } else {
716         EXPECT_NE(DMError::DM_OK, screenSessionManagerProxy->RegisterDisplayManagerAgent(displayManagerAgent, type));
717     }
718     displayManagerAgent = nullptr;
719     EXPECT_EQ(DMError::DM_ERROR_INVALID_PARAM,
720               screenSessionManagerProxy->RegisterDisplayManagerAgent(displayManagerAgent, type));
721 }
722 
723 /**
724  * @tc.name: UnregisterDisplayManagerAgent
725  * @tc.desc: UnregisterDisplayManagerAgent
726  * @tc.type: FUNC
727  */
728 HWTEST_F(ScreenSessionManagerProxyTest, UnregisterDisplayManagerAgent, Function | SmallTest | Level1)
729 {
730     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
731     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
732     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
733     sptr<IDisplayManagerAgent> displayManagerAgent = new DisplayManagerAgentDefault();
734     DisplayManagerAgentType type = DisplayManagerAgentType::SCREEN_EVENT_LISTENER;
735     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
736         EXPECT_EQ(DMError::DM_OK, screenSessionManagerProxy->UnregisterDisplayManagerAgent(displayManagerAgent, type));
737     } else {
738         EXPECT_NE(DMError::DM_OK, screenSessionManagerProxy->UnregisterDisplayManagerAgent(displayManagerAgent, type));
739     }
740     displayManagerAgent = nullptr;
741     EXPECT_EQ(DMError::DM_ERROR_INVALID_PARAM,
742               screenSessionManagerProxy->UnregisterDisplayManagerAgent(displayManagerAgent, type));
743 }
744 
745 /**
746  * @tc.name: WakeUpBegin
747  * @tc.desc: WakeUpBegin
748  * @tc.type: FUNC
749  */
750 HWTEST_F(ScreenSessionManagerProxyTest, WakeUpBegin, Function | SmallTest | Level1)
751 {
752     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
753     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
754     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
755 
756     PowerStateChangeReason reason {0};
757     bool expectation = true;
758     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
759         EXPECT_EQ(expectation, screenSessionManagerProxy->WakeUpBegin(reason));
760     } else {
761         EXPECT_NE(expectation, screenSessionManagerProxy->WakeUpBegin(reason));
762     }
763 }
764 
765 /**
766  * @tc.name: WakeUpEnd
767  * @tc.desc: WakeUpEnd
768  * @tc.type: FUNC
769  */
770 HWTEST_F(ScreenSessionManagerProxyTest, WakeUpEnd, Function | SmallTest | Level1)
771 {
772     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
773     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
774     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
775 
776     bool expectation = true;
777     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
778         EXPECT_EQ(expectation, screenSessionManagerProxy->WakeUpEnd());
779     } else {
780         EXPECT_NE(expectation, screenSessionManagerProxy->WakeUpEnd());
781     }
782 }
783 
784 /**
785  * @tc.name: SuspendBegin
786  * @tc.desc: SuspendBegin
787  * @tc.type: FUNC
788  */
789 HWTEST_F(ScreenSessionManagerProxyTest, SuspendBegin, Function | SmallTest | Level1)
790 {
791     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
792     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
793     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
794 
795     PowerStateChangeReason reason {0};
796     bool expectation = true;
797     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
798         EXPECT_EQ(expectation, screenSessionManagerProxy->SuspendBegin(reason));
799     } else {
800         EXPECT_NE(expectation, screenSessionManagerProxy->SuspendBegin(reason));
801     }
802 }
803 
804 /**
805  * @tc.name: SuspendEnd
806  * @tc.desc: SuspendEnd
807  * @tc.type: FUNC
808  */
809 HWTEST_F(ScreenSessionManagerProxyTest, SuspendEnd, Function | SmallTest | Level1)
810 {
811     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
812     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
813     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
814 
815     bool expectation = true;
816     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
817         EXPECT_EQ(expectation, screenSessionManagerProxy->SuspendEnd());
818     } else {
819         EXPECT_NE(expectation, screenSessionManagerProxy->SuspendEnd());
820     }
821 }
822 
823 /**
824  * @tc.name: SetScreenPowerById
825  * @tc.desc: SetScreenPowerById
826  * @tc.type: FUNC
827  */
828 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenPowerById, Function | SmallTest | Level1)
829 {
830     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
831     ScreenPowerState state {0};
832     ScreenId id = 1001;
833     PowerStateChangeReason reason {1};
834 
835     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
836     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
837 
838     bool expectation = true;
839     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
840         EXPECT_EQ(expectation, screenSessionManagerProxy->SetScreenPowerById(id, state, reason));
841     } else {
842         EXPECT_NE(expectation, screenSessionManagerProxy->SetScreenPowerById(id, state, reason));
843     }
844 }
845 
846 /**
847  * @tc.name: SetDisplayState
848  * @tc.desc: SetDisplayState
849  * @tc.type: FUNC
850  */
851 HWTEST_F(ScreenSessionManagerProxyTest, SetDisplayState, Function | SmallTest | Level1)
852 {
853     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
854     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
855     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
856 
857     DisplayState state {1};
858     screenSessionManagerProxy->SetDisplayState(state);
859     int resultValue = 0;
860     ASSERT_EQ(resultValue, 0);
861 }
862 
863 /**
864  * @tc.name: SetSpecifiedScreenPower
865  * @tc.desc: SetSpecifiedScreenPower
866  * @tc.type: FUNC
867  */
868 HWTEST_F(ScreenSessionManagerProxyTest, SetSpecifiedScreenPower, Function | SmallTest | Level1)
869 {
870     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
871     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
872     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
873 
874     ScreenPowerState state {0};
875     ScreenId id = 1001;
876     PowerStateChangeReason reason {1};
877     bool expectation = true;
878     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
879         EXPECT_EQ(expectation, screenSessionManagerProxy->SetSpecifiedScreenPower(id, state, reason));
880     } else {
881         EXPECT_NE(expectation, screenSessionManagerProxy->SetSpecifiedScreenPower(id, state, reason));
882     }
883 }
884 
885 /**
886  * @tc.name: SetScreenPowerForAll
887  * @tc.desc: SetScreenPowerForAll
888  * @tc.type: FUNC
889  */
890 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenPowerForAll, Function | SmallTest | Level1)
891 {
892     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
893     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
894     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
895 
896     ScreenPowerState state {0};
897     PowerStateChangeReason reason {1};
898     bool expectation = true;
899     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
900         EXPECT_EQ(expectation, screenSessionManagerProxy->SetScreenPowerForAll(state, reason));
901     } else {
902         EXPECT_NE(expectation, screenSessionManagerProxy->SetScreenPowerForAll(state, reason));
903     }
904 }
905 
906 /**
907  * @tc.name: GetDisplayState
908  * @tc.desc: GetDisplayState
909  * @tc.type: FUNC
910  */
911 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplayState, Function | SmallTest | Level1)
912 {
913     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
914     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
915     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
916 
917     DisplayId displayId {0};
918     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
919         EXPECT_NE(DisplayState::UNKNOWN, screenSessionManagerProxy->GetDisplayState(displayId));
920     } else {
921         EXPECT_EQ(DisplayState::UNKNOWN, screenSessionManagerProxy->GetDisplayState(displayId));
922     }
923 }
924 
925 /**
926  * @tc.name: TryToCancelScreenOff
927  * @tc.desc: TryToCancelScreenOff
928  * @tc.type: FUNC
929  */
930 HWTEST_F(ScreenSessionManagerProxyTest, TryToCancelScreenOff, Function | SmallTest | Level1)
931 {
932     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
933     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
934     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
935 
936     bool expectation = true;
937     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
938         EXPECT_NE(expectation, screenSessionManagerProxy->TryToCancelScreenOff());
939     } else {
940         EXPECT_EQ(expectation, screenSessionManagerProxy->TryToCancelScreenOff());
941     }
942 }
943 
944 /**
945  * @tc.name: NotifyDisplayEvent
946  * @tc.desc: NotifyDisplayEvent
947  * @tc.type: FUNC
948  */
949 HWTEST_F(ScreenSessionManagerProxyTest, NotifyDisplayEvent, Function | SmallTest | Level1)
950 {
951     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
952     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
953     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
954 
955     DisplayEvent event {0};
956     int resultValue = 0;
957     std::function<void()> func = [&]()
__anon7fcf749a1702() 958     {
959         screenSessionManagerProxy->NotifyDisplayEvent(event);
960         resultValue = 1;
961     };
962     func();
963     ASSERT_EQ(resultValue, 1);
964 }
965 
966 /**
967  * @tc.name: GetScreenPower
968  * @tc.desc: GetScreenPower
969  * @tc.type: FUNC
970  */
971 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenPower, Function | SmallTest | Level1)
972 {
973     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
974     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
975     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
976 
977     ScreenId dmsScreenId = 1001;
978     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
979         EXPECT_NE(ScreenPowerState::INVALID_STATE, screenSessionManagerProxy->GetScreenPower(dmsScreenId));
980     } else {
981         EXPECT_EQ(ScreenPowerState::INVALID_STATE, screenSessionManagerProxy->GetScreenPower(dmsScreenId));
982     }
983 }
984 
985 /**
986  * @tc.name: AddVirtualScreenBlockList
987  * @tc.desc: AddVirtualScreenBlockList
988  * @tc.type: FUNC
989  */
990 HWTEST_F(ScreenSessionManagerProxyTest, AddVirtualScreenBlockList, TestSize.Level1)
991 {
992     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
993     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
994     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
995     std::vector<int32_t> persistentIds {0, 1, 2};
996     EXPECT_NE(DMError::DM_ERROR_IPC_FAILED, screenSessionManagerProxy->AddVirtualScreenBlockList(persistentIds));
997 }
998 
999 /**
1000  * @tc.name: RemoveVirtualScreenBlockList
1001  * @tc.desc: RemoveVirtualScreenBlockList
1002  * @tc.type: FUNC
1003  */
1004 HWTEST_F(ScreenSessionManagerProxyTest, RemoveVirtualScreenBlockList, TestSize.Level1)
1005 {
1006     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1007     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1008     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1009     std::vector<int32_t> persistentIds {0, 1, 2};
1010     EXPECT_NE(DMError::DM_ERROR_IPC_FAILED, screenSessionManagerProxy->RemoveVirtualScreenBlockList(persistentIds));
1011 }
1012 
1013 /**
1014  * @tc.name: SetVirtualMirrorScreenCanvasRotation
1015  * @tc.desc: SetVirtualMirrorScreenCanvasRotation
1016  * @tc.type: FUNC
1017  */
1018 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualMirrorScreenCanvasRotation, Function | SmallTest | Level1)
1019 {
1020     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1021     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1022     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1023 
1024     ScreenId ScreenId = 1001;
1025     bool canvasRotation = true;
1026     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1027         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1028             screenSessionManagerProxy->SetVirtualMirrorScreenCanvasRotation(ScreenId, canvasRotation));
1029     } else {
1030         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1031             screenSessionManagerProxy->SetVirtualMirrorScreenCanvasRotation(ScreenId, canvasRotation));
1032     }
1033 }
1034 
1035 /**
1036  * @tc.name: SetVirtualMirrorScreenScaleMode
1037  * @tc.desc: SetVirtualMirrorScreenScaleMode
1038  * @tc.type: FUNC
1039  */
1040 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualMirrorScreenScaleMode, Function | SmallTest | Level1)
1041 {
1042     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1043     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1044     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1045 
1046     ScreenId ScreenId = 1001;
1047     ScreenScaleMode scaleMode {0};
1048     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1049         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1050                 screenSessionManagerProxy->SetVirtualMirrorScreenScaleMode(ScreenId, scaleMode));
1051     } else {
1052         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1053                 screenSessionManagerProxy->SetVirtualMirrorScreenScaleMode(ScreenId, scaleMode));
1054     }
1055 }
1056 
1057 /**
1058  * @tc.name: ResizeVirtualScreen
1059  * @tc.desc: ResizeVirtualScreen
1060  * @tc.type: FUNC
1061  */
1062 HWTEST_F(ScreenSessionManagerProxyTest, ResizeVirtualScreen, Function | SmallTest | Level1)
1063 {
1064     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1065     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1066     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1067 
1068     ScreenId ScreenId = 1001;
1069     uint32_t width = 1024;
1070     uint32_t height = 1024;
1071     EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1072               screenSessionManagerProxy->ResizeVirtualScreen(ScreenId, width, height));
1073 }
1074 
1075 /**
1076  * @tc.name: DestroyVirtualScreen
1077  * @tc.desc: DestroyVirtualScreen
1078  * @tc.type: FUNC
1079  */
1080 HWTEST_F(ScreenSessionManagerProxyTest, DestroyVirtualScreen, Function | SmallTest | Level1)
1081 {
1082     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1083     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1084     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1085 
1086     ScreenId ScreenId = 1001;
1087     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1088         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1089                 screenSessionManagerProxy->DestroyVirtualScreen(ScreenId));
1090     } else {
1091         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1092                 screenSessionManagerProxy->DestroyVirtualScreen(ScreenId));
1093     }
1094 }
1095 
1096 /**
1097  * @tc.name: MakeMirror
1098  * @tc.desc: MakeMirror
1099  * @tc.type: FUNC
1100  */
1101 HWTEST_F(ScreenSessionManagerProxyTest, MakeMirror, Function | SmallTest | Level1)
1102 {
1103     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1104     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1105     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1106 
1107     ScreenId Id = 1001;
1108     std::vector<ScreenId> mirrorScreenIds = {1003, 1004, 1005};
1109     ScreenId screenGroupId = 1002;
1110     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1111         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1112                 screenSessionManagerProxy->MakeMirror(Id, mirrorScreenIds, screenGroupId));
1113     } else {
1114         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1115                 screenSessionManagerProxy->MakeMirror(Id, mirrorScreenIds, screenGroupId));
1116     }
1117 }
1118 
1119 /**
1120  * @tc.name: StopMirror
1121  * @tc.desc: StopMirror
1122  * @tc.type: FUNC
1123  */
1124 HWTEST_F(ScreenSessionManagerProxyTest, StopMirror, Function | SmallTest | Level1)
1125 {
1126     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1127     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1128     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1129 
1130     const std::vector<ScreenId> mirrorScreenIds = {1003, 1004, 1005};
1131     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1132         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1133                 screenSessionManagerProxy->StopMirror(mirrorScreenIds));
1134     } else {
1135         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1136                 screenSessionManagerProxy->StopMirror(mirrorScreenIds));
1137     }
1138 }
1139 
1140 /**
1141  * @tc.name: DisableMirror
1142  * @tc.desc: DisableMirror
1143  * @tc.type: FUNC
1144  */
1145 HWTEST_F(ScreenSessionManagerProxyTest, DisableMirror, Function | SmallTest | Level1)
1146 {
1147     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1148     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1149     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1150 
1151     bool disableOrNot = true;
1152     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1153         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1154                 screenSessionManagerProxy->DisableMirror(disableOrNot));
1155     } else {
1156         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1157                 screenSessionManagerProxy->DisableMirror(disableOrNot));
1158     }
1159 }
1160 
1161 /**
1162  * @tc.name: MakeExpand
1163  * @tc.desc: MakeExpand
1164  * @tc.type: FUNC
1165  */
1166 HWTEST_F(ScreenSessionManagerProxyTest, MakeExpand, Function | SmallTest | Level1)
1167 {
1168     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1169     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1170     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1171 
1172     std::vector<ScreenId> screenId = {1003, 1004, 1005};
1173     std::vector<Point> startPoint {};
1174     ScreenId screenGroupId = 1001;
1175     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1176         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1177                 screenSessionManagerProxy->MakeExpand(screenId, startPoint, screenGroupId));
1178     } else {
1179         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1180                 screenSessionManagerProxy->MakeExpand(screenId, startPoint, screenGroupId));
1181     }
1182 }
1183 
1184 /**
1185  * @tc.name: StopExpand
1186  * @tc.desc: StopExpand
1187  * @tc.type: FUNC
1188  */
1189 HWTEST_F(ScreenSessionManagerProxyTest, StopExpand, Function | SmallTest | Level1)
1190 {
1191     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1192     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1193     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1194 
1195     const std::vector<ScreenId> expandScreenIds = {1003, 1004, 1005};
1196     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1197         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1198                 screenSessionManagerProxy->StopExpand(expandScreenIds));
1199     } else {
1200         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1201                 screenSessionManagerProxy->StopExpand(expandScreenIds));
1202     }
1203 }
1204 
1205 /**
1206  * @tc.name: GetScreenGroupInfoById
1207  * @tc.desc: GetScreenGroupInfoById
1208  * @tc.type: FUNC
1209  */
1210 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenGroupInfoById, Function | SmallTest | Level1)
1211 {
1212     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1213 
1214     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1215     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1216 
1217     sptr<ScreenGroupInfo> expectation = nullptr;
1218     sptr<ScreenGroupInfo> res = nullptr;
1219     ScreenId Id {0};
1220     std::function<void()> func = [&]()
__anon7fcf749a1802() 1221     {
1222         res = screenSessionManagerProxy->GetScreenGroupInfoById(Id);
1223     };
1224     func();
1225     ASSERT_EQ(res, expectation);
1226 }
1227 
1228 /**
1229  * @tc.name: RemoveVirtualScreenFromGroup
1230  * @tc.desc: RemoveVirtualScreenFromGroup
1231  * @tc.type: FUNC
1232  */
1233 HWTEST_F(ScreenSessionManagerProxyTest, RemoveVirtualScreenFromGroup, Function | SmallTest | Level1)
1234 {
1235     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1236 
1237     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1238     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1239     std::vector<ScreenId> screens = {1002, 1003, 1004};
1240     screenSessionManagerProxy->RemoveVirtualScreenFromGroup(screens);
1241     auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(2000);
1242     EXPECT_EQ(screenSession, nullptr);
1243 }
1244 
1245 /**
1246  * @tc.name: GetDisplaySnapshot
1247  * @tc.desc: GetDisplaySnapshot
1248  * @tc.type: FUNC
1249  */
1250 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplaySnapshot, Function | SmallTest | Level1)
1251 {
1252     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1253 
1254     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1255     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1256 
1257     std::shared_ptr<Media::PixelMap> expectation = nullptr;
1258     std::shared_ptr<Media::PixelMap> res = nullptr;
1259     DisplayId displayId {0};
1260     DmErrorCode* errorCode = nullptr;
1261     std::function<void()> func = [&]()
__anon7fcf749a1902() 1262     {
1263         res = screenSessionManagerProxy->GetDisplaySnapshot(displayId, errorCode, false);
1264     };
1265     func();
1266     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1267         ASSERT_NE(res, expectation);
1268     } else {
1269         ASSERT_EQ(res, expectation);
1270     }
1271 }
1272 
1273 /**
1274  * @tc.name: GetDisplayInfoById
1275  * @tc.desc: GetDisplayInfoById
1276  * @tc.type: FUNC
1277  */
1278 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplayInfoById, Function | SmallTest | Level1)
1279 {
1280     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1281 
1282     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1283     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1284 
1285     sptr<DisplayInfo> expectation = nullptr;
1286     sptr<DisplayInfo> res = nullptr;
1287     DisplayId displayId {0};
1288     std::function<void()> func = [&]()
__anon7fcf749a1a02() 1289     {
1290         res = screenSessionManagerProxy->GetDisplayInfoById(displayId);
1291     };
1292     func();
1293     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1294         ASSERT_NE(res, expectation);
1295     } else {
1296         ASSERT_EQ(res, expectation);
1297     }
1298 }
1299 
1300 /**
1301  * @tc.name: GetDisplayInfoByScreen
1302  * @tc.desc: GetDisplayInfoByScreen
1303  * @tc.type: FUNC
1304  */
1305 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplayInfoByScreen, Function | SmallTest | Level1)
1306 {
1307     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1308 
1309     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1310     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1311 
1312     sptr<DisplayInfo> expectation = nullptr;
1313     sptr<DisplayInfo> res = nullptr;
1314     ScreenId screenId {0};
1315     std::function<void()> func = [&]()
__anon7fcf749a1b02() 1316     {
1317         res = screenSessionManagerProxy->GetDisplayInfoByScreen(screenId);
1318     };
1319     func();
1320     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1321         ASSERT_NE(res, expectation);
1322     } else {
1323         ASSERT_EQ(res, expectation);
1324     }
1325 }
1326 
1327 /**
1328  * @tc.name: GetAllDisplayIds
1329  * @tc.desc: GetAllDisplayIds
1330  * @tc.type: FUNC
1331  */
1332 HWTEST_F(ScreenSessionManagerProxyTest, GetAllDisplayIds, Function | SmallTest | Level1)
1333 {
1334     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1335 
1336     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1337     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1338 
1339     int resultValue = 0;
1340     std::function<void()> func = [&]()
__anon7fcf749a1c02() 1341     {
1342         screenSessionManagerProxy->GetAllDisplayIds();
1343         resultValue = 1;
1344     };
1345     func();
1346     ASSERT_EQ(resultValue, 1);
1347 }
1348 
1349 /**
1350  * @tc.name: GetScreenInfoById
1351  * @tc.desc: GetScreenInfoById
1352  * @tc.type: FUNC
1353  */
1354 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenInfoById, Function | SmallTest | Level1)
1355 {
1356     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1357 
1358     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1359     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1360 
1361     sptr<ScreenInfo> expectation = nullptr;
1362     sptr<ScreenInfo> res = nullptr;
1363     ScreenId Id {0};
1364     std::function<void()> func = [&]()
__anon7fcf749a1d02() 1365     {
1366         res = screenSessionManagerProxy->GetScreenInfoById(Id);
1367     };
1368     func();
1369     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1370         ASSERT_NE(res, expectation);
1371     } else {
1372         ASSERT_EQ(res, expectation);
1373     }
1374 }
1375 
1376 /**
1377  * @tc.name: GetAllScreenInfos
1378  * @tc.desc: GetAllScreenInfos
1379  * @tc.type: FUNC
1380  */
1381 HWTEST_F(ScreenSessionManagerProxyTest, GetAllScreenInfos, Function | SmallTest | Level1)
1382 {
1383     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1384     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1385     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1386 
1387     std::vector<sptr<ScreenInfo>> screenInfos {};
1388     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1389         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1390                 screenSessionManagerProxy->GetAllScreenInfos(screenInfos));
1391     } else {
1392         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1393                 screenSessionManagerProxy->GetAllScreenInfos(screenInfos));
1394     }
1395 }
1396 
1397 /**
1398  * @tc.name: GetScreenSupportedColorGamuts
1399  * @tc.desc: GetScreenSupportedColorGamuts
1400  * @tc.type: FUNC
1401  */
1402 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenSupportedColorGamuts, Function | SmallTest | Level1)
1403 {
1404     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1405     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1406     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1407 
1408     ScreenId screenId = 1001;
1409     std::vector<ScreenColorGamut> colorGamuts {};
1410     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1411         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1412                 screenSessionManagerProxy->GetScreenSupportedColorGamuts(screenId, colorGamuts));
1413     } else {
1414         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1415                 screenSessionManagerProxy->GetScreenSupportedColorGamuts(screenId, colorGamuts));
1416     }
1417 }
1418 
1419 /**
1420  * @tc.name: SetOrientation
1421  * @tc.desc: SetOrientation
1422  * @tc.type: FUNC
1423  */
1424 HWTEST_F(ScreenSessionManagerProxyTest, SetOrientation, Function | SmallTest | Level1)
1425 {
1426     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1427     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1428     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1429 
1430     ScreenId screenId = 1001;
1431     Orientation orientation = Orientation::BEGIN;
1432     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1433         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1434                 screenSessionManagerProxy->SetOrientation(screenId, orientation));
1435     } else {
1436         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1437                 screenSessionManagerProxy->SetOrientation(screenId, orientation));
1438     }
1439 }
1440 
1441 /**
1442  * @tc.name: SetScreenRotationLocked
1443  * @tc.desc: SetScreenRotationLocked
1444  * @tc.type: FUNC
1445  */
1446 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenRotationLocked, Function | SmallTest | Level1)
1447 {
1448     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1449     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1450     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1451 
1452     bool isLocked = true;
1453     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1454         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1455                 screenSessionManagerProxy->SetScreenRotationLocked(isLocked));
1456     } else {
1457         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1458                 screenSessionManagerProxy->SetScreenRotationLocked(isLocked));
1459     }
1460 }
1461 
1462 /**
1463  * @tc.name: SetScreenRotationLockedFromJs
1464  * @tc.desc: SetScreenRotationLockedFromJs
1465  * @tc.type: FUNC
1466  */
1467 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenRotationLockedFromJs, Function | SmallTest | Level1)
1468 {
1469     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1470     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1471     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1472 
1473     bool isLocked = true;
1474     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1475         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1476                 screenSessionManagerProxy->SetScreenRotationLockedFromJs(isLocked));
1477     } else {
1478         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1479                 screenSessionManagerProxy->SetScreenRotationLockedFromJs(isLocked));
1480     }
1481 }
1482 
1483 /**
1484  * @tc.name: SetMultiScreenMode
1485  * @tc.desc: SetMultiScreenMode
1486  * @tc.type: FUNC
1487  */
1488 HWTEST_F(ScreenSessionManagerProxyTest, SetMultiScreenMode, Function | SmallTest | Level1)
1489 {
1490     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1491     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1492     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1493 
1494     ScreenId mainScreenId = 0;
1495     ScreenId secondaryScreenId = 1;
1496     MultiScreenMode screenMode = MultiScreenMode::SCREEN_EXTEND;
1497 
1498     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
1499     std::function<void()> func = [&]()
__anon7fcf749a1e02() 1500     {
1501         res = screenSessionManagerProxy->SetMultiScreenMode(mainScreenId, secondaryScreenId, screenMode);
1502     };
1503     func();
1504     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1505         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
1506     } else {
1507         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
1508     }
1509 }
1510 
1511 /**
1512  * @tc.name: SetMultiScreenRelativePosition
1513  * @tc.desc: SetMultiScreenRelativePosition
1514  * @tc.type: FUNC
1515  */
1516 HWTEST_F(ScreenSessionManagerProxyTest, SetMultiScreenRelativePosition, Function | SmallTest | Level1)
1517 {
1518     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1519     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1520     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1521 
1522     ScreenId testId = 2060;
1523     ScreenId testId1 = 3060;
1524     MultiScreenPositionOptions mainScreenOptions = {testId, 100, 100};
1525     MultiScreenPositionOptions secondScreenOption = {testId1, 100, 100};
1526 
1527     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
1528     std::function<void()> func = [&]()
__anon7fcf749a1f02() 1529     {
1530         res = screenSessionManagerProxy->SetMultiScreenRelativePosition(mainScreenOptions, secondScreenOption);
1531     };
1532     func();
1533     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1534         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
1535     } else {
1536         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
1537     }
1538 }
1539 
1540 /**
1541  * @tc.name: SetVirtualScreenMaxRefreshRate
1542  * @tc.desc: SetVirtualScreenMaxRefreshRate
1543  * @tc.type: FUNC
1544  */
1545 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualScreenMaxRefreshRate, Function | SmallTest | Level1)
1546 {
1547     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1548     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1549     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1550 
1551     ScreenId id = 0;
1552     uint32_t refreshRate = 12;
1553     uint32_t actualRefreshRate = 0;
1554 
1555     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
1556     std::function<void()> func = [&]()
__anon7fcf749a2002() 1557     {
1558         res = screenSessionManagerProxy->SetVirtualScreenMaxRefreshRate(id, refreshRate, actualRefreshRate);
1559     };
1560     func();
1561     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1562         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
1563     } else {
1564         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
1565     }
1566 }
1567 
1568 /**
1569  * @tc.name: IsScreenRotationLocked
1570  * @tc.desc: IsScreenRotationLocked
1571  * @tc.type: FUNC
1572  */
1573 HWTEST_F(ScreenSessionManagerProxyTest, IsScreenRotationLocked, Function | SmallTest | Level1)
1574 {
1575     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1576     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1577     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1578 
1579     bool isLocked = true;
1580     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1581         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1582                 screenSessionManagerProxy->IsScreenRotationLocked(isLocked));
1583     } else {
1584         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1585                 screenSessionManagerProxy->IsScreenRotationLocked(isLocked));
1586     }
1587 }
1588 
1589 /**
1590  * @tc.name: GetCutoutInfo
1591  * @tc.desc: GetCutoutInfo
1592  * @tc.type: FUNC
1593  */
1594 HWTEST_F(ScreenSessionManagerProxyTest, GetCutoutInfo, Function | SmallTest | Level1)
1595 {
1596     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1597 
1598     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1599     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1600 
1601     sptr<CutoutInfo> expectation = nullptr;
1602     sptr<CutoutInfo> res = nullptr;
1603     DisplayId displayId = 0;
1604     std::function<void()> func = [&]()
__anon7fcf749a2102() 1605     {
1606         res = screenSessionManagerProxy->GetCutoutInfo(displayId);
1607     };
1608     func();
1609     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1610         ASSERT_NE(res, expectation);
1611     } else {
1612         ASSERT_EQ(res, expectation);
1613     }
1614 }
1615 
1616 /**
1617  * @tc.name: HasImmersiveWindow
1618  * @tc.desc: HasImmersiveWindow
1619  * @tc.type: FUNC
1620  */
1621 HWTEST_F(ScreenSessionManagerProxyTest, HasImmersiveWindow, Function | SmallTest | Level1)
1622 {
1623     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1624     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1625     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1626 
1627     bool immersive = true;
1628     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1629         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1630                 screenSessionManagerProxy->HasImmersiveWindow(0u, immersive));
1631     } else {
1632         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1633                 screenSessionManagerProxy->HasImmersiveWindow(0u, immersive));
1634     }
1635 }
1636 
1637 /**
1638  * @tc.name: ConvertScreenIdToRsScreenId
1639  * @tc.desc: ConvertScreenIdToRsScreenId
1640  * @tc.type: FUNC
1641  */
1642 HWTEST_F(ScreenSessionManagerProxyTest, ConvertScreenIdToRsScreenId, Function | SmallTest | Level1)
1643 {
1644     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1645     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1646     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1647 
1648     ScreenId screenId = 1001;
1649     ScreenId rsScreenId = 1002;
1650     auto ret = screenSessionManagerProxy->ConvertScreenIdToRsScreenId(screenId, rsScreenId);
1651     EXPECT_EQ(ret, false);
1652 }
1653 
1654 /**
1655  * @tc.name: HasPrivateWindow
1656  * @tc.desc: HasPrivateWindow
1657  * @tc.type: FUNC
1658  */
1659 HWTEST_F(ScreenSessionManagerProxyTest, HasPrivateWindow, Function | SmallTest | Level1)
1660 {
1661     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1662     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1663     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1664 
1665     bool hasPrivateWindow = true;
1666     DisplayId displayId = 0;
1667     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1668         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1669                 screenSessionManagerProxy->HasPrivateWindow(displayId, hasPrivateWindow));
1670     } else {
1671         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1672                 screenSessionManagerProxy->HasPrivateWindow(displayId, hasPrivateWindow));
1673     }
1674 }
1675 
1676 /**
1677  * @tc.name: DumpAllScreensInfo
1678  * @tc.desc: DumpAllScreensInfo
1679  * @tc.type: FUNC
1680  */
1681 HWTEST_F(ScreenSessionManagerProxyTest, DumpAllScreensInfo, Function | SmallTest | Level1)
1682 {
1683     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1684     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1685     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1686 
1687     std::string dumpInfo;
1688     screenSessionManagerProxy->DumpAllScreensInfo(dumpInfo);
1689     EXPECT_NE(dumpInfo, "");
1690 }
1691 
1692 /**
1693  * @tc.name: DumpSpecialScreenInfo
1694  * @tc.desc: DumpSpecialScreenInfo
1695  * @tc.type: FUNC
1696  */
1697 HWTEST_F(ScreenSessionManagerProxyTest, DumpSpecialScreenInfo, Function | SmallTest | Level1)
1698 {
1699     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1700     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1701     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1702 
1703     ScreenId id = 1001;
1704     std::string dumpInfo;
1705     screenSessionManagerProxy->DumpSpecialScreenInfo(id, dumpInfo);
1706     EXPECT_NE(dumpInfo, "");
1707 }
1708 
1709 /**
1710  * @tc.name: SetFoldDisplayMode
1711  * @tc.desc: SetFoldDisplayMode
1712  * @tc.type: FUNC
1713  */
1714 HWTEST_F(ScreenSessionManagerProxyTest, SetFoldDisplayMode, Function | SmallTest | Level1)
1715 {
1716     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1717     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1718     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1719 
1720     const FoldDisplayMode displayMode {0};
1721     screenSessionManagerProxy->SetFoldDisplayMode(displayMode);
1722     if (screenSessionManagerProxy->IsFoldable()) {
1723         EXPECT_NE(ScreenSessionManager::GetInstance().foldScreenController_, nullptr);
1724     } else {
1725         EXPECT_EQ(ScreenSessionManager::GetInstance().foldScreenController_, nullptr);
1726     }
1727 }
1728 
1729 /**
1730  * @tc.name: SetFoldDisplayModeFromJs
1731  * @tc.desc: SetFoldDisplayModeFromJs
1732  * @tc.type: FUNC
1733  */
1734 HWTEST_F(ScreenSessionManagerProxyTest, SetFoldDisplayModeFromJs, Function | SmallTest | Level1)
1735 {
1736     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1737     const FoldDisplayMode displayMode {0};
1738 
1739     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1740     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1741 
1742     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1743         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1744                 screenSessionManagerProxy->SetFoldDisplayModeFromJs(displayMode));
1745     } else {
1746         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1747                 screenSessionManagerProxy->SetFoldDisplayModeFromJs(displayMode));
1748     }
1749 }
1750 
1751 /**
1752  * @tc.name: SetFoldStatusLocked
1753  * @tc.desc: SetFoldStatusLocked
1754  * @tc.type: FUNC
1755  */
1756 HWTEST_F(ScreenSessionManagerProxyTest, SetFoldStatusLocked, Function | SmallTest | Level1)
1757 {
1758     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1759     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1760     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1761 
1762     bool locked = true;
1763     screenSessionManagerProxy->SetFoldStatusLocked(locked);
1764     if (screenSessionManagerProxy->IsFoldable()) {
1765         EXPECT_NE(ScreenSessionManager::GetInstance().foldScreenController_, nullptr);
1766     } else {
1767         EXPECT_EQ(ScreenSessionManager::GetInstance().foldScreenController_, nullptr);
1768     }
1769 }
1770 
1771 /**
1772  * @tc.name: GetFoldDisplayMode
1773  * @tc.desc: GetFoldDisplayMode
1774  * @tc.type: FUNC
1775  */
1776 HWTEST_F(ScreenSessionManagerProxyTest, GetFoldDisplayMode, Function | SmallTest | Level1)
1777 {
1778     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1779     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1780     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1781 
1782     EXPECT_EQ(FoldDisplayMode::UNKNOWN,
1783               screenSessionManagerProxy->GetFoldDisplayMode());
1784 }
1785 
1786 /**
1787  * @tc.name: IsFoldable
1788  * @tc.desc: IsFoldable
1789  * @tc.type: FUNC
1790  */
1791 HWTEST_F(ScreenSessionManagerProxyTest, IsFoldable, Function | SmallTest | Level1)
1792 {
1793     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1794     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1795     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1796     screenSessionManagerProxy->IsFoldable();
1797     auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(2000);
1798     EXPECT_EQ(screenSession, nullptr);
1799 }
1800 
1801 /**
1802  * @tc.name: IsCaptured
1803  * @tc.desc: IsCaptured
1804  * @tc.type: FUNC
1805  */
1806 HWTEST_F(ScreenSessionManagerProxyTest, IsCaptured, Function | SmallTest | Level1)
1807 {
1808     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1809     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1810     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1811     auto ret = screenSessionManagerProxy->IsCaptured();
1812     EXPECT_EQ(ret, false);
1813 }
1814 
1815 /**
1816  * @tc.name: GetFoldStatus
1817  * @tc.desc: GetFoldStatus
1818  * @tc.type: FUNC
1819  */
1820 HWTEST_F(ScreenSessionManagerProxyTest, GetFoldStatus, Function | SmallTest | Level1)
1821 {
1822     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1823     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1824     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1825     ASSERT_NE(screenSessionManagerProxy, nullptr);
1826     screenSessionManagerProxy->GetFoldStatus();
1827 }
1828 
1829 /**
1830  * @tc.name: GetSuperFoldStatus
1831  * @tc.desc: GetSuperFoldStatus
1832  * @tc.type: FUNC
1833  */
1834 HWTEST_F(ScreenSessionManagerProxyTest, GetSuperFoldStatus, Function | SmallTest | Level1)
1835 {
1836     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1837     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1838     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1839     ASSERT_NE(screenSessionManagerProxy, nullptr);
1840     screenSessionManagerProxy->GetSuperFoldStatus();
1841 }
1842 
1843 /**
1844  * @tc.name: SetLandscapeLockStatus
1845  * @tc.desc: SetLandscapeLockStatus
1846  * @tc.type: FUNC
1847  */
1848 HWTEST_F(ScreenSessionManagerProxyTest, SetLandscapeLockStatus, Function | SmallTest | Level1)
1849 {
1850     bool isLocked = false;
1851     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1852     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1853     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1854     ASSERT_NE(screenSessionManagerProxy, nullptr);
1855     screenSessionManagerProxy->SetLandscapeLockStatus(isLocked);
1856 }
1857 
1858 /**
1859  * @tc.name: GetCurrentFoldCreaseRegion
1860  * @tc.desc: GetCurrentFoldCreaseRegion
1861  * @tc.type: FUNC
1862  */
1863 HWTEST_F(ScreenSessionManagerProxyTest, GetCurrentFoldCreaseRegion, Function | SmallTest | Level1)
1864 {
1865     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1866 
1867     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1868     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1869     ASSERT_NE(screenSessionManagerProxy, nullptr);
1870 
1871     screenSessionManagerProxy->GetCurrentFoldCreaseRegion();
1872 }
1873 
1874 /**
1875  * @tc.name: MakeUniqueScreen
1876  * @tc.desc: MakeUniqueScreen
1877  * @tc.type: FUNC
1878  */
1879 HWTEST_F(ScreenSessionManagerProxyTest, MakeUniqueScreen, Function | SmallTest | Level1)
1880 {
1881     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1882     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1883     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1884 
1885     const std::vector<ScreenId> screenIds {1001, 1002, 1003};
1886     std::vector<DisplayId> displayIds;
1887     EXPECT_EQ(DMError::DM_ERROR_NULLPTR, screenSessionManagerProxy->MakeUniqueScreen(screenIds, displayIds));
1888 }
1889 
1890 /**
1891  * @tc.name: SetClient
1892  * @tc.desc: SetClient
1893  * @tc.type: FUNC
1894  */
1895 HWTEST_F(ScreenSessionManagerProxyTest, SetClient, Function | SmallTest | Level1)
1896 {
1897     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1898     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1899     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1900 
1901     const sptr<IScreenSessionManagerClient> client = nullptr;
1902     screenSessionManagerProxy->SetClient(client);
1903     EXPECT_EQ(client, nullptr);
1904 }
1905 
1906 /**
1907  * @tc.name: SwitchUser
1908  * @tc.desc: SwitchUser
1909  * @tc.type: FUNC
1910  */
1911 HWTEST_F(ScreenSessionManagerProxyTest, SwitchUser, Function | SmallTest | Level1)
1912 {
1913     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1914     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1915     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1916     screenSessionManagerProxy->SwitchUser();
1917     auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(2000);
1918     EXPECT_EQ(screenSession, nullptr);
1919 }
1920 
1921 /**
1922  * @tc.name: GetScreenProperty
1923  * @tc.desc: GetScreenProperty
1924  * @tc.type: FUNC
1925  */
1926 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenProperty, Function | SmallTest | Level1)
1927 {
1928     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1929     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1930     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1931     ScreenId screenId = 1001;
1932     screenSessionManagerProxy->GetScreenProperty(screenId);
1933     auto screenSession = ScreenSessionManager::GetInstance().GetScreenSession(2000);
1934     EXPECT_EQ(screenSession, nullptr);
1935 }
1936 
1937 /**
1938  * @tc.name: GetScreenCapture
1939  * @tc.desc: GetScreenCapture test
1940  * @tc.type: FUNC
1941  */
1942 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenCapture, Function | SmallTest | Level1)
1943 {
1944     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1945     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1946     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1947     ASSERT_TRUE(screenSessionManagerProxy != nullptr);
1948 
1949     std::shared_ptr<Media::PixelMap> res = nullptr;
1950     CaptureOption option;
1951     option.displayId_ = 0;
1952     DmErrorCode errorCode = DmErrorCode::DM_OK;
__anon7fcf749a2202() 1953     std::function<void()> func = [&]() {
1954         res = screenSessionManagerProxy->GetScreenCapture(option, &errorCode);
1955     };
1956     func();
1957     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1958         if (errorCode == DmErrorCode::DM_OK) {
1959             ASSERT_NE(res, nullptr);
1960         } else {
1961             ASSERT_EQ(res, nullptr);
1962         }
1963     } else {
1964         ASSERT_EQ(res, nullptr);
1965     }
1966 }
1967 
1968 /**
1969  * @tc.name: GetPrimaryDisplayInfo
1970  * @tc.desc: GetPrimaryDisplayInfo test
1971  * @tc.type: FUNC
1972  */
1973 HWTEST_F(ScreenSessionManagerProxyTest, GetPrimaryDisplayInfo, Function | SmallTest | Level1)
1974 {
1975     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1976     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1977     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1978     ASSERT_TRUE(screenSessionManagerProxy != nullptr);
1979 
1980     sptr<DisplayInfo> res = nullptr;
__anon7fcf749a2302() 1981     std::function<void()> func = [&]() {
1982         res = screenSessionManagerProxy->GetPrimaryDisplayInfo();
1983     };
1984     func();
1985     ASSERT_NE(res, nullptr);
1986 }
1987 
1988 /**
1989  * @tc.name: SetScreenSkipProtectedWindow
1990  * @tc.desc: SetScreenSkipProtectedWindow test
1991  * @tc.type: FUNC
1992  */
1993 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenSkipProtectedWindow, Function | SmallTest | Level1)
1994 {
1995     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1996     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1997     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1998     ASSERT_TRUE(screenSessionManagerProxy != nullptr);
1999 
2000     const std::vector<ScreenId> screenIds = {1001, 1002};
2001     bool isEnable = true;
2002     int resultValue = 0;
__anon7fcf749a2402() 2003     std::function<void()> func = [&]() {
2004         screenSessionManagerProxy->SetScreenSkipProtectedWindow(screenIds, isEnable);
2005         resultValue = 1;
2006     };
2007     func();
2008     ASSERT_EQ(resultValue, 1);
2009 }
2010 
2011 /**
2012  * @tc.name: GetDisplayCapability
2013  * @tc.desc: GetDisplayCapability test
2014  * @tc.type: FUNC
2015  */
2016 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplayCapability, Function | SmallTest | Level1)
2017 {
2018     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
2019     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
2020     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
2021     ASSERT_TRUE(screenSessionManagerProxy != nullptr);
2022     std::string capabilitInfo;
2023     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
2024         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
2025                 screenSessionManagerProxy->GetDisplayCapability(capabilitInfo));
2026     } else {
2027         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
2028                 screenSessionManagerProxy->GetDisplayCapability(capabilitInfo));
2029     }
2030 }
2031 }
2032 }
2033 }