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