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, -1);
272
273 IWindow::WindowMessage msgId = IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT;
274 EXPECT_EQ(msgId, IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
275 }
276
277 /**
278 * @tc.name: OnRemoteRequest11
279 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS success
280 * @tc.type: FUNC
281 */
282 HWTEST_F(WindowStubTest, OnRemoteRequest11, Function | SmallTest | Level2)
283 {
284 MessageParcel data;
285 MessageParcel reply;
286 MessageOption option(MessageOption::TF_ASYNC);
287 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
288 data.WriteBool(false);
289 data.WriteInterfaceToken(WindowStub::GetDescriptor());
290
291 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_MODE);
292 windowStub_->OnRemoteRequest(code, data, reply, option);
293 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_MODE_SUPPORT_INFO);
294 windowStub_->OnRemoteRequest(code, data, reply, option);
295 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_FOCUS_STATUS);
296 windowStub_->OnRemoteRequest(code, data, reply, option);
297 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_AVOID_AREA);
298 windowStub_->OnRemoteRequest(code, data, reply, option);
299 uint32_t type = 1;
300 data.ReadUint32(type);
301 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_STATE);
302 windowStub_->OnRemoteRequest(code, data, reply, option);
303 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_DRAG_EVENT);
304 windowStub_->OnRemoteRequest(code, data, reply, option);
305 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_DISPLAY_ID);
306 windowStub_->OnRemoteRequest(code, data, reply, option);
307 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA);
308 windowStub_->OnRemoteRequest(code, data, reply, option);
309 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA_AND_RECT);
310 windowStub_->OnRemoteRequest(code, data, reply, option);
311 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_ACTIVE_STATUS);
312
313 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
314 EXPECT_NE(res, 10);
315 }
316
317 /**
318 * @tc.name: OnRemoteRequest12
319 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS success
320 * @tc.type: FUNC
321 */
322 HWTEST_F(WindowStubTest, OnRemoteRequest12, Function | SmallTest | Level2)
323 {
324 MessageParcel data;
325 MessageParcel reply;
326 MessageOption option(MessageOption::TF_ASYNC);
327 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
328 data.WriteBool(false);
329 data.WriteInterfaceToken(WindowStub::GetDescriptor());
330
331 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_GET_WINDOW_PROPERTY);
332 windowStub_->OnRemoteRequest(code, data, reply, option);
333 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_OUTSIDE_PRESSED);
334 windowStub_->OnRemoteRequest(code, data, reply, option);
335 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_SCREEN_SHOT);
336 windowStub_->OnRemoteRequest(code, data, reply, option);
337 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_DESTROY);
338 windowStub_->OnRemoteRequest(code, data, reply, option);
339 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND);
340 windowStub_->OnRemoteRequest(code, data, reply, option);
341 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_BACKGROUND);
342 windowStub_->OnRemoteRequest(code, data, reply, option);
343 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_DUMP_INFO);
344 windowStub_->OnRemoteRequest(code, data, reply, option);
345 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_CLIENT_POINT_UP);
346 windowStub_->OnRemoteRequest(code, data, reply, option);
347 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_ZOOM_TRANSFORM);
348 windowStub_->OnRemoteRequest(code, data, reply, option);
349 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_RESTORE_SPLIT_WINDOW_MODE);
350 windowStub_->OnRemoteRequest(code, data, reply, option);
351 code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS);
352
353 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
354 EXPECT_NE(res, 10);
355 }
356
357
358 /**
359 * @tc.name: OnRemoteRequest13
360 * @tc.desc: test TRANS_ID_UPDATE_WINDOW_RECT success
361 * @tc.type: FUNC
362 */
363 HWTEST_F(WindowStubTest, OnRemoteRequest13, Function | SmallTest | Level2)
364 {
365 MessageParcel data;
366 MessageParcel reply;
367 MessageOption option(MessageOption::TF_ASYNC);
368
369 data.WriteInterfaceToken(WindowStub::GetDescriptor());
370
371 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_RECT);
372 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
373 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
374 }
375
376 /**
377 * @tc.name: OnRemoteRequest14
378 * @tc.desc: test TRANS_ID_UPDATE_WINDOW_MODE success
379 * @tc.type: FUNC
380 */
381 HWTEST_F(WindowStubTest, OnRemoteRequest14, Function | SmallTest | Level2)
382 {
383 MessageParcel data;
384 MessageParcel reply;
385 MessageOption option(MessageOption::TF_ASYNC);
386
387 data.WriteInterfaceToken(WindowStub::GetDescriptor());
388
389 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_MODE);
390 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
391 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
392 }
393
394 /**
395 * @tc.name: OnRemoteRequest15
396 * @tc.desc: test TRANS_ID_UPDATE_MODE_SUPPORT_INFO success
397 * @tc.type: FUNC
398 */
399 HWTEST_F(WindowStubTest, OnRemoteRequest15, Function | SmallTest | Level2)
400 {
401 MessageParcel data;
402 MessageParcel reply;
403 MessageOption option(MessageOption::TF_ASYNC);
404
405 data.WriteInterfaceToken(WindowStub::GetDescriptor());
406
407 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_MODE_SUPPORT_INFO);
408 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
409 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
410 }
411
412 /**
413 * @tc.name: OnRemoteRequest16
414 * @tc.desc: test TRANS_ID_UPDATE_FOCUS_STATUS success
415 * @tc.type: FUNC
416 */
417 HWTEST_F(WindowStubTest, OnRemoteRequest16, Function | SmallTest | Level2)
418 {
419 MessageParcel data;
420 MessageParcel reply;
421 MessageOption option(MessageOption::TF_ASYNC);
422
423 data.WriteInterfaceToken(WindowStub::GetDescriptor());
424
425 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_FOCUS_STATUS);
426 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
427 EXPECT_EQ(res, 0);
428 }
429
430 /**
431 * @tc.name: OnRemoteRequest17
432 * @tc.desc: test TRANS_ID_UPDATE_AVOID_AREA success
433 * @tc.type: FUNC
434 */
435 HWTEST_F(WindowStubTest, OnRemoteRequest17, Function | SmallTest | Level2)
436 {
437 MessageParcel data;
438 MessageParcel reply;
439 MessageOption option(MessageOption::TF_ASYNC);
440
441 data.WriteInterfaceToken(WindowStub::GetDescriptor());
442
443 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_AVOID_AREA);
444 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
445 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
446 }
447
448 /**
449 * @tc.name: OnRemoteRequest18
450 * @tc.desc: test TRANS_ID_UPDATE_WINDOW_STATE success
451 * @tc.type: FUNC
452 */
453 HWTEST_F(WindowStubTest, OnRemoteRequest18, Function | SmallTest | Level2)
454 {
455 MessageParcel data;
456 MessageParcel reply;
457 MessageOption option(MessageOption::TF_ASYNC);
458
459 data.WriteInterfaceToken(WindowStub::GetDescriptor());
460
461 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_WINDOW_STATE);
462 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
463 EXPECT_EQ(res, static_cast<int>(ERR_NONE));
464 }
465
466 /**
467 * @tc.name: OnRemoteRequest19
468 * @tc.desc: test TRANS_ID_UPDATE_DRAG_EVENT success
469 * @tc.type: FUNC
470 */
471 HWTEST_F(WindowStubTest, OnRemoteRequest19, Function | SmallTest | Level2)
472 {
473 MessageParcel data;
474 MessageParcel reply;
475 MessageOption option(MessageOption::TF_ASYNC);
476
477 data.WriteInterfaceToken(WindowStub::GetDescriptor());
478 data.WriteInt32(0);
479 data.WriteInt32(0);
480 data.WriteUint32(1);
481
482 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_DRAG_EVENT);
483 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
484 EXPECT_EQ(res, 0);
485 }
486
487 /**
488 * @tc.name: OnRemoteRequest20
489 * @tc.desc: test TRANS_ID_UPDATE_DISPLAY_ID success
490 * @tc.type: FUNC
491 */
492 HWTEST_F(WindowStubTest, OnRemoteRequest20, Function | SmallTest | Level2)
493 {
494 MessageParcel data;
495 MessageParcel reply;
496 MessageOption option(MessageOption::TF_ASYNC);
497
498 data.WriteInterfaceToken(WindowStub::GetDescriptor());
499
500 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_DISPLAY_ID);
501 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
502 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
503 }
504
505 /**
506 * @tc.name: OnRemoteRequest21
507 * @tc.desc: test TRANS_ID_UPDATE_OCCUPIED_AREA success
508 * @tc.type: FUNC
509 */
510 HWTEST_F(WindowStubTest, OnRemoteRequest21, Function | SmallTest | Level2)
511 {
512 MessageParcel data;
513 MessageParcel reply;
514 MessageOption option(MessageOption::TF_ASYNC);
515
516 data.WriteInterfaceToken(WindowStub::GetDescriptor());
517
518 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA);
519 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
520 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
521 }
522
523 /**
524 * @tc.name: OnRemoteRequest22
525 * @tc.desc: test TRANS_ID_UPDATE_OCCUPIED_AREA_AND_RECT success
526 * @tc.type: FUNC
527 */
528 HWTEST_F(WindowStubTest, OnRemoteRequest22, Function | SmallTest | Level2)
529 {
530 MessageParcel data;
531 MessageParcel reply;
532 MessageOption option(MessageOption::TF_ASYNC);
533
534 data.WriteInterfaceToken(WindowStub::GetDescriptor());
535
536 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_OCCUPIED_AREA_AND_RECT);
537 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
538 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
539 }
540
541 /**
542 * @tc.name: OnRemoteRequest23
543 * @tc.desc: test TRANS_ID_UPDATE_ACTIVE_STATUS success
544 * @tc.type: FUNC
545 */
546 HWTEST_F(WindowStubTest, OnRemoteRequest23, Function | SmallTest | Level2)
547 {
548 MessageParcel data;
549 MessageParcel reply;
550 MessageOption option(MessageOption::TF_ASYNC);
551
552 data.WriteInterfaceToken(WindowStub::GetDescriptor());
553
554 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_ACTIVE_STATUS);
555 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
556 EXPECT_EQ(res, 0);
557 }
558
559 /**
560 * @tc.name: OnRemoteRequest24
561 * @tc.desc: test TRANS_ID_GET_WINDOW_PROPERTY success
562 * @tc.type: FUNC
563 */
564 HWTEST_F(WindowStubTest, OnRemoteRequest24, Function | SmallTest | Level2)
565 {
566 MessageParcel data;
567 MessageParcel reply;
568 MessageOption option(MessageOption::TF_ASYNC);
569
570 data.WriteInterfaceToken(WindowStub::GetDescriptor());
571
572 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_GET_WINDOW_PROPERTY);
573 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
574 EXPECT_EQ(res, 0);
575 }
576
577 /**
578 * @tc.name: OnRemoteRequest25
579 * @tc.desc: test TRANS_ID_NOTIFY_OUTSIDE_PRESSED success
580 * @tc.type: FUNC
581 */
582 HWTEST_F(WindowStubTest, OnRemoteRequest25, Function | SmallTest | Level2)
583 {
584 MessageParcel data;
585 MessageParcel reply;
586 MessageOption option(MessageOption::TF_ASYNC);
587
588 data.WriteInterfaceToken(WindowStub::GetDescriptor());
589
590 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_OUTSIDE_PRESSED);
591 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
592 EXPECT_EQ(res, 0);
593 }
594
595 /**
596 * @tc.name: OnRemoteRequest26
597 * @tc.desc: test TRANS_ID_NOTIFY_SCREEN_SHOT success
598 * @tc.type: FUNC
599 */
600 HWTEST_F(WindowStubTest, OnRemoteRequest26, Function | SmallTest | Level2)
601 {
602 MessageParcel data;
603 MessageParcel reply;
604 MessageOption option(MessageOption::TF_ASYNC);
605
606 data.WriteInterfaceToken(WindowStub::GetDescriptor());
607
608 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_SCREEN_SHOT);
609 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
610 EXPECT_EQ(res, 0);
611 }
612
613 /**
614 * @tc.name: OnRemoteRequest27
615 * @tc.desc: test TRANS_ID_NOTIFY_DESTROY success
616 * @tc.type: FUNC
617 */
618 HWTEST_F(WindowStubTest, OnRemoteRequest27, Function | SmallTest | Level2)
619 {
620 MessageParcel data;
621 MessageParcel reply;
622 MessageOption option(MessageOption::TF_ASYNC);
623
624 data.WriteInterfaceToken(WindowStub::GetDescriptor());
625
626 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_DESTROY);
627 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
628 EXPECT_EQ(res, 0);
629 }
630
631 /**
632 * @tc.name: OnRemoteRequest28
633 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND success
634 * @tc.type: FUNC
635 */
636 HWTEST_F(WindowStubTest, OnRemoteRequest28, Function | SmallTest | Level2)
637 {
638 MessageParcel data;
639 MessageParcel reply;
640 MessageOption option(MessageOption::TF_ASYNC);
641
642 data.WriteInterfaceToken(WindowStub::GetDescriptor());
643
644 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND);
645 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
646 EXPECT_EQ(res, 0);
647 }
648
649 /**
650 * @tc.name: OnRemoteRequest29
651 * @tc.desc: test TRANS_ID_NOTIFY_BACKGROUND success
652 * @tc.type: FUNC
653 */
654 HWTEST_F(WindowStubTest, OnRemoteRequest29, Function | SmallTest | Level2)
655 {
656 MessageParcel data;
657 MessageParcel reply;
658 MessageOption option(MessageOption::TF_ASYNC);
659
660 data.WriteInterfaceToken(WindowStub::GetDescriptor());
661
662 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_BACKGROUND);
663 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
664 EXPECT_EQ(res, 0);
665 }
666
667 /**
668 * @tc.name: OnRemoteRequest30
669 * @tc.desc: test TRANS_ID_DUMP_INFO success
670 * @tc.type: FUNC
671 */
672 HWTEST_F(WindowStubTest, OnRemoteRequest30, Function | SmallTest | Level2)
673 {
674 MessageParcel data;
675 MessageParcel reply;
676 MessageOption option(MessageOption::TF_ASYNC);
677
678 data.WriteInterfaceToken(WindowStub::GetDescriptor());
679
680 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_DUMP_INFO);
681 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
682 EXPECT_EQ(res, 0);
683 }
684
685 /**
686 * @tc.name: OnRemoteRequest31
687 * @tc.desc: test TRANS_ID_NOTIFY_CLIENT_POINT_UP success
688 * @tc.type: FUNC
689 */
690 HWTEST_F(WindowStubTest, OnRemoteRequest31, Function | SmallTest | Level2)
691 {
692 MessageParcel data;
693 MessageParcel reply;
694 MessageOption option(MessageOption::TF_ASYNC);
695
696 data.WriteInterfaceToken(WindowStub::GetDescriptor());
697
698 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_CLIENT_POINT_UP);
699 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
700 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
701 }
702
703 /**
704 * @tc.name: OnRemoteRequest32
705 * @tc.desc: test TRANS_ID_UPDATE_ZOOM_TRANSFORM success
706 * @tc.type: FUNC
707 */
708 HWTEST_F(WindowStubTest, OnRemoteRequest32, Function | SmallTest | Level2)
709 {
710 MessageParcel data;
711 MessageParcel reply;
712 MessageOption option(MessageOption::TF_ASYNC);
713
714 data.WriteInterfaceToken(WindowStub::GetDescriptor());
715
716 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_UPDATE_ZOOM_TRANSFORM);
717 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
718 EXPECT_EQ(res, 0);
719 }
720
721 /**
722 * @tc.name: OnRemoteRequest33
723 * @tc.desc: test TRANS_ID_RESTORE_SPLIT_WINDOW_MODE success
724 * @tc.type: FUNC
725 */
726 HWTEST_F(WindowStubTest, OnRemoteRequest33, Function | SmallTest | Level2)
727 {
728 MessageParcel data;
729 MessageParcel reply;
730 MessageOption option(MessageOption::TF_ASYNC);
731
732 data.WriteInterfaceToken(WindowStub::GetDescriptor());
733
734 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_RESTORE_SPLIT_WINDOW_MODE);
735 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
736 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
737 }
738
739 /**
740 * @tc.name: OnRemoteRequest34
741 * @tc.desc: test TRANS_ID_CONSUME_KEY_EVENT success
742 * @tc.type: FUNC
743 */
744 HWTEST_F(WindowStubTest, OnRemoteRequest34, Function | SmallTest | Level2)
745 {
746 MessageParcel data;
747 MessageParcel reply;
748 MessageOption option(MessageOption::TF_ASYNC);
749
750 data.WriteInterfaceToken(WindowStub::GetDescriptor());
751
752 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_CONSUME_KEY_EVENT);
753 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
754 EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
755 }
756
757 /**
758 * @tc.name: OnRemoteRequest35
759 * @tc.desc: test TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS success
760 * @tc.type: FUNC
761 */
762 HWTEST_F(WindowStubTest, OnRemoteRequest35, Function | SmallTest | Level2)
763 {
764 MessageParcel data;
765 MessageParcel reply;
766 MessageOption option(MessageOption::TF_ASYNC);
767
768 data.WriteInterfaceToken(WindowStub::GetDescriptor());
769
770 uint32_t code = static_cast<uint32_t>(IWindow::WindowMessage::TRANS_ID_NOTIFY_FOREGROUND_INTERACTIVE_STATUS);
771 int res = windowStub_->OnRemoteRequest(code, data, reply, option);
772 EXPECT_EQ(res, 0);
773 }
774 }
775 }
776 }
777