• 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 
31 using namespace testing;
32 using namespace testing::ext;
33 namespace OHOS {
34 namespace Rosen {
35 class ScreenSessionManagerProxyTest : public testing::Test {
36 public:
37     static void SetUpTestCase();
38     static void TearDownTestCase();
39     void SetUp() override;
40     void TearDown() override;
41 };
42 
SetUpTestCase()43 void ScreenSessionManagerProxyTest::SetUpTestCase()
44 {
45 }
46 
TearDownTestCase()47 void ScreenSessionManagerProxyTest::TearDownTestCase()
48 {
49 }
50 
SetUp()51 void ScreenSessionManagerProxyTest::SetUp()
52 {
53 }
54 
TearDown()55 void ScreenSessionManagerProxyTest::TearDown()
56 {
57 }
58 
59 namespace {
60 /**
61  * @tc.name: SetPrivacyStateByDisplayId
62  * @tc.desc: SetPrivacyStateByDisplayId
63  * @tc.type: FUNC
64  */
65 HWTEST_F(ScreenSessionManagerProxyTest, SetPrivacyStateByDisplayId, Function | SmallTest | Level1)
66 {
67     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
68     DisplayId id = 0;
69     bool hasPrivate = false;
70 
71     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
72     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
73 
74     int resultValue = 0;
75     std::function<void()> func = [&]()
__anond5edba1b0202() 76     {
77         screenSessionManagerProxy->SetPrivacyStateByDisplayId(id, hasPrivate);
78         resultValue = 1;
79     };
80     func();
81     ASSERT_EQ(resultValue, 1);
82 }
83 
84 /**
85  * @tc.name: SetScreenPrivacyWindowList
86  * @tc.desc: SetScreenPrivacyWindowList
87  * @tc.type: FUNC
88  */
89 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenPrivacyWindowList, Function | SmallTest | Level1)
90 {
91     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
92     DisplayId id = 0;
93     std::vector<std::string> privacyWindowList{"win0", "win1"};
94 
95     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
96     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
97 
98     int resultValue = 0;
99     std::function<void()> func = [&]()
__anond5edba1b0302() 100     {
101         screenSessionManagerProxy->SetScreenPrivacyWindowList(id, privacyWindowList);
102         resultValue = 1;
103     };
104     func();
105     ASSERT_EQ(resultValue, 1);
106 }
107 
108 /**
109  * @tc.name: SetVirtualScreenBlackList
110  * @tc.desc: SetVirtualScreenBlackList
111  * @tc.type: FUNC
112  */
113 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualScreenBlackList, Function | SmallTest | Level1)
114 {
115     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
116     ScreenId id = 1001;
117     std::vector<uint64_t> windowIdList{10, 20, 30};
118 
119     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
120     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
121 
122     int resultValue = 0;
123     std::function<void()> func = [&]()
__anond5edba1b0402() 124     {
125         screenSessionManagerProxy->SetVirtualScreenBlackList(id, windowIdList);
126         resultValue = 1;
127     };
128     func();
129     ASSERT_EQ(resultValue, 1);
130 }
131 
132 /**
133  * @tc.name: GetAllDisplayPhysicalResolution
134  * @tc.desc: GetAllDisplayPhysicalResolution
135  * @tc.type: FUNC
136  */
137 HWTEST_F(ScreenSessionManagerProxyTest, GetAllDisplayPhysicalResolution, Function | SmallTest | Level1)
138 {
139     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
140     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
141     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
142 
143     std::vector<DisplayPhysicalResolution> allSize {};
144     std::function<void()> func = [&]()
__anond5edba1b0502() 145     {
146         allSize = screenSessionManagerProxy->GetAllDisplayPhysicalResolution();
147     };
148     func();
149     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
150         ASSERT_TRUE(!allSize.empty());
151     } else {
152         ASSERT_FALSE(!allSize.empty());
153     }
154 }
155 
156 /**
157  * @tc.name: GetDefaultDisplayInfo
158  * @tc.desc: GetDefaultDisplayInfo
159  * @tc.type: FUNC
160  */
161 HWTEST_F(ScreenSessionManagerProxyTest, GetDefaultDisplayInfo, Function | SmallTest | Level1)
162 {
163     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
164 
165     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
166     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
167 
168     sptr<DisplayInfo> expectation = nullptr;
169     sptr<DisplayInfo> res = nullptr;
170     std::function<void()> func = [&]()
__anond5edba1b0602() 171     {
172         res = screenSessionManagerProxy->GetDefaultDisplayInfo();
173     };
174     func();
175     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
176         ASSERT_NE(res, expectation);
177     } else {
178         ASSERT_EQ(res, expectation);
179     }
180 }
181 
182 /**
183  * @tc.name: SetScreenActiveMode
184  * @tc.desc: SetScreenActiveMode
185  * @tc.type: FUNC
186  */
187 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenActiveMode, Function | SmallTest | Level1)
188 {
189     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
190     ScreenId id = 1001;
191     uint32_t modeId = 1;
192 
193     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
194     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
195 
196 
197     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
198     std::function<void()> func = [&]()
__anond5edba1b0702() 199     {
200         res = screenSessionManagerProxy->SetScreenActiveMode(id, modeId);
201     };
202     func();
203     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
204         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
205     } else {
206         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
207     }
208 }
209 
210 /**
211  * @tc.name: SetVirtualPixelRatio
212  * @tc.desc: SetVirtualPixelRatio
213  * @tc.type: FUNC
214  */
215 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualPixelRatio, Function | SmallTest | Level1)
216 {
217     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
218     ScreenId id = 1001;
219     float virtualPixelRatio = 1.0;
220 
221     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
222     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
223 
224 
225     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
226     std::function<void()> func = [&]()
__anond5edba1b0802() 227     {
228         res = screenSessionManagerProxy->SetVirtualPixelRatio(id, virtualPixelRatio);
229     };
230     func();
231     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
232         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
233     } else {
234         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
235     }
236 }
237 
238 /**
239  * @tc.name: SetVirtualPixelRatioSystem
240  * @tc.desc: SetVirtualPixelRatioSystem
241  * @tc.type: FUNC
242  */
243 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualPixelRatioSystem, Function | SmallTest | Level1)
244 {
245     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
246     ScreenId id = 1001;
247     float virtualPixelRatio = 1.0;
248 
249     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
250     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
251 
252 
253     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
254     std::function<void()> func = [&]()
__anond5edba1b0902() 255     {
256         res = screenSessionManagerProxy->SetVirtualPixelRatioSystem(id, virtualPixelRatio);
257     };
258     func();
259     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
260         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
261     } else {
262         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
263     }
264 }
265 
266 /**
267  * @tc.name: SetResolution
268  * @tc.desc: SetResolution
269  * @tc.type: FUNC
270  */
271 HWTEST_F(ScreenSessionManagerProxyTest, SetResolution, Function | SmallTest | Level1)
272 {
273     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
274     ScreenId id = 1001;
275     uint32_t width = 1024;
276     uint32_t height = 1024;
277     float virtualPixelRatio = 1.0;
278 
279     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
280     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
281 
282 
283     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
284     std::function<void()> func = [&]()
__anond5edba1b0a02() 285     {
286         res = screenSessionManagerProxy->SetResolution(id, width, height, virtualPixelRatio);
287     };
288     func();
289     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
290         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
291     } else {
292         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
293     }
294 }
295 
296 /**
297  * @tc.name: GetDensityInCurResolution
298  * @tc.desc: GetDensityInCurResolution
299  * @tc.type: FUNC
300  */
301 HWTEST_F(ScreenSessionManagerProxyTest, GetDensityInCurResolution, Function | SmallTest | Level1)
302 {
303     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
304     ScreenId id = 1001;
305     float virtualPixelRatio = 1.0;
306 
307     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
308     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
309 
310 
311     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
312     std::function<void()> func = [&]()
__anond5edba1b0b02() 313     {
314         res = screenSessionManagerProxy->GetDensityInCurResolution(id, virtualPixelRatio);
315     };
316     func();
317     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
318         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
319     } else {
320         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
321     }
322 }
323 
324 /**
325  * @tc.name: GetScreenColorGamut
326  * @tc.desc: GetScreenColorGamut
327  * @tc.type: FUNC
328  */
329 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenColorGamut, Function | SmallTest | Level1)
330 {
331     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
332     ScreenId id = 1001;
333     ScreenColorGamut colorGamut {0};
334 
335     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
336     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
337 
338 
339     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
340     std::function<void()> func = [&]()
__anond5edba1b0c02() 341     {
342         res = screenSessionManagerProxy->GetScreenColorGamut(id, colorGamut);
343     };
344     func();
345     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
346         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
347     } else {
348         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
349     }
350 }
351 
352 /**
353  * @tc.name: SetScreenColorGamut
354  * @tc.desc: SetScreenColorGamut
355  * @tc.type: FUNC
356  */
357 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenColorGamut, Function | SmallTest | Level1)
358 {
359     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
360     ScreenId id = 1001;
361     uint32_t colorGamut = 0;
362 
363     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
364     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
365 
366 
367     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
368     std::function<void()> func = [&]()
__anond5edba1b0d02() 369     {
370         res = screenSessionManagerProxy->SetScreenColorGamut(id, colorGamut);
371     };
372     func();
373     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
374         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
375     } else {
376         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
377     }
378 }
379 
380 /**
381  * @tc.name: GetScreenGamutMap
382  * @tc.desc: GetScreenGamutMap
383  * @tc.type: FUNC
384  */
385 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenGamutMap, Function | SmallTest | Level1)
386 {
387     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
388     ScreenId id = 1001;
389     ScreenGamutMap colorGamut;
390 
391     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
392     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
393 
394 
395     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
396     std::function<void()> func = [&]()
__anond5edba1b0e02() 397     {
398         res = screenSessionManagerProxy->GetScreenGamutMap(id, colorGamut);
399     };
400     func();
401     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
402         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
403     } else {
404         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
405     }
406 }
407 
408 /**
409  * @tc.name: SetScreenGamutMap
410  * @tc.desc: SetScreenGamutMap
411  * @tc.type: FUNC
412  */
413 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenGamutMap, Function | SmallTest | Level1)
414 {
415     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
416     ScreenId id = 1001;
417     ScreenGamutMap colorGamut {0};
418 
419     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
420     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
421 
422 
423     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
424     std::function<void()> func = [&]()
__anond5edba1b0f02() 425     {
426         res = screenSessionManagerProxy->SetScreenGamutMap(id, colorGamut);
427     };
428     func();
429     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
430         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
431     } else {
432         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
433     }
434 }
435 
436 /**
437  * @tc.name: SetScreenColorTransform
438  * @tc.desc: SetScreenColorTransform
439  * @tc.type: FUNC
440  */
441 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenColorTransform, Function | SmallTest | Level1)
442 {
443     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
444     ScreenId id = 1001;
445 
446     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
447     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
448 
449 
450     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
451     std::function<void()> func = [&]()
__anond5edba1b1002() 452     {
453         res = screenSessionManagerProxy->SetScreenColorTransform(id);
454     };
455     func();
456     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
457         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
458     } else {
459         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
460     }
461 }
462 
463 /**
464  * @tc.name: GetPixelFormat
465  * @tc.desc: GetPixelFormat
466  * @tc.type: FUNC
467  */
468 HWTEST_F(ScreenSessionManagerProxyTest, GetPixelFormat, Function | SmallTest | Level1)
469 {
470     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
471     ScreenId id = 1001;
472     GraphicPixelFormat pixelFormat = GraphicPixelFormat {GRAPHIC_PIXEL_FMT_CLUT8};
473 
474     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
475     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
476 
477 
478     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
479     std::function<void()> func = [&]()
__anond5edba1b1102() 480     {
481         res = screenSessionManagerProxy->GetPixelFormat(id, pixelFormat);
482     };
483     func();
484     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
485         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
486     } else {
487         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
488     }
489 }
490 
491 /**
492  * @tc.name: SetPixelFormat
493  * @tc.desc: SetPixelFormat
494  * @tc.type: FUNC
495  */
496 HWTEST_F(ScreenSessionManagerProxyTest, SetPixelFormat, Function | SmallTest | Level1)
497 {
498     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
499     ScreenId id = 1001;
500     GraphicPixelFormat pixelFormat = GraphicPixelFormat {GRAPHIC_PIXEL_FMT_CLUT8};
501 
502     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
503     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
504 
505 
506     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
507     std::function<void()> func = [&]()
__anond5edba1b1202() 508     {
509         res = screenSessionManagerProxy->SetPixelFormat(id, pixelFormat);
510     };
511     func();
512     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
513         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
514     } else {
515         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
516     }
517 }
518 
519 /**
520  * @tc.name: GetSupportedHDRFormats
521  * @tc.desc: GetSupportedHDRFormats
522  * @tc.type: FUNC
523  */
524 HWTEST_F(ScreenSessionManagerProxyTest, GetSupportedHDRFormats, Function | SmallTest | Level1)
525 {
526     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
527     ScreenId id = 1001;
528     vector<ScreenHDRFormat> hdrFormats;
529 
530     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
531     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
532 
533 
534     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
535     std::function<void()> func = [&]()
__anond5edba1b1302() 536     {
537         res = screenSessionManagerProxy->GetSupportedHDRFormats(id, hdrFormats);
538     };
539     func();
540     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
541         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
542     } else {
543         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
544     }
545 }
546 
547 /**
548  * @tc.name: GetScreenHDRFormat
549  * @tc.desc: GetScreenHDRFormat
550  * @tc.type: FUNC
551  */
552 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenHDRFormat, Function | SmallTest | Level1)
553 {
554     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
555     ScreenId id = 1001;
556     ScreenHDRFormat hdrFormatS {0};
557 
558     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
559     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
560 
561 
562     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
563     std::function<void()> func = [&]()
__anond5edba1b1402() 564     {
565         res = screenSessionManagerProxy->GetScreenHDRFormat(id, hdrFormatS);
566     };
567     func();
568     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
569         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
570     } else {
571         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
572     }
573 }
574 
575 /**
576  * @tc.name: SetScreenHDRFormat
577  * @tc.desc: SetScreenHDRFormat
578  * @tc.type: FUNC
579  */
580 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenHDRFormat, Function | SmallTest | Level1)
581 {
582     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
583     ScreenId id = 1001;
584     ScreenHDRFormat hdrFormatS {0};
585 
586     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
587     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
588 
589 
590     DMError res = DMError::DM_ERROR_NOT_SYSTEM_APP;
591     std::function<void()> func = [&]()
__anond5edba1b1502() 592     {
593         res = screenSessionManagerProxy->SetScreenHDRFormat(id, hdrFormatS);
594     };
595     func();
596     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
597         ASSERT_NE(res, DMError::DM_ERROR_IPC_FAILED);
598     } else {
599         ASSERT_EQ(res, DMError::DM_ERROR_IPC_FAILED);
600     }
601 }
602 
603 /**
604  * @tc.name: RegisterDisplayManagerAgent
605  * @tc.desc: RegisterDisplayManagerAgent
606  * @tc.type: FUNC
607  */
608 HWTEST_F(ScreenSessionManagerProxyTest, RegisterDisplayManagerAgent, Function | SmallTest | Level1)
609 {
610     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
611     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
612     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
613     sptr<IDisplayManagerAgent> displayManagerAgent = new DisplayManagerAgentDefault();
614     DisplayManagerAgentType type = DisplayManagerAgentType::SCREEN_EVENT_LISTENER;
615     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
616         EXPECT_EQ(DMError::DM_OK, screenSessionManagerProxy->RegisterDisplayManagerAgent(displayManagerAgent, type));
617     } else {
618         EXPECT_NE(DMError::DM_OK, screenSessionManagerProxy->RegisterDisplayManagerAgent(displayManagerAgent, type));
619     }
620     displayManagerAgent = nullptr;
621     EXPECT_EQ(DMError::DM_ERROR_INVALID_PARAM,
622               screenSessionManagerProxy->RegisterDisplayManagerAgent(displayManagerAgent, type));
623 }
624 
625 /**
626  * @tc.name: UnregisterDisplayManagerAgent
627  * @tc.desc: UnregisterDisplayManagerAgent
628  * @tc.type: FUNC
629  */
630 HWTEST_F(ScreenSessionManagerProxyTest, UnregisterDisplayManagerAgent, Function | SmallTest | Level1)
631 {
632     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
633     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
634     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
635     sptr<IDisplayManagerAgent> displayManagerAgent = new DisplayManagerAgentDefault();
636     DisplayManagerAgentType type = DisplayManagerAgentType::SCREEN_EVENT_LISTENER;
637     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
638         EXPECT_EQ(DMError::DM_OK, screenSessionManagerProxy->UnregisterDisplayManagerAgent(displayManagerAgent, type));
639     } else {
640         EXPECT_NE(DMError::DM_OK, screenSessionManagerProxy->UnregisterDisplayManagerAgent(displayManagerAgent, type));
641     }
642     displayManagerAgent = nullptr;
643     EXPECT_EQ(DMError::DM_ERROR_INVALID_PARAM,
644               screenSessionManagerProxy->UnregisterDisplayManagerAgent(displayManagerAgent, type));
645 }
646 
647 /**
648  * @tc.name: WakeUpBegin
649  * @tc.desc: WakeUpBegin
650  * @tc.type: FUNC
651  */
652 HWTEST_F(ScreenSessionManagerProxyTest, WakeUpBegin, Function | SmallTest | Level1)
653 {
654     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
655     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
656     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
657 
658     PowerStateChangeReason reason {0};
659     bool expectation = true;
660     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
661         EXPECT_EQ(expectation, screenSessionManagerProxy->WakeUpBegin(reason));
662     } else {
663         EXPECT_NE(expectation, screenSessionManagerProxy->WakeUpBegin(reason));
664     }
665 }
666 
667 /**
668  * @tc.name: WakeUpEnd
669  * @tc.desc: WakeUpEnd
670  * @tc.type: FUNC
671  */
672 HWTEST_F(ScreenSessionManagerProxyTest, WakeUpEnd, Function | SmallTest | Level1)
673 {
674     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
675     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
676     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
677 
678     bool expectation = true;
679     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
680         EXPECT_EQ(expectation, screenSessionManagerProxy->WakeUpEnd());
681     } else {
682         EXPECT_NE(expectation, screenSessionManagerProxy->WakeUpEnd());
683     }
684 }
685 
686 /**
687  * @tc.name: SuspendEnd
688  * @tc.desc: SuspendEnd
689  * @tc.type: FUNC
690  */
691 HWTEST_F(ScreenSessionManagerProxyTest, SuspendEnd, Function | SmallTest | Level1)
692 {
693     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
694     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
695     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
696 
697     bool expectation = true;
698     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
699         EXPECT_EQ(expectation, screenSessionManagerProxy->SuspendEnd());
700     } else {
701         EXPECT_NE(expectation, screenSessionManagerProxy->SuspendEnd());
702     }
703 }
704 
705 /**
706  * @tc.name: SetDisplayState
707  * @tc.desc: SetDisplayState
708  * @tc.type: FUNC
709  */
710 HWTEST_F(ScreenSessionManagerProxyTest, SetDisplayState, Function | SmallTest | Level1)
711 {
712     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
713     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
714     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
715 
716     DisplayState state {1};
717     screenSessionManagerProxy->SetDisplayState(state);
718     int resultValue = 0;
719     ASSERT_EQ(resultValue, 0);
720 }
721 
722 /**
723  * @tc.name: SetSpecifiedScreenPower
724  * @tc.desc: SetSpecifiedScreenPower
725  * @tc.type: FUNC
726  */
727 HWTEST_F(ScreenSessionManagerProxyTest, SetSpecifiedScreenPower, Function | SmallTest | Level1)
728 {
729     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
730     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
731     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
732 
733     ScreenPowerState state {0};
734     ScreenId id = 1001;
735     PowerStateChangeReason reason {1};
736     bool expectation = true;
737     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
738         EXPECT_EQ(expectation, screenSessionManagerProxy->SetSpecifiedScreenPower(id, state, reason));
739     } else {
740         EXPECT_NE(expectation, screenSessionManagerProxy->SetSpecifiedScreenPower(id, state, reason));
741     }
742 }
743 
744 /**
745  * @tc.name: SetScreenPowerForAll
746  * @tc.desc: SetScreenPowerForAll
747  * @tc.type: FUNC
748  */
749 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenPowerForAll, Function | SmallTest | Level1)
750 {
751     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
752     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
753     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
754 
755     ScreenPowerState state {0};
756     PowerStateChangeReason reason {1};
757     bool expectation = true;
758     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
759         EXPECT_EQ(expectation, screenSessionManagerProxy->SetScreenPowerForAll(state, reason));
760     } else {
761         EXPECT_NE(expectation, screenSessionManagerProxy->SetScreenPowerForAll(state, reason));
762     }
763 }
764 
765 /**
766  * @tc.name: GetDisplayState
767  * @tc.desc: GetDisplayState
768  * @tc.type: FUNC
769  */
770 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplayState, 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     DisplayId displayId {0};
777     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
778         EXPECT_NE(DisplayState::UNKNOWN, screenSessionManagerProxy->GetDisplayState(displayId));
779     } else {
780         EXPECT_EQ(DisplayState::UNKNOWN, screenSessionManagerProxy->GetDisplayState(displayId));
781     }
782 }
783 
784 /**
785  * @tc.name: NotifyDisplayEvent
786  * @tc.desc: NotifyDisplayEvent
787  * @tc.type: FUNC
788  */
789 HWTEST_F(ScreenSessionManagerProxyTest, NotifyDisplayEvent, 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     DisplayEvent event {0};
796     int resultValue = 0;
797     std::function<void()> func = [&]()
__anond5edba1b1602() 798     {
799         screenSessionManagerProxy->NotifyDisplayEvent(event);
800         resultValue = 1;
801     };
802     func();
803     ASSERT_EQ(resultValue, 1);
804 }
805 
806 /**
807  * @tc.name: GetScreenPower
808  * @tc.desc: GetScreenPower
809  * @tc.type: FUNC
810  */
811 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenPower, Function | SmallTest | Level1)
812 {
813     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
814     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
815     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
816 
817     ScreenId dmsScreenId = 1001;
818     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
819         EXPECT_NE(ScreenPowerState::INVALID_STATE, screenSessionManagerProxy->GetScreenPower(dmsScreenId));
820     } else {
821         EXPECT_EQ(ScreenPowerState::INVALID_STATE, screenSessionManagerProxy->GetScreenPower(dmsScreenId));
822     }
823 }
824 
825 /**
826  * @tc.name: SetVirtualMirrorScreenCanvasRotation
827  * @tc.desc: SetVirtualMirrorScreenCanvasRotation
828  * @tc.type: FUNC
829  */
830 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualMirrorScreenCanvasRotation, Function | SmallTest | Level1)
831 {
832     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
833     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
834     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
835 
836     ScreenId ScreenId = 1001;
837     bool canvasRotation = true;
838     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
839         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
840             screenSessionManagerProxy->SetVirtualMirrorScreenCanvasRotation(ScreenId, canvasRotation));
841     } else {
842         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
843             screenSessionManagerProxy->SetVirtualMirrorScreenCanvasRotation(ScreenId, canvasRotation));
844     }
845 }
846 
847 /**
848  * @tc.name: SetVirtualMirrorScreenScaleMode
849  * @tc.desc: SetVirtualMirrorScreenScaleMode
850  * @tc.type: FUNC
851  */
852 HWTEST_F(ScreenSessionManagerProxyTest, SetVirtualMirrorScreenScaleMode, Function | SmallTest | Level1)
853 {
854     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
855     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
856     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
857 
858     ScreenId ScreenId = 1001;
859     ScreenScaleMode scaleMode {0};
860     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
861         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
862                 screenSessionManagerProxy->SetVirtualMirrorScreenScaleMode(ScreenId, scaleMode));
863     } else {
864         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
865                 screenSessionManagerProxy->SetVirtualMirrorScreenScaleMode(ScreenId, scaleMode));
866     }
867 }
868 
869 /**
870  * @tc.name: ResizeVirtualScreen
871  * @tc.desc: ResizeVirtualScreen
872  * @tc.type: FUNC
873  */
874 HWTEST_F(ScreenSessionManagerProxyTest, ResizeVirtualScreen, Function | SmallTest | Level1)
875 {
876     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
877     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
878     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
879 
880     ScreenId ScreenId = 1001;
881     uint32_t width = 1024;
882     uint32_t height = 1024;
883     EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
884               screenSessionManagerProxy->ResizeVirtualScreen(ScreenId, width, height));
885 }
886 
887 /**
888  * @tc.name: DestroyVirtualScreen
889  * @tc.desc: DestroyVirtualScreen
890  * @tc.type: FUNC
891  */
892 HWTEST_F(ScreenSessionManagerProxyTest, DestroyVirtualScreen, Function | SmallTest | Level1)
893 {
894     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
895     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
896     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
897 
898     ScreenId ScreenId = 1001;
899     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
900         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
901                 screenSessionManagerProxy->DestroyVirtualScreen(ScreenId));
902     } else {
903         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
904                 screenSessionManagerProxy->DestroyVirtualScreen(ScreenId));
905     }
906 }
907 
908 /**
909  * @tc.name: MakeMirror
910  * @tc.desc: MakeMirror
911  * @tc.type: FUNC
912  */
913 HWTEST_F(ScreenSessionManagerProxyTest, MakeMirror, Function | SmallTest | Level1)
914 {
915     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
916     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
917     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
918 
919     ScreenId Id = 1001;
920     std::vector<ScreenId> mirrorScreenIds = {1003, 1004, 1005};
921     ScreenId screenGroupId = 1002;
922     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
923         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
924                 screenSessionManagerProxy->MakeMirror(Id, mirrorScreenIds, screenGroupId));
925     } else {
926         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
927                 screenSessionManagerProxy->MakeMirror(Id, mirrorScreenIds, screenGroupId));
928     }
929 }
930 
931 /**
932  * @tc.name: StopMirror
933  * @tc.desc: StopMirror
934  * @tc.type: FUNC
935  */
936 HWTEST_F(ScreenSessionManagerProxyTest, StopMirror, Function | SmallTest | Level1)
937 {
938     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
939     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
940     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
941 
942     const std::vector<ScreenId> mirrorScreenIds = {1003, 1004, 1005};
943     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
944         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
945                 screenSessionManagerProxy->StopMirror(mirrorScreenIds));
946     } else {
947         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
948                 screenSessionManagerProxy->StopMirror(mirrorScreenIds));
949     }
950 }
951 
952 /**
953  * @tc.name: DisableMirror
954  * @tc.desc: DisableMirror
955  * @tc.type: FUNC
956  */
957 HWTEST_F(ScreenSessionManagerProxyTest, DisableMirror, Function | SmallTest | Level1)
958 {
959     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
960     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
961     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
962 
963     bool disableOrNot = true;
964     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
965         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
966                 screenSessionManagerProxy->DisableMirror(disableOrNot));
967     } else {
968         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
969                 screenSessionManagerProxy->DisableMirror(disableOrNot));
970     }
971 }
972 
973 /**
974  * @tc.name: MakeExpand
975  * @tc.desc: MakeExpand
976  * @tc.type: FUNC
977  */
978 HWTEST_F(ScreenSessionManagerProxyTest, MakeExpand, Function | SmallTest | Level1)
979 {
980     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
981     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
982     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
983 
984     std::vector<ScreenId> screenId = {1003, 1004, 1005};
985     std::vector<Point> startPoint {};
986     ScreenId screenGroupId = 1001;
987     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
988         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
989                 screenSessionManagerProxy->MakeExpand(screenId, startPoint, screenGroupId));
990     } else {
991         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
992                 screenSessionManagerProxy->MakeExpand(screenId, startPoint, screenGroupId));
993     }
994 }
995 
996 /**
997  * @tc.name: StopExpand
998  * @tc.desc: StopExpand
999  * @tc.type: FUNC
1000  */
1001 HWTEST_F(ScreenSessionManagerProxyTest, StopExpand, Function | SmallTest | Level1)
1002 {
1003     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1004     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1005     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1006 
1007     const std::vector<ScreenId> expandScreenIds = {1003, 1004, 1005};
1008     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1009         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1010                 screenSessionManagerProxy->StopExpand(expandScreenIds));
1011     } else {
1012         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1013                 screenSessionManagerProxy->StopExpand(expandScreenIds));
1014     }
1015 }
1016 
1017 /**
1018  * @tc.name: GetScreenGroupInfoById
1019  * @tc.desc: GetScreenGroupInfoById
1020  * @tc.type: FUNC
1021  */
1022 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenGroupInfoById, Function | SmallTest | Level1)
1023 {
1024     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1025 
1026     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1027     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1028 
1029     sptr<ScreenGroupInfo> expectation = nullptr;
1030     sptr<ScreenGroupInfo> res = nullptr;
1031     ScreenId Id {0};
1032     std::function<void()> func = [&]()
__anond5edba1b1702() 1033     {
1034         res = screenSessionManagerProxy->GetScreenGroupInfoById(Id);
1035     };
1036     func();
1037     ASSERT_EQ(res, expectation);
1038 }
1039 
1040 /**
1041  * @tc.name: RemoveVirtualScreenFromGroup
1042  * @tc.desc: RemoveVirtualScreenFromGroup
1043  * @tc.type: FUNC
1044  */
1045 HWTEST_F(ScreenSessionManagerProxyTest, RemoveVirtualScreenFromGroup, Function | SmallTest | Level1)
1046 {
1047     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1048 
1049     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1050     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1051 
1052     int resultValue = 0;
1053     std::vector<ScreenId> screens = {1002, 1003, 1004};
1054     std::function<void()> func = [&]()
__anond5edba1b1802() 1055     {
1056         screenSessionManagerProxy->RemoveVirtualScreenFromGroup(screens);
1057         resultValue = 1;
1058     };
1059     func();
1060     EXPECT_EQ(resultValue, 1);
1061 }
1062 
1063 /**
1064  * @tc.name: GetDisplaySnapshot
1065  * @tc.desc: GetDisplaySnapshot
1066  * @tc.type: FUNC
1067  */
1068 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplaySnapshot, Function | SmallTest | Level1)
1069 {
1070     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1071 
1072     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1073     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1074 
1075     std::shared_ptr<Media::PixelMap> expectation = nullptr;
1076     std::shared_ptr<Media::PixelMap> res = nullptr;
1077     DisplayId displayId {0};
1078     DmErrorCode* errorCode = nullptr;
1079     std::function<void()> func = [&]()
__anond5edba1b1902() 1080     {
1081         res = screenSessionManagerProxy->GetDisplaySnapshot(displayId, errorCode, false);
1082     };
1083     func();
1084     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1085         ASSERT_NE(res, expectation);
1086     } else {
1087         ASSERT_EQ(res, expectation);
1088     }
1089 }
1090 
1091 /**
1092  * @tc.name: GetDisplayInfoById
1093  * @tc.desc: GetDisplayInfoById
1094  * @tc.type: FUNC
1095  */
1096 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplayInfoById, Function | SmallTest | Level1)
1097 {
1098     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1099 
1100     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1101     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1102 
1103     sptr<DisplayInfo> expectation = nullptr;
1104     sptr<DisplayInfo> res = nullptr;
1105     DisplayId displayId {0};
1106     std::function<void()> func = [&]()
__anond5edba1b1a02() 1107     {
1108         res = screenSessionManagerProxy->GetDisplayInfoById(displayId);
1109     };
1110     func();
1111     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1112         ASSERT_NE(res, expectation);
1113     } else {
1114         ASSERT_EQ(res, expectation);
1115     }
1116 }
1117 
1118 /**
1119  * @tc.name: GetDisplayInfoByScreen
1120  * @tc.desc: GetDisplayInfoByScreen
1121  * @tc.type: FUNC
1122  */
1123 HWTEST_F(ScreenSessionManagerProxyTest, GetDisplayInfoByScreen, Function | SmallTest | Level1)
1124 {
1125     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1126 
1127     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1128     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1129 
1130     sptr<DisplayInfo> expectation = nullptr;
1131     sptr<DisplayInfo> res = nullptr;
1132     ScreenId screenId {0};
1133     std::function<void()> func = [&]()
__anond5edba1b1b02() 1134     {
1135         res = screenSessionManagerProxy->GetDisplayInfoByScreen(screenId);
1136     };
1137     func();
1138     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1139         ASSERT_NE(res, expectation);
1140     } else {
1141         ASSERT_EQ(res, expectation);
1142     }
1143 }
1144 
1145 /**
1146  * @tc.name: GetAllDisplayIds
1147  * @tc.desc: GetAllDisplayIds
1148  * @tc.type: FUNC
1149  */
1150 HWTEST_F(ScreenSessionManagerProxyTest, GetAllDisplayIds, Function | SmallTest | Level1)
1151 {
1152     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1153 
1154     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1155     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1156 
1157     int resultValue = 0;
1158     std::function<void()> func = [&]()
__anond5edba1b1c02() 1159     {
1160         screenSessionManagerProxy->GetAllDisplayIds();
1161         resultValue = 1;
1162     };
1163     func();
1164     ASSERT_EQ(resultValue, 1);
1165 }
1166 
1167 /**
1168  * @tc.name: GetScreenInfoById
1169  * @tc.desc: GetScreenInfoById
1170  * @tc.type: FUNC
1171  */
1172 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenInfoById, Function | SmallTest | Level1)
1173 {
1174     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1175 
1176     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1177     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1178 
1179     sptr<ScreenInfo> expectation = nullptr;
1180     sptr<ScreenInfo> res = nullptr;
1181     ScreenId Id {0};
1182     std::function<void()> func = [&]()
__anond5edba1b1d02() 1183     {
1184         res = screenSessionManagerProxy->GetScreenInfoById(Id);
1185     };
1186     func();
1187     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1188         ASSERT_NE(res, expectation);
1189     } else {
1190         ASSERT_EQ(res, expectation);
1191     }
1192 }
1193 
1194 /**
1195  * @tc.name: GetAllScreenInfos
1196  * @tc.desc: GetAllScreenInfos
1197  * @tc.type: FUNC
1198  */
1199 HWTEST_F(ScreenSessionManagerProxyTest, GetAllScreenInfos, Function | SmallTest | Level1)
1200 {
1201     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1202     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1203     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1204 
1205     std::vector<sptr<ScreenInfo>> screenInfos {};
1206     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1207         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1208                 screenSessionManagerProxy->GetAllScreenInfos(screenInfos));
1209     } else {
1210         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1211                 screenSessionManagerProxy->GetAllScreenInfos(screenInfos));
1212     }
1213 }
1214 
1215 /**
1216  * @tc.name: GetScreenSupportedColorGamuts
1217  * @tc.desc: GetScreenSupportedColorGamuts
1218  * @tc.type: FUNC
1219  */
1220 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenSupportedColorGamuts, Function | SmallTest | Level1)
1221 {
1222     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1223     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1224     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1225 
1226     ScreenId screenId = 1001;
1227     std::vector<ScreenColorGamut> colorGamuts {};
1228     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1229         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1230                 screenSessionManagerProxy->GetScreenSupportedColorGamuts(screenId, colorGamuts));
1231     } else {
1232         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1233                 screenSessionManagerProxy->GetScreenSupportedColorGamuts(screenId, colorGamuts));
1234     }
1235 }
1236 
1237 /**
1238  * @tc.name: SetOrientation
1239  * @tc.desc: SetOrientation
1240  * @tc.type: FUNC
1241  */
1242 HWTEST_F(ScreenSessionManagerProxyTest, SetOrientation, Function | SmallTest | Level1)
1243 {
1244     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1245     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1246     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1247 
1248     ScreenId screenId = 1001;
1249     Orientation orientation = Orientation::BEGIN;
1250     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1251         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1252                 screenSessionManagerProxy->SetOrientation(screenId, orientation));
1253     } else {
1254         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1255                 screenSessionManagerProxy->SetOrientation(screenId, orientation));
1256     }
1257 }
1258 
1259 /**
1260  * @tc.name: SetScreenRotationLocked
1261  * @tc.desc: SetScreenRotationLocked
1262  * @tc.type: FUNC
1263  */
1264 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenRotationLocked, Function | SmallTest | Level1)
1265 {
1266     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1267     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1268     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1269 
1270     bool isLocked = true;
1271     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1272         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1273                 screenSessionManagerProxy->SetScreenRotationLocked(isLocked));
1274     } else {
1275         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1276                 screenSessionManagerProxy->SetScreenRotationLocked(isLocked));
1277     }
1278 }
1279 
1280 /**
1281  * @tc.name: SetScreenRotationLockedFromJs
1282  * @tc.desc: SetScreenRotationLockedFromJs
1283  * @tc.type: FUNC
1284  */
1285 HWTEST_F(ScreenSessionManagerProxyTest, SetScreenRotationLockedFromJs, Function | SmallTest | Level1)
1286 {
1287     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1288     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1289     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1290 
1291     bool isLocked = true;
1292     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1293         ASSERT_NE(DMError::DM_ERROR_IPC_FAILED,
1294                 screenSessionManagerProxy->SetScreenRotationLockedFromJs(isLocked));
1295     } else {
1296         ASSERT_EQ(DMError::DM_ERROR_IPC_FAILED,
1297                 screenSessionManagerProxy->SetScreenRotationLockedFromJs(isLocked));
1298     }
1299 }
1300 
1301 /**
1302  * @tc.name: IsScreenRotationLocked
1303  * @tc.desc: IsScreenRotationLocked
1304  * @tc.type: FUNC
1305  */
1306 HWTEST_F(ScreenSessionManagerProxyTest, IsScreenRotationLocked, Function | SmallTest | Level1)
1307 {
1308     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1309     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1310     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1311 
1312     bool isLocked = true;
1313     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1314         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1315                 screenSessionManagerProxy->IsScreenRotationLocked(isLocked));
1316     } else {
1317         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1318                 screenSessionManagerProxy->IsScreenRotationLocked(isLocked));
1319     }
1320 }
1321 
1322 /**
1323  * @tc.name: GetCutoutInfo
1324  * @tc.desc: GetCutoutInfo
1325  * @tc.type: FUNC
1326  */
1327 HWTEST_F(ScreenSessionManagerProxyTest, GetCutoutInfo, Function | SmallTest | Level1)
1328 {
1329     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1330 
1331     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1332     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1333 
1334     sptr<CutoutInfo> expectation = nullptr;
1335     sptr<CutoutInfo> res = nullptr;
1336     DisplayId displayId = 0;
1337     std::function<void()> func = [&]()
__anond5edba1b1e02() 1338     {
1339         res = screenSessionManagerProxy->GetCutoutInfo(displayId);
1340     };
1341     func();
1342     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1343         ASSERT_NE(res, expectation);
1344     } else {
1345         ASSERT_EQ(res, expectation);
1346     }
1347 }
1348 
1349 /**
1350  * @tc.name: HasImmersiveWindow
1351  * @tc.desc: HasImmersiveWindow
1352  * @tc.type: FUNC
1353  */
1354 HWTEST_F(ScreenSessionManagerProxyTest, HasImmersiveWindow, Function | SmallTest | Level1)
1355 {
1356     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1357     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1358     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1359 
1360     bool immersive = true;
1361     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1362         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1363                 screenSessionManagerProxy->HasImmersiveWindow(immersive));
1364     } else {
1365         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1366                 screenSessionManagerProxy->HasImmersiveWindow(immersive));
1367     }
1368 }
1369 
1370 /**
1371  * @tc.name: ConvertScreenIdToRsScreenId
1372  * @tc.desc: ConvertScreenIdToRsScreenId
1373  * @tc.type: FUNC
1374  */
1375 HWTEST_F(ScreenSessionManagerProxyTest, ConvertScreenIdToRsScreenId, Function | SmallTest | Level1)
1376 {
1377     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1378     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1379     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1380 
1381     int resultValue = 0;
1382     ScreenId screenId = 1001;
1383     ScreenId rsScreenId = 1002;
1384     std::function<void()> func = [&]()
__anond5edba1b1f02() 1385     {
1386         screenSessionManagerProxy->ConvertScreenIdToRsScreenId(screenId, rsScreenId);
1387         resultValue = 1;
1388     };
1389     func();
1390     EXPECT_EQ(resultValue, 1);
1391 }
1392 
1393 /**
1394  * @tc.name: HasPrivateWindow
1395  * @tc.desc: HasPrivateWindow
1396  * @tc.type: FUNC
1397  */
1398 HWTEST_F(ScreenSessionManagerProxyTest, HasPrivateWindow, Function | SmallTest | Level1)
1399 {
1400     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1401     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1402     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1403 
1404     bool hasPrivateWindow = true;
1405     DisplayId displayId = 0;
1406     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1407         EXPECT_NE(DMError::DM_ERROR_IPC_FAILED,
1408                 screenSessionManagerProxy->HasPrivateWindow(displayId, hasPrivateWindow));
1409     } else {
1410         EXPECT_EQ(DMError::DM_ERROR_IPC_FAILED,
1411                 screenSessionManagerProxy->HasPrivateWindow(displayId, hasPrivateWindow));
1412     }
1413 }
1414 
1415 /**
1416  * @tc.name: DumpAllScreensInfo
1417  * @tc.desc: DumpAllScreensInfo
1418  * @tc.type: FUNC
1419  */
1420 HWTEST_F(ScreenSessionManagerProxyTest, DumpAllScreensInfo, Function | SmallTest | Level1)
1421 {
1422     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1423     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1424     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1425 
1426     int resultValue = 0;
1427     std::string dumpInfo;
1428     std::function<void()> func = [&]()
__anond5edba1b2002() 1429     {
1430         screenSessionManagerProxy->DumpAllScreensInfo(dumpInfo);
1431         resultValue = 1;
1432     };
1433     func();
1434     EXPECT_EQ(resultValue, 1);
1435 }
1436 
1437 /**
1438  * @tc.name: DumpSpecialScreenInfo
1439  * @tc.desc: DumpSpecialScreenInfo
1440  * @tc.type: FUNC
1441  */
1442 HWTEST_F(ScreenSessionManagerProxyTest, DumpSpecialScreenInfo, Function | SmallTest | Level1)
1443 {
1444     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1445     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1446     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1447 
1448     int resultValue = 0;
1449     ScreenId id = 1001;
1450     std::string dumpInfo;
1451     std::function<void()> func = [&]()
__anond5edba1b2102() 1452     {
1453         screenSessionManagerProxy->DumpSpecialScreenInfo(id, dumpInfo);
1454         resultValue = 1;
1455     };
1456     func();
1457     EXPECT_EQ(resultValue, 1);
1458 }
1459 
1460 /**
1461  * @tc.name: SetFoldDisplayMode
1462  * @tc.desc: SetFoldDisplayMode
1463  * @tc.type: FUNC
1464  */
1465 HWTEST_F(ScreenSessionManagerProxyTest, SetFoldDisplayMode, Function | SmallTest | Level1)
1466 {
1467     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1468     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1469     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1470 
1471     int resultValue = 0;
1472     const FoldDisplayMode displayMode {0};
1473     std::function<void()> func = [&]()
__anond5edba1b2202() 1474     {
1475         screenSessionManagerProxy->SetFoldDisplayMode(displayMode);
1476         resultValue = 1;
1477     };
1478     func();
1479     EXPECT_EQ(resultValue, 1);
1480 }
1481 
1482 /**
1483  * @tc.name: SetFoldStatusLocked
1484  * @tc.desc: SetFoldStatusLocked
1485  * @tc.type: FUNC
1486  */
1487 HWTEST_F(ScreenSessionManagerProxyTest, SetFoldStatusLocked, Function | SmallTest | Level1)
1488 {
1489     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1490     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1491     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1492 
1493     int resultValue = 0;
1494     bool locked = true;
1495     std::function<void()> func = [&]()
__anond5edba1b2302() 1496     {
1497         screenSessionManagerProxy->SetFoldStatusLocked(locked);
1498         resultValue = 1;
1499     };
1500     func();
1501     EXPECT_EQ(resultValue, 1);
1502 }
1503 
1504 /**
1505  * @tc.name: GetFoldDisplayMode
1506  * @tc.desc: GetFoldDisplayMode
1507  * @tc.type: FUNC
1508  */
1509 HWTEST_F(ScreenSessionManagerProxyTest, GetFoldDisplayMode, Function | SmallTest | Level1)
1510 {
1511     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1512     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1513     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1514 
1515     EXPECT_EQ(FoldDisplayMode::UNKNOWN,
1516               screenSessionManagerProxy->GetFoldDisplayMode());
1517 }
1518 
1519 /**
1520  * @tc.name: IsFoldable
1521  * @tc.desc: IsFoldable
1522  * @tc.type: FUNC
1523  */
1524 HWTEST_F(ScreenSessionManagerProxyTest, IsFoldable, Function | SmallTest | Level1)
1525 {
1526     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1527     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1528     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1529 
1530     int resultValue = 0;
1531     std::function<void()> func = [&]()
__anond5edba1b2402() 1532     {
1533         screenSessionManagerProxy->IsFoldable();
1534         resultValue = 1;
1535     };
1536     func();
1537     EXPECT_EQ(resultValue, 1);
1538 }
1539 
1540 /**
1541  * @tc.name: IsCaptured
1542  * @tc.desc: IsCaptured
1543  * @tc.type: FUNC
1544  */
1545 HWTEST_F(ScreenSessionManagerProxyTest, IsCaptured, 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     int resultValue = 0;
1552     std::function<void()> func = [&]()
__anond5edba1b2502() 1553     {
1554         screenSessionManagerProxy->IsCaptured();
1555         resultValue = 1;
1556     };
1557     func();
1558     EXPECT_EQ(resultValue, 1);
1559 }
1560 
1561 /**
1562  * @tc.name: GetFoldStatus
1563  * @tc.desc: GetFoldStatus
1564  * @tc.type: FUNC
1565  */
1566 HWTEST_F(ScreenSessionManagerProxyTest, GetFoldStatus, Function | SmallTest | Level1)
1567 {
1568     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1569     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1570     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1571     ASSERT_NE(screenSessionManagerProxy, nullptr);
1572     screenSessionManagerProxy->GetFoldStatus();
1573 }
1574 
1575 /**
1576  * @tc.name: GetCurrentFoldCreaseRegion
1577  * @tc.desc: GetCurrentFoldCreaseRegion
1578  * @tc.type: FUNC
1579  */
1580 HWTEST_F(ScreenSessionManagerProxyTest, GetCurrentFoldCreaseRegion, Function | SmallTest | Level1)
1581 {
1582     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1583 
1584     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1585     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1586     ASSERT_NE(screenSessionManagerProxy, nullptr);
1587 
1588     screenSessionManagerProxy->GetCurrentFoldCreaseRegion();
1589 }
1590 
1591 /**
1592  * @tc.name: MakeUniqueScreen
1593  * @tc.desc: MakeUniqueScreen
1594  * @tc.type: FUNC
1595  */
1596 HWTEST_F(ScreenSessionManagerProxyTest, MakeUniqueScreen, Function | SmallTest | Level1)
1597 {
1598     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1599     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1600     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1601 
1602     const std::vector<ScreenId> screenIds {1001, 1002, 1003};
1603     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1604         EXPECT_NE(DMError::DM_ERROR_NULLPTR,
1605             screenSessionManagerProxy->MakeUniqueScreen(screenIds));
1606     } else {
1607         EXPECT_EQ(DMError::DM_ERROR_NULLPTR,
1608             screenSessionManagerProxy->MakeUniqueScreen(screenIds));
1609     }
1610 }
1611 
1612 /**
1613  * @tc.name: SetClient
1614  * @tc.desc: SetClient
1615  * @tc.type: FUNC
1616  */
1617 HWTEST_F(ScreenSessionManagerProxyTest, SetClient, Function | SmallTest | Level1)
1618 {
1619     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1620     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1621     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1622 
1623     int resultValue = 0;
1624     const sptr<IScreenSessionManagerClient> client = nullptr;
1625     std::function<void()> func = [&]()
__anond5edba1b2602() 1626     {
1627         screenSessionManagerProxy->SetClient(client);
1628         resultValue = 1;
1629     };
1630     func();
1631     EXPECT_EQ(resultValue, 1);
1632 }
1633 
1634 /**
1635  * @tc.name: SwitchUser
1636  * @tc.desc: SwitchUser
1637  * @tc.type: FUNC
1638  */
1639 HWTEST_F(ScreenSessionManagerProxyTest, SwitchUser, Function | SmallTest | Level1)
1640 {
1641     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1642     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1643     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1644 
1645     int resultValue = 0;
1646     std::function<void()> func = [&]()
__anond5edba1b2702() 1647     {
1648         screenSessionManagerProxy->SwitchUser();
1649         resultValue = 1;
1650     };
1651     func();
1652     EXPECT_EQ(resultValue, 1);
1653 }
1654 
1655 /**
1656  * @tc.name: GetScreenProperty
1657  * @tc.desc: GetScreenProperty
1658  * @tc.type: FUNC
1659  */
1660 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenProperty, Function | SmallTest | Level1)
1661 {
1662     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1663     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1664     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1665 
1666     int resultValue = 0;
1667     ScreenId screenId = 1001;
1668     std::function<void()> func = [&]()
__anond5edba1b2802() 1669     {
1670         screenSessionManagerProxy->GetScreenProperty(screenId);
1671         resultValue = 1;
1672     };
1673     func();
1674     EXPECT_EQ(resultValue, 1);
1675 }
1676 
1677 /**
1678  * @tc.name: GetScreenCapture
1679  * @tc.desc: GetScreenCapture test
1680  * @tc.type: FUNC
1681  */
1682 HWTEST_F(ScreenSessionManagerProxyTest, GetScreenCapture, Function | SmallTest | Level1)
1683 {
1684     SingletonContainer::Get<ScreenManagerAdapter>().InitDMSProxy();
1685     sptr<IRemoteObject> impl = SingletonContainer::Get<ScreenManagerAdapter>().displayManagerServiceProxy_->AsObject();
1686     sptr<ScreenSessionManagerProxy> screenSessionManagerProxy = new ScreenSessionManagerProxy(impl);
1687     ASSERT_TRUE(screenSessionManagerProxy != nullptr);
1688 
1689     std::shared_ptr<Media::PixelMap> res = nullptr;
1690     CaptureOption option;
1691     option.displayId_ = 0;
1692     DmErrorCode* errorCode = nullptr;
__anond5edba1b2902() 1693     std::function<void()> func = [&]() {
1694         res = screenSessionManagerProxy->GetScreenCapture(option, errorCode);
1695     };
1696     func();
1697     if (SceneBoardJudgement::IsSceneBoardEnabled()) {
1698         ASSERT_NE(res, nullptr);
1699     } else {
1700         ASSERT_EQ(res, nullptr);
1701     }
1702 }
1703 }
1704 }
1705 }