1 /*
2 * Copyright (c) 2022-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 "decoder_demo.h"
18 #include "nativetoken_kit.h"
19 #include "token_setproc.h"
20 #include "softbus_common.h"
21 #include "accesstoken_kit.h"
22
23 #include "if_system_ability_manager.h"
24 #include "iservice_registry.h"
25
26 using namespace testing::ext;
27 using namespace OHOS::DistributedHardware;
28 using namespace OHOS::Security::AccessToken;
29
30 int32_t g_dSreenOk = 0;
31 int32_t g_dSleepOk = 1;
32 static constexpr int32_t DEFAULT_API_VERSION = 8;
33
34 static PermissionStateFull g_testState = {
35 .permissionName = "ohos.permission.CAMERA",
36 .isGeneral = true,
37 .resDeviceID = {"local"},
38 .grantStatus = {PermissionState::PERMISSION_GRANTED},
39 .grantFlags = {1}
40 };
41
42 static HapPolicyParams g_PolicyPramsl = {
43 .apl = APL_NORMAL,
44 .domain = "test.domain.A",
45 .permList = {},
46 .permStateList = {g_testState}
47 };
48
49
50 class DSreenAutomatTest : public testing::Test {
51 public:
52 static void SetUpTestCase(void);
53 static void TearDownTestCase(void);
54 void SetUp();
55 void TearDown();
56 DSreenAutomatTest();
57 };
SetUpTestCase(void)58 void DSreenAutomatTest::SetUpTestCase(void)
59 {
60 HapInfoParams info = {
61 .userID = 1,
62 .bundleName = "DctsdisScreenTest",
63 .instIndex = 0,
64 .appIDDesc = "testtesttesttest",
65 .apiVersion = DEFAULT_API_VERSION,
66 .isSystemApp = true
67 };
68 AccessTokenIDEx tokenIdEx = {0};
69 tokenIdEx = AccessTokenKit::AllocHapToken(info, g_PolicyPramsl);
70 SetSelfTokenID(tokenIdEx.tokenIDEx);
71 sleep(g_dSleepOk);
72 }
73
TearDownTestCase(void)74 void DSreenAutomatTest::TearDownTestCase(void) {}
SetUp(void)75 void DSreenAutomatTest::SetUp(void) {}
76
TearDown(void)77 void DSreenAutomatTest::TearDown(void) {}
DSreenAutomatTest(void)78 DSreenAutomatTest::DSreenAutomatTest(void) {}
79
80 /**
81 * @tc.number : SUB_DH_Dscreen_Dcts_0100
82 * @tc.name :StartMirror()
83 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
84 * @tc.desc : The distributed screen starts mirroring the screen
85 * @tc.type : FUNC
86 * @tc.size : Medium test
87 */
88 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0100, TestSize.Level1)
89 {
90 int res = SaTest();
91 if (res == 1) {
92 return;
93 }
94 int ret = StartMirror(0);
95 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
96 }
97
98 /**
99 * @tc.number : SUB_DH_Dscreen_Dcts_0200
100 * @tc.name :StopMirror()
101 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
102 * @tc.desc : The distributed screen stops the image projection
103 * @tc.type : FUNC
104 * @tc.size : Medium test
105 */
106 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0200, TestSize.Level1)
107 {
108 int res = SaTest();
109 if (res == 1) {
110 return;
111 }
112 int ret = StopMirror(0);
113 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
114 }
115
116 /**
117 * @tc.number : SUB_DH_Dscreen_Dcts_0300
118 * @tc.name :StartExpand()
119 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
120 * @tc.desc : Distributed screens begin to expand the projection
121 * @tc.type : FUNC
122 * @tc.size : Medium test
123 */
124 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0300, TestSize.Level1)
125 {
126 int res = SaTest();
127 if (res == 1) {
128 return;
129 }
130 int ret = StartExpand(0);
131 EXPECT_EQ(g_dSreenOk, ret) << "StartExpand fail";
132 }
133
134 /**
135 * @tc.number : SUB_DH_Dscreen_Dcts_0400
136 * @tc.name :StopExpand()
137 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
138 * @tc.desc : The distributed screen stops extending the projection
139 * @tc.type : FUNC
140 * @tc.size : Medium test
141 */
142 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0400, TestSize.Level1)
143 {
144 int res = SaTest();
145 if (res == 1) {
146 return;
147 }
148 int ret = StopExpand(0);
149 EXPECT_EQ(g_dSreenOk, ret) << "StopExpand fail";
150 }
151
152 /**
153 * @tc.number : SUB_DH_Dscreen_Dcts_0500
154 * @tc.name :CreateWindow()
155 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
156 * @tc.desc : Distributed screen Creates a small window on the remote device
157 * @tc.type : FUNC
158 * @tc.size : Medium test
159 */
160 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0500, TestSize.Level1)
161 {
162 int res = SaTest();
163 if (res == 1) {
164 return;
165 }
166 int ret = CreateWindow(0);
167 EXPECT_EQ(g_dSreenOk, ret) << "CreateWindow fail";
168 }
169
170 /**
171 * @tc.number : SUB_DH_Dscreen_Dcts_0600
172 * @tc.name :QueryRemoteDeviceInfo()
173 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
174 * @tc.desc : Distributed screen Displays information about remote devices
175 * @tc.type : FUNC
176 * @tc.size : Medium test
177 */
178 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0600, TestSize.Level1)
179 {
180 int res = SaTest();
181 if (res == 1) {
182 return;
183 }
184 int ret = QueryRemoteDeviceInfo(0);
185 EXPECT_EQ(g_dSreenOk, ret) << "QueryRemoteDeviceInfo fail";
186 }
187
188 /**
189 * @tc.number : SUB_DH_Dscreen_Dcts_0700
190 * @tc.name :QueryRemoteScreenInfo()
191 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
192 * @tc.desc : Distributed screen Displays information about remote screens
193 * @tc.type : FUNC
194 * @tc.size : Medium test
195 */
196 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0700, TestSize.Level1)
197 {
198 int res = SaTest();
199 if (res == 1) {
200 return;
201 }
202 int ret = QueryRemoteScreenInfo(0);
203 EXPECT_EQ(g_dSreenOk, ret) << "QueryRemoteScreenInfo fail";
204 }
205
206 /**
207 * @tc.number : SUB_DH_Dscreen_Dcts_0800
208 * @tc.name :Call the start image projection and stop image projection to check whether it succeeds
209 * @tc.desc : Composite test function
210 * @tc.type : FUNC
211 * @tc.size : Medium test
212 */
213 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0800, TestSize.Level1)
214 {
215 int res = SaTest();
216 if (res == 1) {
217 return;
218 }
219 int ret = StartMirror(0);
220 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
221 ret = StopMirror(0);
222 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
223 }
224
225 /**
226 * @tc.number : SUB_DH_Dscreen_Dcts_0900
227 * @tc.name :Call to start and stop the extended projection to see if it is successful
228 * @tc.desc : Composite test function
229 * @tc.type : FUNC
230 * @tc.size : Medium test
231 */
232 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_0900, TestSize.Level1)
233 {
234 int res = SaTest();
235 if (res == 1) {
236 return;
237 }
238 int ret = StartExpand(0);
239 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
240 ret = StopExpand(0);
241 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
242 }
243
244 /**
245 * @tc.number : SUB_DH_Dscreen_Dcts_1000
246 * @tc.name :Scramble the method invocation order to see if the method invocation fails
247 * @tc.desc : Composite test function
248 * @tc.type : FUNC
249 * @tc.size : Medium test
250 */
251 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1000, TestSize.Level1)
252 {
253 int res = SaTest();
254 if (res == 1) {
255 return;
256 }
257 int ret = StartMirror(0);
258 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
259 ret = StopMirror(0);
260 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
261 ret = CreateWindow(0);
262 EXPECT_EQ(g_dSreenOk, ret) << "CreateWindow fail";
263 }
264
265 /**
266 * @tc.number : SUB_DH_Dscreen_Dcts_1000
267 * @tc.name :Scramble the method invocation order to see if the method invocation fails
268 * @tc.desc : Composite test function
269 * @tc.type : FUNC
270 * @tc.size : Medium test
271 */
272 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1100, TestSize.Level1)
273 {
274 int res = SaTest();
275 if (res == 1) {
276 return;
277 }
278 int ret = StartExpand(0);
279 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
280 ret = StopExpand(0);
281 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
282 ret = CreateWindow(0);
283 EXPECT_EQ(g_dSreenOk, ret) << "CreateWindow fail";
284 }
285
286 /**
287 * @tc.number : SUB_DH_Dscreen_Dcts_1000
288 * @tc.name :Scramble the method invocation order to see if the method invocation fails
289 * @tc.desc : Composite test function
290 * @tc.type : FUNC
291 * @tc.size : Medium test
292 */
293 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1200, TestSize.Level1)
294 {
295 int res = SaTest();
296 if (res == 1) {
297 return;
298 }
299 int ret = StartMirror(0);
300 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
301 ret = CreateWindow(0);
302 EXPECT_EQ(g_dSreenOk, ret) << "CreateWindow fail";
303 ret = StopMirror(0);
304 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
305 }
306
307 /**
308 * @tc.number : SUB_DH_Dscreen_Dcts_1000
309 * @tc.name :Scramble the method invocation order to see if the method invocation fails
310 * @tc.desc : Composite test function
311 * @tc.type : FUNC
312 * @tc.size : Medium test
313 */
314 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1300, TestSize.Level1)
315 {
316 int res = SaTest();
317 if (res == 1) {
318 return;
319 }
320 int ret = StartExpand(0);
321 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
322 ret = CreateWindow(0);
323 EXPECT_EQ(g_dSreenOk, ret) << "CreateWindow fail";
324 ret = StopExpand(0);
325 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
326 }
327
328 /**
329 * @tc.number : SUB_DH_Dscreen_Dcts_1000
330 * @tc.name :Scramble the method invocation order to see if the method invocation fails
331 * @tc.desc : Composite test function
332 * @tc.type : FUNC
333 * @tc.size : Medium test
334 */
335 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1400, TestSize.Level1)
336 {
337 int res = SaTest();
338 if (res == 1) {
339 return;
340 }
341 int ret = StartMirror(0);
342 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
343 ret = QueryRemoteDeviceInfo(0);
344 EXPECT_EQ(g_dSreenOk, ret) << "QueryRemoteDeviceInfo fail";
345 ret = StopMirror(0);
346 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
347 }
348
349 /**
350 * @tc.number : SUB_DH_Dscreen_Dcts_1000
351 * @tc.name :Scramble the method invocation order to see if the method invocation fails
352 * @tc.desc : Composite test function
353 * @tc.type : FUNC
354 * @tc.size : Medium test
355 */
356 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1500, TestSize.Level1)
357 {
358 int res = SaTest();
359 if (res == 1) {
360 return;
361 }
362 int ret = StartMirror(0);
363 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
364 ret = QueryRemoteScreenInfo(0);
365 EXPECT_EQ(g_dSreenOk, ret) << "QueryRemoteScreenInfo fail";
366 ret = StopMirror(0);
367 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
368 }
369
370 /**
371 * @tc.number : SUB_DH_Dscreen_Dcts_1000
372 * @tc.name :Scramble the method invocation order to see if the method invocation fails
373 * @tc.desc : Composite test function
374 * @tc.type : FUNC
375 * @tc.size : Medium test
376 */
377 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1600, TestSize.Level1)
378 {
379 int res = SaTest();
380 if (res == 1) {
381 return;
382 }
383 int ret = StartExpand(0);
384 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
385 ret = QueryRemoteDeviceInfo(0);
386 EXPECT_EQ(g_dSreenOk, ret) << "QueryRemoteDeviceInfo fail";
387 ret = StopExpand(0);
388 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
389 }
390
391 /**
392 * @tc.number : SUB_DH_Dscreen_Dcts_1000
393 * @tc.name :Scramble the method invocation order to see if the method invocation fails
394 * @tc.desc : Composite test function
395 * @tc.type : FUNC
396 * @tc.size : Medium test
397 */
398 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1700, TestSize.Level1)
399 {
400 int res = SaTest();
401 if (res == 1) {
402 return;
403 }
404 int ret = StartExpand(0);
405 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
406 ret = QueryRemoteScreenInfo(0);
407 EXPECT_EQ(g_dSreenOk, ret) << "QueryRemoteScreenInfo fail";
408 ret = StopExpand(0);
409 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
410 }
411
412 /**
413 * @tc.number : SUB_DH_Dscreen_Dcts_1000
414 * @tc.name :Scramble the method invocation order to see if the method invocation fails
415 * @tc.desc : Composite test function
416 * @tc.type : FUNC
417 * @tc.size : Medium test
418 */
419 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1800, TestSize.Level1)
420 {
421 int res = SaTest();
422 if (res == 1) {
423 return;
424 }
425 int ret = CreateWindow(0);
426 EXPECT_EQ(g_dSreenOk, ret) << "CreateWindow fail";
427 ret = StopMirror(0);
428 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
429 ret = StartMirror(0);
430 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
431 }
432
433 /**
434 * @tc.number : SUB_DH_Dscreen_Dcts_1000
435 * @tc.name :Scramble the method invocation order to see if the method invocation fails
436 * @tc.desc : Composite test function
437 * @tc.type : FUNC
438 * @tc.size : Medium test
439 */
440 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_1900, TestSize.Level1)
441 {
442 int res = SaTest();
443 if (res == 1) {
444 return;
445 }
446 int ret = StartExpand(0);
447 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
448 ret = StopExpand(0);
449 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
450 ret = StartMirror(0);
451 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
452 ret = StopMirror(0);
453 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
454 }
455
456 /**
457 * @tc.number : SUB_DH_Dscreen_Dcts_1000
458 * @tc.name :Scramble the method invocation order to see if the method invocation fails
459 * @tc.desc : Composite test function
460 * @tc.type : FUNC
461 * @tc.size : Medium test
462 */
463 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2000, TestSize.Level1)
464 {
465 int res = SaTest();
466 if (res == 1) {
467 return;
468 }
469 int ret = StartMirror(0);
470 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
471 ret = StartExpand(0);
472 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
473 ret = StopMirror(0);
474 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
475 ret = StopExpand(0);
476 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
477 }
478
479 /**
480 * @tc.number : SUB_DH_Dscreen_Dcts_1000
481 * @tc.name :Scramble the method invocation order to see if the method invocation fails
482 * @tc.desc : Composite test function
483 * @tc.type : FUNC
484 * @tc.size : Medium test
485 */
486 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2100, TestSize.Level1)
487 {
488 int res = SaTest();
489 if (res == 1) {
490 return;
491 }
492 int ret = StartExpand(0);
493 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
494 ret = StartMirror(0);
495 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
496 ret = StopMirror(0);
497 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
498 ret = StopExpand(0);
499 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
500 }
501
502 /**
503 * @tc.number : SUB_DH_Dscreen_Dcts_1000
504 * @tc.name :Scramble the method invocation order to see if the method invocation fails
505 * @tc.desc : Composite test function
506 * @tc.type : FUNC
507 * @tc.size : Medium test
508 */
509 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2200, TestSize.Level1)
510 {
511 int res = SaTest();
512 if (res == 1) {
513 return;
514 }
515 int ret = CreateWindow(0);
516 EXPECT_EQ(g_dSreenOk, ret) << "CreateWindow fail";
517 ret = StopExpand(0);
518 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
519 ret = StopMirror(0);
520 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
521 ret = StartExpand(0);
522 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
523 ret = StartMirror(0);
524 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
525 ret = StopExpand(0);
526 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
527 ret = StopMirror(0);
528 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
529 }
530
531 /**
532 * @tc.number : SUB_DH_Dscreen_Dcts_2300
533 * @tc.name :StartMirror method Enter error parameters to see the return value
534 * @tc.desc : Composite test function
535 * @tc.type : FUNC
536 * @tc.size : Medium test
537 */
538 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2300, TestSize.Level1)
539 {
540 int res = SaTest();
541 if (res == 1) {
542 return;
543 }
544 int ret = StartMirror(2);
545 EXPECT_NE(g_dSreenOk, ret) << "StartMirror fail";
546 }
547
548 /**
549 * @tc.number : SUB_DH_Dscreen_Dcts_2400
550 * @tc.name :StopMirror method Enter error parameters to see the return value
551 * @tc.desc : Composite test function
552 * @tc.type : FUNC
553 * @tc.size : Medium test
554 */
555 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2400, TestSize.Level1)
556 {
557 int res = SaTest();
558 if (res == 1) {
559 return;
560 }
561 int ret = StopMirror(2);
562 EXPECT_NE(g_dSreenOk, ret) << "StopMirror fail";
563 }
564
565 /**
566 * @tc.number : SUB_DH_Dscreen_Dcts_2500
567 * @tc.name :StartExpand method Enter error parameters to see the return value
568 * @tc.desc : Composite test function
569 * @tc.type : FUNC
570 * @tc.size : Medium test
571 */
572 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2500, TestSize.Level1)
573 {
574 int res = SaTest();
575 if (res == 1) {
576 return;
577 }
578 int ret = StartExpand(2);
579 EXPECT_NE(g_dSreenOk, ret) << "StartExpand fail";
580 }
581
582 /**
583 * @tc.number : SUB_DH_Dscreen_Dcts_2600
584 * @tc.name :StopExpand method Enter error parameters to see the return value
585 * @tc.desc : Composite test function
586 * @tc.type : FUNC
587 * @tc.size : Medium test
588 */
589 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2600, TestSize.Level1)
590 {
591 int res = SaTest();
592 if (res == 1) {
593 return;
594 }
595 int ret = StopExpand(2);
596 EXPECT_NE(g_dSreenOk, ret) << "StopExpand fail";
597 }
598
599 /**
600 * @tc.number : SUB_DH_Dscreen_Dcts_2700
601 * @tc.name :CreateWindow method Enter error parameters to see the return value
602 * @tc.desc : Composite test function
603 * @tc.type : FUNC
604 * @tc.size : Medium test
605 */
606 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2700, TestSize.Level1)
607 {
608 int res = SaTest();
609 if (res == 1) {
610 return;
611 }
612 int ret = CreateWindow(2);
613 EXPECT_NE(g_dSreenOk, ret) << "CreateWindow fail";
614 }
615
616 /**
617 * @tc.number : SUB_DH_Dscreen_Dcts_2800
618 * @tc.name :QueryRemoteDeviceInfo method Enter error parameters to see the return value
619 * @tc.desc : Composite test function
620 * @tc.type : FUNC
621 * @tc.size : Medium test
622 */
623 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2800, TestSize.Level1)
624 {
625 int res = SaTest();
626 if (res == 1) {
627 return;
628 }
629 int ret = QueryRemoteDeviceInfo(2);
630 EXPECT_NE(g_dSreenOk, ret) << "QueryRemoteDeviceInfo fail";
631 }
632
633 /**
634 * @tc.number : SUB_DH_Dscreen_Dcts_2900
635 * @tc.name :QueryRemoteScreenInfo method Enter error parameters to see the return value
636 * @tc.desc : Composite test function
637 * @tc.type : FUNC
638 * @tc.size : Medium test
639 */
640 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_2900, TestSize.Level1)
641 {
642 int res = SaTest();
643 if (res == 1) {
644 return;
645 }
646 int ret = QueryRemoteScreenInfo(2);
647 EXPECT_NE(g_dSreenOk, ret) << "QueryRemoteScreenInfo fail";
648 }
649
650 /**
651 * @tc.number : SUB_DH_Dscreen_Dcts_3000
652 * @tc.name :StartMirror and StopMirror method Enter error parameters to see the return value
653 * @tc.desc : Composite test function
654 * @tc.type : FUNC
655 * @tc.size : Medium test
656 */
657 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3000, TestSize.Level1)
658 {
659 int res = SaTest();
660 if (res == 1) {
661 return;
662 }
663 int ret = StartMirror(2);
664 EXPECT_NE(g_dSreenOk, ret) << "StartMirror fail";
665 ret = StopMirror(2);
666 EXPECT_NE(g_dSreenOk, ret) << "StopMirror fail";
667 }
668
669 /**
670 * @tc.number : SUB_DH_Dscreen_Dcts_3100
671 * @tc.name :StartMirror and StartExpand method Enter error parameters to see the return value
672 * @tc.desc : Composite test function
673 * @tc.type : FUNC
674 * @tc.size : Medium test
675 */
676 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3100, TestSize.Level1)
677 {
678 int res = SaTest();
679 if (res == 1) {
680 return;
681 }
682 int ret = StartMirror(2);
683 EXPECT_NE(g_dSreenOk, ret) << "StartMirror fail";
684 ret = StartExpand(2);
685 EXPECT_NE(g_dSreenOk, ret) << "StartExpand fail";
686 }
687
688 /**
689 * @tc.number : SUB_DH_Dscreen_Dcts_3200
690 * @tc.name :StartMirror and CreateWindow method Enter error parameters to see the return value
691 * @tc.desc : Composite test function
692 * @tc.type : FUNC
693 * @tc.size : Medium test
694 */
695 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3200, TestSize.Level1)
696 {
697 int res = SaTest();
698 if (res == 1) {
699 return;
700 }
701 int ret = StartMirror(2);
702 EXPECT_NE(g_dSreenOk, ret) << "StartMirror fail";
703 ret = CreateWindow(2);
704 EXPECT_NE(g_dSreenOk, ret) << "CreateWindow fail";
705 }
706
707 /**
708 * @tc.number : SUB_DH_Dscreen_Dcts_3300
709 * @tc.name :StartMirror and QueryRemoteDeviceInfo method Enter error parameters to see the return value
710 * @tc.desc : Composite test function
711 * @tc.type : FUNC
712 * @tc.size : Medium test
713 */
714 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3300, TestSize.Level1)
715 {
716 int res = SaTest();
717 if (res == 1) {
718 return;
719 }
720 int ret = StartMirror(2);
721 EXPECT_NE(g_dSreenOk, ret) << "StartMirror fail";
722 ret = QueryRemoteDeviceInfo(2);
723 EXPECT_NE(g_dSreenOk, ret) << "QueryRemoteDeviceInfo fail";
724 }
725
726 /**
727 * @tc.number : SUB_DH_Dscreen_Dcts_3400
728 * @tc.name :StartMirror and QueryRemoteScreenInfo method Enter error parameters to see the return value
729 * @tc.desc : Composite test function
730 * @tc.type : FUNC
731 * @tc.size : Medium test
732 */
733 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3400, TestSize.Level1)
734 {
735 int res = SaTest();
736 if (res == 1) {
737 return;
738 }
739 int ret = StartMirror(2);
740 EXPECT_NE(g_dSreenOk, ret) << "StartMirror fail";
741 ret = QueryRemoteScreenInfo(2);
742 EXPECT_NE(g_dSreenOk, ret) << "QueryRemoteScreenInfo fail";
743 }
744
745 /**
746 * @tc.number : SUB_DH_Dscreen_Dcts_3500
747 * @tc.name :StartMirror and StopExpand method Enter error parameters to see the return value
748 * @tc.desc : Composite test function
749 * @tc.type : FUNC
750 * @tc.size : Medium test
751 */
752 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3500, TestSize.Level1)
753 {
754 int res = SaTest();
755 if (res == 1) {
756 return;
757 }
758 int ret = StartMirror(2);
759 EXPECT_NE(g_dSreenOk, ret) << "StartMirror fail";
760 ret = StopExpand(2);
761 EXPECT_NE(g_dSreenOk, ret) << "StopExpand fail";
762 }
763
764 /**
765 * @tc.number : SUB_DH_Dscreen_Dcts_3600
766 * @tc.name :StopMirror and StartExpand method Enter error parameters to see the return value
767 * @tc.desc : Composite test function
768 * @tc.type : FUNC
769 * @tc.size : Medium test
770 */
771 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3600, TestSize.Level1)
772 {
773 int res = SaTest();
774 if (res == 1) {
775 return;
776 }
777 int ret = StopMirror(2);
778 EXPECT_NE(g_dSreenOk, ret) << "StopMirror fail";
779 ret = StartExpand(2);
780 EXPECT_NE(g_dSreenOk, ret) << "StartExpand fail";
781 }
782
783 /**
784 * @tc.number : SUB_DH_Dscreen_Dcts_3700
785 * @tc.name :StopMirror and CreateWindow method Enter error parameters to see the return value
786 * @tc.desc : Composite test function
787 * @tc.type : FUNC
788 * @tc.size : Medium test
789 */
790 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3700, TestSize.Level1)
791 {
792 int res = SaTest();
793 if (res == 1) {
794 return;
795 }
796 int ret = StopMirror(2);
797 EXPECT_NE(g_dSreenOk, ret) << "StopMirror fail";
798 ret = CreateWindow(2);
799 EXPECT_NE(g_dSreenOk, ret) << "CreateWindow fail";
800 }
801
802 /**
803 * @tc.number : SUB_DH_Dscreen_Dcts_3800
804 * @tc.name :StopMirror and QueryRemoteDeviceInfo method Enter error parameters to see the return value
805 * @tc.desc : Composite test function
806 * @tc.type : FUNC
807 * @tc.size : Medium test
808 */
809 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3800, TestSize.Level1)
810 {
811 int res = SaTest();
812 if (res == 1) {
813 return;
814 }
815 int ret = StopMirror(2);
816 EXPECT_NE(g_dSreenOk, ret) << "StopMirror fail";
817 ret = QueryRemoteDeviceInfo(2);
818 EXPECT_NE(g_dSreenOk, ret) << "QueryRemoteDeviceInfo fail";
819 }
820
821 /**
822 * @tc.number : SUB_DH_Dscreen_Dcts_3900
823 * @tc.name :StopMirror and QueryRemoteScreenInfo method Enter error parameters to see the return value
824 * @tc.desc : Composite test function
825 * @tc.type : FUNC
826 * @tc.size : Medium test
827 */
828 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_3900, TestSize.Level1)
829 {
830 int res = SaTest();
831 if (res == 1) {
832 return;
833 }
834 int ret = StopMirror(2);
835 EXPECT_NE(g_dSreenOk, ret) << "StopMirror fail";
836 ret = QueryRemoteScreenInfo(2);
837 EXPECT_NE(g_dSreenOk, ret) << "QueryRemoteScreenInfo fail";
838 }
839
840 /**
841 * @tc.number : SUB_DH_Dscreen_Dcts_4000
842 * @tc.name :StopMirror and StopExpand method Enter error parameters to see the return value
843 * @tc.desc : Composite test function
844 * @tc.type : FUNC
845 * @tc.size : Medium test
846 */
847 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4000, TestSize.Level1)
848 {
849 int res = SaTest();
850 if (res == 1) {
851 return;
852 }
853 int ret = StopMirror(2);
854 EXPECT_NE(g_dSreenOk, ret) << "StopMirror fail";
855 ret = StopExpand(2);
856 EXPECT_NE(g_dSreenOk, ret) << "StopExpand fail";
857 }
858
859 /**
860 * @tc.number : SUB_DH_Dscreen_Dcts_4100
861 * @tc.name :StartExpand and CreateWindow method Enter error parameters to see the return value
862 * @tc.desc : Composite test function
863 * @tc.type : FUNC
864 * @tc.size : Medium test
865 */
866 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4100, TestSize.Level1)
867 {
868 int res = SaTest();
869 if (res == 1) {
870 return;
871 }
872 int ret = StartExpand(2);
873 EXPECT_NE(g_dSreenOk, ret) << "StartExpand fail";
874 ret = CreateWindow(2);
875 EXPECT_NE(g_dSreenOk, ret) << "CreateWindow fail";
876 }
877
878 /**
879 * @tc.number : SUB_DH_Dscreen_Dcts_4200
880 * @tc.name :StartExpand and QueryRemoteDeviceInfo method Enter error parameters to see the return value
881 * @tc.desc : Composite test function
882 * @tc.type : FUNC
883 * @tc.size : Medium test
884 */
885 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4200, TestSize.Level1)
886 {
887 int res = SaTest();
888 if (res == 1) {
889 return;
890 }
891 int ret = StartExpand(2);
892 EXPECT_NE(g_dSreenOk, ret) << "StartExpand fail";
893 ret = QueryRemoteDeviceInfo(2);
894 EXPECT_NE(g_dSreenOk, ret) << "QueryRemoteDeviceInfo fail";
895 }
896
897 /**
898 * @tc.number : SUB_DH_Dscreen_Dcts_4300
899 * @tc.name :StartExpand and StopExpand method Enter error parameters to see the return value
900 * @tc.desc : Composite test function
901 * @tc.type : FUNC
902 * @tc.size : Medium test
903 */
904 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4300, TestSize.Level1)
905 {
906 int res = SaTest();
907 if (res == 1) {
908 return;
909 }
910 int ret = StartExpand(2);
911 EXPECT_NE(g_dSreenOk, ret) << "StartExpand fail";
912 ret = StopExpand(2);
913 EXPECT_NE(g_dSreenOk, ret) << "StopExpand fail";
914 }
915
916 /**
917 * @tc.number : SUB_DH_Dscreen_Dcts_4400
918 * @tc.name StartMirror and StopMirror method Enter error parameters to see the return value
919 * @tc.desc : Composite test function
920 * @tc.type : FUNC
921 * @tc.size : Medium test
922 */
923 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4400, TestSize.Level1)
924 {
925 int res = SaTest();
926 if (res == 1) {
927 return;
928 }
929 int ret = -1;
930 for (int num = 0; num < 5; num++) {
931 ret = StartMirror(0);
932 std::cout << "SUB_DH_Dscreen_Dcts_4400 num:" << num << "ret:" << ret << std::endl;
933 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
934 }
935 ret = StopMirror(0);
936 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
937 }
938
939 /**
940 * @tc.number : SUB_DH_Dscreen_Dcts_4500
941 * @tc.name StartMirror and StopMirror method Enter error parameters to see the return value
942 * @tc.desc : Composite test function
943 * @tc.type : FUNC
944 * @tc.size : Medium test
945 */
946 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4500, TestSize.Level1)
947 {
948 int res = SaTest();
949 if (res == 1) {
950 return;
951 }
952 int ret = StartMirror(0);
953 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
954 for (int num = 0; num < 5; num++) {
955 ret = StopMirror(0);
956 std::cout << "SUB_DH_Dscreen_Dcts_4500 num:" << num << "ret:" << ret << std::endl;
957 EXPECT_EQ(g_dSreenOk, ret) << "StopMirror fail";
958 }
959 }
960
961 /**
962 * @tc.number : SUB_DH_Dscreen_Dcts_4600
963 * @tc.name :StartExpand and StopExpand method Enter error parameters to see the return value
964 * @tc.desc : Composite test function
965 * @tc.type : FUNC
966 * @tc.size : Medium test
967 */
968 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4600, TestSize.Level1)
969 {
970 int res = SaTest();
971 if (res == 1) {
972 return;
973 }
974 int ret = -1;
975 for (int num = 0; num < 5; num++) {
976 ret = StartExpand(0);
977 std::cout << "SUB_DH_Dscreen_Dcts_4600 num:" << num << "ret:" << ret << std::endl;
978 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
979 }
980 ret = StopExpand(0);
981 EXPECT_EQ(g_dSreenOk, ret) << "StopExpand fail";
982 }
983
984 /**
985 * @tc.number : SUB_DH_Dscreen_Dcts_4700
986 * @tc.name :StartExpand and StopExpand method Enter error parameters to see the return value
987 * @tc.desc : Composite test function
988 * @tc.type : FUNC
989 * @tc.size : Medium test
990 */
991 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4700, TestSize.Level1)
992 {
993 int res = SaTest();
994 if (res == 1) {
995 return;
996 }
997 int ret = -1;
998 ret = StartExpand(0);
999 EXPECT_EQ(g_dSreenOk, ret) << "StartMirror fail";
1000 for (int num = 0; num < 5; num++) {
1001 ret = StopExpand(0);
1002 std::cout << "SUB_DH_Dscreen_Dcts_4700 num:" << num << "ret:" << ret << std::endl;
1003 EXPECT_EQ(g_dSreenOk, ret) << "StopExpand fail";
1004 }
1005 }
1006
1007 /**
1008 * @tc.number : SUB_DH_Dscreen_Dcts_4800
1009 * @tc.name :CreateWindow()
1010 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
1011 * @tc.desc : Distributed screen Creates a small window on the remote device
1012 * @tc.type : FUNC
1013 * @tc.size : Medium test
1014 */
1015 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4800, TestSize.Level1)
1016 {
1017 int res = SaTest();
1018 if (res == 1) {
1019 return;
1020 }
1021 int ret = -1;
1022 for (int num = 0; num < 5; num++) {
1023 ret = CreateWindow(0);
1024 std::cout << "SUB_DH_Dscreen_Dcts_4800 num:" << num << "ret:" << ret << std::endl;
1025 EXPECT_EQ(g_dSreenOk, ret) << "CreateWindow fail";
1026 }
1027 }
1028
1029 /**
1030 * @tc.number : SUB_DH_Dscreen_Dcts_4900
1031 * @tc.name :QueryRemoteDeviceInfo()
1032 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
1033 * @tc.desc : Distributed screen Displays information about remote devices
1034 * @tc.type : FUNC
1035 * @tc.size : Medium test
1036 */
1037 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_4900, TestSize.Level1)
1038 {
1039 int res = SaTest();
1040 if (res == 1) {
1041 return;
1042 }
1043 int ret = -1;
1044 for (int num = 0; num < 5; num++) {
1045 ret = QueryRemoteDeviceInfo(0);
1046 std::cout << "SUB_DH_Dscreen_Dcts_4900 num:" << num << "ret:" << ret << std::endl;
1047 EXPECT_EQ(g_dSreenOk, ret) << "QueryRemoteDeviceInfo fail";
1048 }
1049 }
1050
1051 /**
1052 * @tc.number : SUB_DH_Dscreen_Dcts_5000
1053 * @tc.name :QueryRemoteScreenInfo()
1054 * @tc.desc : [STD-DISTRIBUTED-0113]禁止修改OpenHarmony分布式屏幕交互协议
1055 * @tc.desc : Distributed screen Displays information about remote screens
1056 * @tc.type : FUNC
1057 * @tc.size : Medium test
1058 */
1059 HWTEST_F(DSreenAutomatTest, SUB_DH_Dscreen_Dcts_5000, TestSize.Level1)
1060 {
1061 int res = SaTest();
1062 if (res == 1) {
1063 return;
1064 }
1065 int ret = -1;
1066 for (int num = 0; num < 5; num++) {
1067 ret = QueryRemoteScreenInfo(0);
1068 std::cout << "SUB_DH_Dscreen_Dcts_5000 num:" << num << "ret:" << ret << std::endl;
1069 EXPECT_EQ(g_dSreenOk, ret) << "QueryRemoteScreenInfo fail";
1070 }
1071 }