1 /*
2 * Copyright (c) 2022 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 "window_stub.h"
18 #include "window_agent.h"
19
20 using namespace testing;
21 using namespace testing::ext;
22 namespace OHOS {
23 namespace Rosen {
24 class WindowStubTest : public testing::Test {
25 public:
26 static void SetUpTestCase();
27 static void TearDownTestCase();
28 void SetUp() override;
29 void TearDown() override;
30 sptr<WindowStub> windowStub_;
31 };
32
SetUpTestCase()33 void WindowStubTest::SetUpTestCase()
34 {
35 }
36
TearDownTestCase()37 void WindowStubTest::TearDownTestCase()
38 {
39 }
40
SetUp()41 void WindowStubTest::SetUp()
42 {
43 sptr<WindowOption> option = new WindowOption();
44 sptr<WindowImpl> window = new WindowImpl(option);
45 windowStub_ = new WindowAgent(window);
46 }
47
TearDown()48 void WindowStubTest::TearDown()
49 {
50 }
51
52 namespace {
53 /**
54 * @tc.name: OnRemoteRequest01
55 * @tc.desc: test InterfaceToken check failed
56 * @tc.type: FUNC
57 */
58 HWTEST_F(WindowStubTest, OnRemoteRequest01, Function | SmallTest | Level2)
59 {
60 MessageParcel data;
61 MessageParcel reply;
62 MessageOption option;
63
64 data.WriteInterfaceToken(u"error.GetDescriptor");
65
66 data.WriteInt32(0);
67 data.WriteInt32(0);
68 data.WriteUint32(100);
69 data.WriteUint32(100);
70
71 data.WriteBool(false);
72
73 data.WriteUint32(static_cast<uint32_t>(WindowSizeChangeReason::DRAG_START));
74
75 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
76
77 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
78 EXPECT_EQ(res, -1);
79 }
80
81 /**
82 * @tc.name: OnRemoteRequest02
83 * @tc.desc: test TRANS_ID_UPDATE_WINDOW_RECT
84 * @tc.type: FUNC
85 */
86 HWTEST_F(WindowStubTest, OnRemoteRequest02, Function | SmallTest | Level2)
87 {
88 MessageParcel data;
89 MessageParcel reply;
90 MessageOption option;
91
92 data.WriteInterfaceToken(WindowStub::GetDescriptor());
93
94 data.WriteInt32(0);
95 data.WriteInt32(0);
96 data.WriteUint32(100);
97 data.WriteUint32(100);
98
99 data.WriteBool(false);
100
101 data.WriteUint32(static_cast<uint32_t>(WindowSizeChangeReason::DRAG_START));
102
103 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
104
105 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
106 EXPECT_EQ(res, 0);
107 }
108
109 /**
110 * @tc.name: OnRemoteRequest03
111 * @tc.desc: test TRANS_ID_UPDATE_AVOID_AREA success
112 * @tc.type: FUNC
113 */
114 HWTEST_F(WindowStubTest, OnRemoteRequest03, Function | SmallTest | Level2)
115 {
116 MessageParcel data;
117 MessageParcel reply;
118 MessageOption option;
119
120 data.WriteInterfaceToken(WindowStub::GetDescriptor());
121
122 sptr<AvoidArea> avoidArea = new AvoidArea();
123 data.WriteStrongParcelable(avoidArea);
124
125 data.WriteUint32(static_cast<uint32_t>(AvoidAreaType::TYPE_SYSTEM));
126
127 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_AVOID_AREA);
128
129 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
130 EXPECT_EQ(res, 0);
131 }
132
133 /**
134 * @tc.name: OnRemoteRequest04
135 * @tc.desc: test TRANS_ID_UPDATE_AVOID_AREA success
136 * @tc.type: FUNC
137 */
138 HWTEST_F(WindowStubTest, OnRemoteRequest04, Function | SmallTest | Level2)
139 {
140 MessageParcel data;
141 MessageParcel reply;
142 MessageOption option;
143
144 data.WriteInterfaceToken(WindowStub::GetDescriptor());
145
146 sptr<AvoidArea> avoidArea = new AvoidArea();
147 data.WriteStrongParcelable(avoidArea);
148
149 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_AVOID_AREA);
150
151 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
152 EXPECT_EQ(res, -1);
153 }
154
155 /**
156 * @tc.name: OnRemoteRequest05
157 * @tc.desc: test TRANS_ID_DUMP_INFO success
158 * @tc.type: FUNC
159 */
160 HWTEST_F(WindowStubTest, OnRemoteRequest05, Function | SmallTest | Level2)
161 {
162 MessageParcel data;
163 MessageParcel reply;
164 MessageOption option;
165
166 data.WriteInterfaceToken(WindowStub::GetDescriptor());
167
168 std::vector<std::string> params;
169 params.push_back("-a");
170 data.WriteStringVector(params);
171
172 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_DUMP_INFO);
173
174 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
175 EXPECT_EQ(res, 0);
176 }
177
178 /**
179 * @tc.name: OnRemoteRequest06
180 * @tc.desc: test TRANS_ID_DUMP_INFO failed
181 * @tc.type: FUNC
182 */
183 HWTEST_F(WindowStubTest, OnRemoteRequest06, Function | SmallTest | Level2)
184 {
185 MessageParcel data;
186 MessageParcel reply;
187 MessageOption option;
188
189 data.WriteInterfaceToken(WindowStub::GetDescriptor());
190 data.WriteRawData(nullptr, 0);
191
192 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_DUMP_INFO);
193
194 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
195 EXPECT_EQ(res, 0);
196 }
197
198
199 /**
200 * @tc.name: OnRemoteRequest07
201 * @tc.desc: test TRANS_ID_NOTIFY_CLIENT_POINT_UP success
202 * @tc.type: FUNC
203 */
204 HWTEST_F(WindowStubTest, OnRemoteRequest07, Function | SmallTest | Level2)
205 {
206 MessageParcel data;
207 MessageParcel reply;
208 MessageOption option;
209
210 data.WriteInterfaceToken(WindowStub::GetDescriptor());
211
212 std::shared_ptr<MMI::PointerEvent> pointerEvent = MMI::PointerEvent::Create();
213 pointerEvent->WriteToParcel(data);
214
215 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_CLIENT_POINT_UP);
216
217 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
218 EXPECT_EQ(res, 0);
219 }
220
221 /**
222 * @tc.name: OnRemoteRequest08
223 * @tc.desc: test TRANS_ID_NOTIFY_CLIENT_POINT_UP success
224 * @tc.type: FUNC
225 */
226 HWTEST_F(WindowStubTest, OnRemoteRequest08, Function | SmallTest | Level2)
227 {
228 MessageParcel data;
229 MessageParcel reply;
230 MessageOption option;
231
232 data.WriteInterfaceToken(WindowStub::GetDescriptor());
233
234 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_CLIENT_POINT_UP);
235
236 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
237 EXPECT_EQ(res, -1);
238 }
239
240 /**
241 * @tc.name: OnRemoteRequest09
242 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS success
243 * @tc.type: FUNC
244 */
245 HWTEST_F(WindowStubTest, OnRemoteRequest09, Function | SmallTest | Level2)
246 {
247 MessageParcel data;
248 MessageParcel reply;
249 MessageOption option(MessageOption::TF_ASYNC);
250
251 data.WriteInterfaceToken(WindowStub::GetDescriptor());
252 data.WriteBool(false);
253 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS);
254 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
255 EXPECT_EQ(res, 0);
256 }
257
258 /**
259 * @tc.name: OnRemoteRequest10
260 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS success
261 * @tc.type: FUNC
262 */
263 HWTEST_F(WindowStubTest, OnRemoteRequest10, Function | SmallTest | Level2)
264 {
265 MessageParcel data;
266 MessageParcel reply;
267 MessageOption option(MessageOption::TF_ASYNC);
268 uint32_t code = 0;
269
270 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
271 EXPECT_EQ(res, static_cast<int>(ERR_TRANSACTION_FAILED));
272 }
273
274 /**
275 * @tc.name: OnRemoteRequest11
276 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS success
277 * @tc.type: FUNC
278 */
279 HWTEST_F(WindowStubTest, OnRemoteRequest11, Function | SmallTest | Level2)
280 {
281 MessageParcel data;
282 MessageParcel reply;
283 MessageOption option(MessageOption::TF_ASYNC);
284 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
285 data.WriteBool(false);
286 data.WriteInterfaceToken(WindowStub::GetDescriptor());
287
288 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_MODE);
289 windowStub_->OnRemoteRequest(code, data, reply, option);
290 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_MODE_SUPPORT_INFO);
291 windowStub_->OnRemoteRequest(code, data, reply, option);
292 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_FOCUS_STATUS);
293 windowStub_->OnRemoteRequest(code, data, reply, option);
294 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_AVOID_AREA);
295 windowStub_->OnRemoteRequest(code, data, reply, option);
296 uint32_t type = 1;
297 data.ReadUint32(type);
298 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_STATE);
299 windowStub_->OnRemoteRequest(code, data, reply, option);
300 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_DRAG_EVENT);
301 windowStub_->OnRemoteRequest(code, data, reply, option);
302 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_DISPLAY_ID);
303 windowStub_->OnRemoteRequest(code, data, reply, option);
304 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA);
305 windowStub_->OnRemoteRequest(code, data, reply, option);
306 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA_AND_RECT);
307 windowStub_->OnRemoteRequest(code, data, reply, option);
308 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_ACTIVE_STATUS);
309
310 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
311 EXPECT_NE(res, 10);
312 }
313
314 /**
315 * @tc.name: OnRemoteRequest12
316 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS success
317 * @tc.type: FUNC
318 */
319 HWTEST_F(WindowStubTest, OnRemoteRequest12, Function | SmallTest | Level2)
320 {
321 MessageParcel data;
322 MessageParcel reply;
323 MessageOption option(MessageOption::TF_ASYNC);
324 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
325 data.WriteBool(false);
326 data.WriteInterfaceToken(WindowStub::GetDescriptor());
327
328 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_GET_WINDOW_PROPERTY);
329 windowStub_->OnRemoteRequest(code, data, reply, option);
330 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_OUTSIDE_PRESSED);
331 windowStub_->OnRemoteRequest(code, data, reply, option);
332 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_SCREEN_SHOT);
333 windowStub_->OnRemoteRequest(code, data, reply, option);
334 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_DESTROY);
335 windowStub_->OnRemoteRequest(code, data, reply, option);
336 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND);
337 windowStub_->OnRemoteRequest(code, data, reply, option);
338 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_BACKGROUND);
339 windowStub_->OnRemoteRequest(code, data, reply, option);
340 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_DUMP_INFO);
341 windowStub_->OnRemoteRequest(code, data, reply, option);
342 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_CLIENT_POINT_UP);
343 windowStub_->OnRemoteRequest(code, data, reply, option);
344 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_ZOOM_TRANSFORM);
345 windowStub_->OnRemoteRequest(code, data, reply, option);
346 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_RESTORE_SPLIT_WINDOW_MODE);
347 windowStub_->OnRemoteRequest(code, data, reply, option);
348 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS);
349
350 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
351 EXPECT_NE(res, 10);
352 }
353
354
355 /**
356 * @tc.name: OnRemoteRequest13
357 * @tc.desc: test TRANS_ID_UPDATE_WINDOW_RECT success
358 * @tc.type: FUNC
359 */
360 HWTEST_F(WindowStubTest, OnRemoteRequest13, Function | SmallTest | Level2)
361 {
362 MessageParcel data;
363 MessageParcel reply;
364 MessageOption option(MessageOption::TF_ASYNC);
365
366 data.WriteInterfaceToken(WindowStub::GetDescriptor());
367
368 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
369 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
370 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
371 }
372
373 /**
374 * @tc.name: OnRemoteRequest14
375 * @tc.desc: test TRANS_ID_UPDATE_WINDOW_MODE success
376 * @tc.type: FUNC
377 */
378 HWTEST_F(WindowStubTest, OnRemoteRequest14, Function | SmallTest | Level2)
379 {
380 MessageParcel data;
381 MessageParcel reply;
382 MessageOption option(MessageOption::TF_ASYNC);
383
384 data.WriteInterfaceToken(WindowStub::GetDescriptor());
385
386 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_MODE);
387 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
388 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
389 }
390
391 /**
392 * @tc.name: OnRemoteRequest15
393 * @tc.desc: test TRANS_ID_UPDATE_MODE_SUPPORT_INFO success
394 * @tc.type: FUNC
395 */
396 HWTEST_F(WindowStubTest, OnRemoteRequest15, Function | SmallTest | Level2)
397 {
398 MessageParcel data;
399 MessageParcel reply;
400 MessageOption option(MessageOption::TF_ASYNC);
401
402 data.WriteInterfaceToken(WindowStub::GetDescriptor());
403
404 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_MODE_SUPPORT_INFO);
405 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
406 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
407 }
408
409 /**
410 * @tc.name: OnRemoteRequest16
411 * @tc.desc: test TRANS_ID_UPDATE_FOCUS_STATUS success
412 * @tc.type: FUNC
413 */
414 HWTEST_F(WindowStubTest, OnRemoteRequest16, Function | SmallTest | Level2)
415 {
416 MessageParcel data;
417 MessageParcel reply;
418 MessageOption option(MessageOption::TF_ASYNC);
419
420 data.WriteInterfaceToken(WindowStub::GetDescriptor());
421
422 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_FOCUS_STATUS);
423 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
424 EXPECT_EQ(res, 0);
425 }
426
427 /**
428 * @tc.name: OnRemoteRequest17
429 * @tc.desc: test TRANS_ID_UPDATE_AVOID_AREA success
430 * @tc.type: FUNC
431 */
432 HWTEST_F(WindowStubTest, OnRemoteRequest17, Function | SmallTest | Level2)
433 {
434 MessageParcel data;
435 MessageParcel reply;
436 MessageOption option(MessageOption::TF_ASYNC);
437
438 data.WriteInterfaceToken(WindowStub::GetDescriptor());
439
440 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_AVOID_AREA);
441 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
442 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
443 }
444
445 /**
446 * @tc.name: OnRemoteRequest18
447 * @tc.desc: test TRANS_ID_UPDATE_WINDOW_STATE success
448 * @tc.type: FUNC
449 */
450 HWTEST_F(WindowStubTest, OnRemoteRequest18, Function | SmallTest | Level2)
451 {
452 MessageParcel data;
453 MessageParcel reply;
454 MessageOption option(MessageOption::TF_ASYNC);
455
456 data.WriteInterfaceToken(WindowStub::GetDescriptor());
457
458 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_STATE);
459 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
460 EXPECT_EQ(res, static_cast<int>(ERR_NONE));
461 }
462
463 /**
464 * @tc.name: OnRemoteRequest19
465 * @tc.desc: test TRANS_ID_UPDATE_DRAG_EVENT success
466 * @tc.type: FUNC
467 */
468 HWTEST_F(WindowStubTest, OnRemoteRequest19, Function | SmallTest | Level2)
469 {
470 MessageParcel data;
471 MessageParcel reply;
472 MessageOption option(MessageOption::TF_ASYNC);
473
474 data.WriteInterfaceToken(WindowStub::GetDescriptor());
475 data.WriteInt32(0);
476 data.WriteInt32(0);
477 data.WriteUint32(1);
478
479 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_DRAG_EVENT);
480 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
481 EXPECT_EQ(res, 0);
482 }
483
484 /**
485 * @tc.name: OnRemoteRequest20
486 * @tc.desc: test TRANS_ID_UPDATE_DISPLAY_ID success
487 * @tc.type: FUNC
488 */
489 HWTEST_F(WindowStubTest, OnRemoteRequest20, Function | SmallTest | Level2)
490 {
491 MessageParcel data;
492 MessageParcel reply;
493 MessageOption option(MessageOption::TF_ASYNC);
494
495 data.WriteInterfaceToken(WindowStub::GetDescriptor());
496
497 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_DISPLAY_ID);
498 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
499 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
500 }
501
502 /**
503 * @tc.name: OnRemoteRequest21
504 * @tc.desc: test TRANS_ID_UPDATE_OCCUPIED_AREA success
505 * @tc.type: FUNC
506 */
507 HWTEST_F(WindowStubTest, OnRemoteRequest21, Function | SmallTest | Level2)
508 {
509 MessageParcel data;
510 MessageParcel reply;
511 MessageOption option(MessageOption::TF_ASYNC);
512
513 data.WriteInterfaceToken(WindowStub::GetDescriptor());
514
515 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA);
516 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
517 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
518 }
519
520 /**
521 * @tc.name: OnRemoteRequest22
522 * @tc.desc: test TRANS_ID_UPDATE_OCCUPIED_AREA_AND_RECT success
523 * @tc.type: FUNC
524 */
525 HWTEST_F(WindowStubTest, OnRemoteRequest22, Function | SmallTest | Level2)
526 {
527 MessageParcel data;
528 MessageParcel reply;
529 MessageOption option(MessageOption::TF_ASYNC);
530
531 data.WriteInterfaceToken(WindowStub::GetDescriptor());
532
533 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA_AND_RECT);
534 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
535 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
536 }
537
538 /**
539 * @tc.name: OnRemoteRequest23
540 * @tc.desc: test TRANS_ID_UPDATE_ACTIVE_STATUS success
541 * @tc.type: FUNC
542 */
543 HWTEST_F(WindowStubTest, OnRemoteRequest23, Function | SmallTest | Level2)
544 {
545 MessageParcel data;
546 MessageParcel reply;
547 MessageOption option(MessageOption::TF_ASYNC);
548
549 data.WriteInterfaceToken(WindowStub::GetDescriptor());
550
551 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_ACTIVE_STATUS);
552 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
553 EXPECT_EQ(res, 0);
554 }
555
556 /**
557 * @tc.name: OnRemoteRequest24
558 * @tc.desc: test TRANS_ID_GET_WINDOW_PROPERTY success
559 * @tc.type: FUNC
560 */
561 HWTEST_F(WindowStubTest, OnRemoteRequest24, Function | SmallTest | Level2)
562 {
563 MessageParcel data;
564 MessageParcel reply;
565 MessageOption option(MessageOption::TF_ASYNC);
566
567 data.WriteInterfaceToken(WindowStub::GetDescriptor());
568
569 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_GET_WINDOW_PROPERTY);
570 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
571 EXPECT_EQ(res, 0);
572 }
573
574 /**
575 * @tc.name: OnRemoteRequest25
576 * @tc.desc: test TRANS_ID_NOTIFY_OUTSIDE_PRESSED success
577 * @tc.type: FUNC
578 */
579 HWTEST_F(WindowStubTest, OnRemoteRequest25, Function | SmallTest | Level2)
580 {
581 MessageParcel data;
582 MessageParcel reply;
583 MessageOption option(MessageOption::TF_ASYNC);
584
585 data.WriteInterfaceToken(WindowStub::GetDescriptor());
586
587 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_OUTSIDE_PRESSED);
588 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
589 EXPECT_EQ(res, 0);
590 }
591
592 /**
593 * @tc.name: OnRemoteRequest26
594 * @tc.desc: test TRANS_ID_NOTIFY_SCREEN_SHOT success
595 * @tc.type: FUNC
596 */
597 HWTEST_F(WindowStubTest, OnRemoteRequest26, Function | SmallTest | Level2)
598 {
599 MessageParcel data;
600 MessageParcel reply;
601 MessageOption option(MessageOption::TF_ASYNC);
602
603 data.WriteInterfaceToken(WindowStub::GetDescriptor());
604
605 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_SCREEN_SHOT);
606 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
607 EXPECT_EQ(res, 0);
608 }
609
610 /**
611 * @tc.name: OnRemoteRequest27
612 * @tc.desc: test TRANS_ID_NOTIFY_DESTROY success
613 * @tc.type: FUNC
614 */
615 HWTEST_F(WindowStubTest, OnRemoteRequest27, Function | SmallTest | Level2)
616 {
617 MessageParcel data;
618 MessageParcel reply;
619 MessageOption option(MessageOption::TF_ASYNC);
620
621 data.WriteInterfaceToken(WindowStub::GetDescriptor());
622
623 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_DESTROY);
624 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
625 EXPECT_EQ(res, 0);
626 }
627
628 /**
629 * @tc.name: OnRemoteRequest28
630 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND success
631 * @tc.type: FUNC
632 */
633 HWTEST_F(WindowStubTest, OnRemoteRequest28, Function | SmallTest | Level2)
634 {
635 MessageParcel data;
636 MessageParcel reply;
637 MessageOption option(MessageOption::TF_ASYNC);
638
639 data.WriteInterfaceToken(WindowStub::GetDescriptor());
640
641 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND);
642 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
643 EXPECT_EQ(res, 0);
644 }
645
646 /**
647 * @tc.name: OnRemoteRequest29
648 * @tc.desc: test TRANS_ID_NOTIFY_BACKGROUND success
649 * @tc.type: FUNC
650 */
651 HWTEST_F(WindowStubTest, OnRemoteRequest29, Function | SmallTest | Level2)
652 {
653 MessageParcel data;
654 MessageParcel reply;
655 MessageOption option(MessageOption::TF_ASYNC);
656
657 data.WriteInterfaceToken(WindowStub::GetDescriptor());
658
659 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_BACKGROUND);
660 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
661 EXPECT_EQ(res, 0);
662 }
663
664 /**
665 * @tc.name: OnRemoteRequest30
666 * @tc.desc: test TRANS_ID_DUMP_INFO success
667 * @tc.type: FUNC
668 */
669 HWTEST_F(WindowStubTest, OnRemoteRequest30, Function | SmallTest | Level2)
670 {
671 MessageParcel data;
672 MessageParcel reply;
673 MessageOption option(MessageOption::TF_ASYNC);
674
675 data.WriteInterfaceToken(WindowStub::GetDescriptor());
676
677 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_DUMP_INFO);
678 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
679 EXPECT_EQ(res, 0);
680 }
681
682 /**
683 * @tc.name: OnRemoteRequest31
684 * @tc.desc: test TRANS_ID_NOTIFY_CLIENT_POINT_UP success
685 * @tc.type: FUNC
686 */
687 HWTEST_F(WindowStubTest, OnRemoteRequest31, Function | SmallTest | Level2)
688 {
689 MessageParcel data;
690 MessageParcel reply;
691 MessageOption option(MessageOption::TF_ASYNC);
692
693 data.WriteInterfaceToken(WindowStub::GetDescriptor());
694
695 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_CLIENT_POINT_UP);
696 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
697 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
698 }
699
700 /**
701 * @tc.name: OnRemoteRequest32
702 * @tc.desc: test TRANS_ID_UPDATE_ZOOM_TRANSFORM success
703 * @tc.type: FUNC
704 */
705 HWTEST_F(WindowStubTest, OnRemoteRequest32, Function | SmallTest | Level2)
706 {
707 MessageParcel data;
708 MessageParcel reply;
709 MessageOption option(MessageOption::TF_ASYNC);
710
711 data.WriteInterfaceToken(WindowStub::GetDescriptor());
712
713 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_ZOOM_TRANSFORM);
714 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
715 EXPECT_EQ(res, 0);
716 }
717
718 /**
719 * @tc.name: OnRemoteRequest33
720 * @tc.desc: test TRANS_ID_RESTORE_SPLIT_WINDOW_MODE success
721 * @tc.type: FUNC
722 */
723 HWTEST_F(WindowStubTest, OnRemoteRequest33, Function | SmallTest | Level2)
724 {
725 MessageParcel data;
726 MessageParcel reply;
727 MessageOption option(MessageOption::TF_ASYNC);
728
729 data.WriteInterfaceToken(WindowStub::GetDescriptor());
730
731 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_RESTORE_SPLIT_WINDOW_MODE);
732 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
733 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
734 }
735
736 /**
737 * @tc.name: OnRemoteRequest34
738 * @tc.desc: test TRANS_ID_CONSUME_KEY_EVENT success
739 * @tc.type: FUNC
740 */
741 HWTEST_F(WindowStubTest, OnRemoteRequest34, Function | SmallTest | Level2)
742 {
743 MessageParcel data;
744 MessageParcel reply;
745 MessageOption option(MessageOption::TF_ASYNC);
746
747 data.WriteInterfaceToken(WindowStub::GetDescriptor());
748
749 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_CONSUME_KEY_EVENT);
750 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
751 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
752 }
753
754 /**
755 * @tc.name: OnRemoteRequest35
756 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS success
757 * @tc.type: FUNC
758 */
759 HWTEST_F(WindowStubTest, OnRemoteRequest35, Function | SmallTest | Level2)
760 {
761 MessageParcel data;
762 MessageParcel reply;
763 MessageOption option(MessageOption::TF_ASYNC);
764
765 data.WriteInterfaceToken(WindowStub::GetDescriptor());
766
767 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS);
768 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
769 EXPECT_EQ(res, 0);
770 }
771 }
772 }
773 }
774