• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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_manager_stub_impl.h"
18 
19 using namespace testing;
20 using namespace testing::ext;
21 namespace OHOS {
22 namespace Rosen {
23 class WindowManagerStubTest : public testing::Test {
24 public:
25     static void SetUpTestCase();
26     static void TearDownTestCase();
27     void SetUp() override;
28     void TearDown() override;
29     sptr<WindowManagerStub> stub_;
30 };
31 
SetUpTestCase()32 void WindowManagerStubTest::SetUpTestCase()
33 {
34 }
35 
TearDownTestCase()36 void WindowManagerStubTest::TearDownTestCase()
37 {
38 }
39 
SetUp()40 void WindowManagerStubTest::SetUp()
41 {
42     stub_ = new WindowManagerStubImpl();
43 }
44 
TearDown()45 void WindowManagerStubTest::TearDown()
46 {
47 }
48 
49 namespace {
50 /**
51  * @tc.name: OnRemoteRequest01
52  * @tc.desc: test InterfaceToken check failed
53  * @tc.type: FUNC
54  */
55 HWTEST_F(WindowManagerStubTest, OnRemoteRequest01, Function | SmallTest | Level2)
56 {
57     MessageParcel data;
58     MessageParcel reply;
59     MessageOption option;
60 
61     data.WriteInterfaceToken(u"error.GetDescriptor");
62 
63     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_CREATE_WINDOW);
64 
65     int res = stub_->OnRemoteRequest(code, data, reply, option);
66     EXPECT_EQ(res, static_cast<int>(ERR_TRANSACTION_FAILED));
67 }
68 
69 /**
70  * @tc.name: OnRemoteRequest02
71  * @tc.desc: test TRANS_ID_REMOVE_WINDOW
72  * @tc.type: FUNC
73  */
74 HWTEST_F(WindowManagerStubTest, OnRemoteRequest02, Function | SmallTest | Level2)
75 {
76     MessageParcel data;
77     MessageParcel reply;
78     MessageOption option;
79 
80     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_REMOVE_WINDOW);
81 
82     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
83     data.WriteUint32(1);
84     int res = stub_->OnRemoteRequest(code, data, reply, option);
85     EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
86 
87     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
88     data.WriteBool(false);
89     res = stub_->OnRemoteRequest(code, data, reply, option);
90     EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
91 
92     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
93     data.WriteUint32(1);
94     data.WriteBool(false);
95     res = stub_->OnRemoteRequest(code, data, reply, option);
96     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
97 }
98 
99 /**
100  * @tc.name: OnRemoteRequest03
101  * @tc.desc: test TRANS_ID_REQUEST_FOCUS success
102  * @tc.type: FUNC
103  */
104 HWTEST_F(WindowManagerStubTest, OnRemoteRequest03, Function | SmallTest | Level2)
105 {
106     MessageParcel data;
107     MessageParcel reply;
108     MessageOption option;
109 
110     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
111     data.WriteUint32(1);
112 
113     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_REQUEST_FOCUS);
114 
115     int res = stub_->OnRemoteRequest(code, data, reply, option);
116     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
117 }
118 
119 /**
120  * @tc.name: OnRemoteRequest04
121  * @tc.desc: test TRANS_ID_GET_AVOID_AREA success
122  * @tc.type: FUNC
123  */
124 HWTEST_F(WindowManagerStubTest, OnRemoteRequest04, Function | SmallTest | Level2)
125 {
126     MessageParcel data;
127     MessageParcel reply;
128     MessageOption option;
129 
130     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
131     data.WriteUint32(1);
132     data.WriteUint32(static_cast<uint32_t>(AvoidAreaType::TYPE_CUTOUT));
133 
134     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_GET_AVOID_AREA);
135 
136     int res = stub_->OnRemoteRequest(code, data, reply, option);
137     EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
138 }
139 
140 /**
141  * @tc.name: OnRemoteRequest05
142  * @tc.desc: test TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT success
143  * @tc.type: FUNC
144  */
145 HWTEST_F(WindowManagerStubTest, OnRemoteRequest05, Function | SmallTest | Level2)
146 {
147     MessageParcel data;
148     MessageParcel reply;
149     MessageOption option;
150 
151     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
152     data.WriteUint32(static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_CAMERA_FLOAT));
153     sptr<IWindowManagerAgent> focusChangedListenerAgent = new WindowManagerAgent();
154     data.WriteRemoteObject(focusChangedListenerAgent->AsObject());
155 
156     uint32_t code =
157         static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT);
158 
159     int res = stub_->OnRemoteRequest(code, data, reply, option);
160     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
161 }
162 
163 /**
164  * @tc.name: OnRemoteRequest06
165  * @tc.desc: test TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG success
166  * @tc.type: FUNC
167  */
168 HWTEST_F(WindowManagerStubTest, OnRemoteRequest06, Function | SmallTest | Level2)
169 {
170     MessageParcel data;
171     MessageParcel reply;
172     MessageOption option;
173 
174     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
175     data.WriteUint32(1);
176     sptr<WindowProperty> windowProperty = new WindowProperty();
177     data.WriteParcelable(windowProperty.GetRefPtr());
178     sptr<MoveDragProperty> moveDragProperty = new MoveDragProperty();
179     data.WriteParcelable(moveDragProperty.GetRefPtr());
180 
181     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_NOTIFY_READY_MOVE_OR_DRAG);
182 
183     int res = stub_->OnRemoteRequest(code, data, reply, option);
184     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
185 }
186 
187 /**
188  * @tc.name: OnRemoteRequest07
189  * @tc.desc: test TRANS_ID_PROCESS_POINT_DOWN success
190  * @tc.type: FUNC
191  */
192 HWTEST_F(WindowManagerStubTest, OnRemoteRequest07, Function | SmallTest | Level2)
193 {
194     MessageParcel data;
195     MessageParcel reply;
196     MessageOption option;
197 
198     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
199     data.WriteUint32(1);
200     data.WriteBool(false);
201 
202     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_PROCESS_POINT_DOWN);
203 
204     int res = stub_->OnRemoteRequest(code, data, reply, option);
205     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
206 }
207 
208 /**
209  * @tc.name: OnRemoteRequest08
210  * @tc.desc: test TRANS_ID_PROCESS_POINT_UP success
211  * @tc.type: FUNC
212  */
213 HWTEST_F(WindowManagerStubTest, OnRemoteRequest08, Function | SmallTest | Level2)
214 {
215     MessageParcel data;
216     MessageParcel reply;
217     MessageOption option;
218 
219     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
220     data.WriteUint32(1);
221 
222     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_PROCESS_POINT_UP);
223 
224     int res = stub_->OnRemoteRequest(code, data, reply, option);
225     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
226 }
227 
228 /**
229  * @tc.name: OnRemoteRequest09
230  * @tc.desc: test TRANS_ID_GET_TOP_WINDOW_ID success
231  * @tc.type: FUNC
232  */
233 HWTEST_F(WindowManagerStubTest, OnRemoteRequest09, Function | SmallTest | Level2)
234 {
235     MessageParcel data;
236     MessageParcel reply;
237     MessageOption option;
238 
239     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
240     data.WriteUint32(1);
241 
242     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_GET_TOP_WINDOW_ID);
243 
244     int res = stub_->OnRemoteRequest(code, data, reply, option);
245     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
246 }
247 
248 /**
249  * @tc.name: OnRemoteRequest10
250  * @tc.desc: test TRANS_ID_MINIMIZE_ALL_APP_WINDOWS success
251  * @tc.type: FUNC
252  */
253 HWTEST_F(WindowManagerStubTest, OnRemoteRequest10, Function | SmallTest | Level2)
254 {
255     MessageParcel data;
256     MessageParcel reply;
257     MessageOption option;
258 
259     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
260     data.WriteUint64(0);
261 
262     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_MINIMIZE_ALL_APP_WINDOWS);
263 
264     int res = stub_->OnRemoteRequest(code, data, reply, option);
265     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
266 }
267 
268 /**
269  * @tc.name: OnRemoteRequest11
270  * @tc.desc: test TRANS_ID_TOGGLE_SHOWN_STATE_FOR_ALL_APP_WINDOWS success
271  * @tc.type: FUNC
272  */
273 HWTEST_F(WindowManagerStubTest, OnRemoteRequest11, Function | SmallTest | Level2)
274 {
275     MessageParcel data;
276     MessageParcel reply;
277     MessageOption option;
278 
279     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
280 
281     uint32_t code =
282         static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_TOGGLE_SHOWN_STATE_FOR_ALL_APP_WINDOWS);
283 
284     int res = stub_->OnRemoteRequest(code, data, reply, option);
285     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
286 }
287 
288 /**
289  * @tc.name: OnRemoteRequest12
290  * @tc.desc: test TRANS_ID_UPDATE_LAYOUT_MODE success
291  * @tc.type: FUNC
292  */
293 HWTEST_F(WindowManagerStubTest, OnRemoteRequest12, Function | SmallTest | Level2)
294 {
295     MessageParcel data;
296     MessageParcel reply;
297     MessageOption option;
298 
299     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
300     data.WriteUint32(static_cast<uint32_t>(WindowLayoutMode::CASCADE));
301 
302     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_UPDATE_LAYOUT_MODE);
303 
304     int res = stub_->OnRemoteRequest(code, data, reply, option);
305     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
306 }
307 
308 /**
309  * @tc.name: OnRemoteRequest13
310  * @tc.desc: test TRANS_ID_UPDATE_PROPERTY success
311  * @tc.type: FUNC
312  */
313 HWTEST_F(WindowManagerStubTest, OnRemoteRequest13, Function | SmallTest | Level2)
314 {
315     MessageParcel data;
316     MessageParcel reply;
317     MessageOption option;
318 
319     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
320     data.WriteUint64(static_cast<uint64_t>(PropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG));
321     sptr<WindowProperty> windowProperty = new WindowProperty();
322     windowProperty->Write(data, PropertyChangeAction::ACTION_UPDATE_ANIMATION_FLAG);
323 
324     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_UPDATE_PROPERTY);
325 
326     int res = stub_->OnRemoteRequest(code, data, reply, option);
327     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
328 }
329 
330 /**
331  * @tc.name: OnRemoteRequest14
332  * @tc.desc: test TRANS_ID_ANIMATION_SET_CONTROLLER success
333  * @tc.type: FUNC
334  */
335 HWTEST_F(WindowManagerStubTest, OnRemoteRequest14, Function | SmallTest | Level2)
336 {
337     MessageParcel data;
338     MessageParcel reply;
339     MessageOption option;
340 
341     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
342 
343     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_ANIMATION_SET_CONTROLLER);
344 
345     int res = stub_->OnRemoteRequest(code, data, reply, option);
346     EXPECT_EQ(res, static_cast<int>(ERR_INVALID_DATA));
347 }
348 
349 /**
350  * @tc.name: OnRemoteRequest15
351  * @tc.desc: test TRANS_ID_NOTIFY_WINDOW_TRANSITION success
352  * @tc.type: FUNC
353  */
354 HWTEST_F(WindowManagerStubTest, OnRemoteRequest15, Function | SmallTest | Level2)
355 {
356     MessageParcel data;
357     MessageParcel reply;
358     MessageOption option;
359 
360     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
361     sptr<WindowTransitionInfo> from = new WindowTransitionInfo();
362     sptr<WindowTransitionInfo> to = new WindowTransitionInfo();
363     data.WriteParcelable(from);
364     data.WriteParcelable(to);
365     data.WriteBool(false);
366 
367     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_NOTIFY_WINDOW_TRANSITION);
368 
369     int res = stub_->OnRemoteRequest(code, data, reply, option);
370     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
371 }
372 
373 /**
374  * @tc.name: OnRemoteRequest16
375  * @tc.desc: test TRANS_ID_GET_FULLSCREEN_AND_SPLIT_HOT_ZONE success
376  * @tc.type: FUNC
377  */
378 HWTEST_F(WindowManagerStubTest, OnRemoteRequest16, Function | SmallTest | Level2)
379 {
380     MessageParcel data;
381     MessageParcel reply;
382     MessageOption option;
383 
384     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
385     DisplayId displayId = 0;
386     data.WriteUint64(displayId);
387 
388     uint32_t code =
389         static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_GET_FULLSCREEN_AND_SPLIT_HOT_ZONE);
390 
391     int res = stub_->OnRemoteRequest(code, data, reply, option);
392     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
393 }
394 
395 /**
396  * @tc.name: OnRemoteRequest17
397  * @tc.desc: test TRANS_ID_GET_ANIMATION_CALLBACK success
398  * @tc.type: FUNC
399  */
400 HWTEST_F(WindowManagerStubTest, OnRemoteRequest17, Function | SmallTest | Level2)
401 {
402     MessageParcel data;
403     MessageParcel reply;
404     MessageOption option;
405 
406     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
407     std::vector<uint32_t> windowIds;
408     windowIds.emplace_back(1);
409     windowIds.emplace_back(10);
410     bool isAnimated = false;
411     data.WriteUInt32Vector(windowIds);
412     data.WriteBool(isAnimated);
413 
414     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_GET_ANIMATION_CALLBACK);
415 
416     int res = stub_->OnRemoteRequest(code, data, reply, option);
417     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
418 }
419 
420 /**
421  * @tc.name: OnRemoteRequest18
422  * @tc.desc: test TRANS_ID_UPDATE_RS_TREE success
423  * @tc.type: FUNC
424  */
425 HWTEST_F(WindowManagerStubTest, OnRemoteRequest18, Function | SmallTest | Level2)
426 {
427     MessageParcel data;
428     MessageParcel reply;
429     MessageOption option;
430 
431     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
432     uint32_t windowId = 1;
433     bool isAdd = false;
434     data.WriteUint32(windowId);
435     data.WriteBool(isAdd);
436 
437     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_UPDATE_RS_TREE);
438 
439     int res = stub_->OnRemoteRequest(code, data, reply, option);
440     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
441 }
442 
443 /**
444  * @tc.name: OnRemoteRequest19
445  * @tc.desc: test TRANS_ID_CREATE_WINDOW success
446  * @tc.type: FUNC
447  */
448 HWTEST_F(WindowManagerStubTest, OnRemoteRequest19, Function | SmallTest | Level2)
449 {
450     MessageParcel data;
451     MessageParcel reply;
452     MessageOption option;
453 
454     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
455     sptr<WindowOption> windowOption = new WindowOption();
456     sptr<WindowImpl> windowImpl = new WindowImpl(windowOption);
457     sptr<IWindow> window = new WindowAgent(windowImpl);
458     sptr<WindowProperty> property = nullptr;
459     struct RSSurfaceNodeConfig surfaceNodeConfig;
460     surfaceNodeConfig.SurfaceNodeName = "SurfaceNode";
461     std::shared_ptr<RSSurfaceNode> surNode = RSSurfaceNode::Create(surfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
462     sptr<IRemoteObject> token;
463 
464     data.WriteRemoteObject(window->AsObject());
465     data.WriteParcelable(property.GetRefPtr());
466     surNode->Marshalling(data);
467     data.WriteRemoteObject(token);
468 
469     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_CREATE_WINDOW);
470 
471     int res = stub_->OnRemoteRequest(code, data, reply, option);
472     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
473 }
474 
475 /**
476  * @tc.name: OnRemoteRequest20
477  * @tc.desc: test TRANS_ID_CREATE_WINDOW success
478  * @tc.type: FUNC
479  */
480 HWTEST_F(WindowManagerStubTest, OnRemoteRequest20, Function | SmallTest | Level2)
481 {
482     MessageParcel data;
483     MessageParcel reply;
484     MessageOption option;
485 
486     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
487     sptr<WindowOption> windowOption = new WindowOption();
488     sptr<WindowImpl> windowImpl = new WindowImpl(windowOption);
489     sptr<IWindow> window = new WindowAgent(windowImpl);
490     sptr<WindowProperty> property = new WindowProperty();
491     property->SetTokenState(false);
492     struct RSSurfaceNodeConfig surfaceNodeConfig;
493     surfaceNodeConfig.SurfaceNodeName = "SurfaceNode";
494     std::shared_ptr<RSSurfaceNode> surNode = RSSurfaceNode::Create(surfaceNodeConfig, RSSurfaceNodeType::DEFAULT);
495     sptr<IRemoteObject> token;
496 
497     data.WriteRemoteObject(window->AsObject());
498     data.WriteParcelable(property.GetRefPtr());
499     surNode->Marshalling(data);
500     data.WriteRemoteObject(token);
501 
502     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_CREATE_WINDOW);
503 
504     int res = stub_->OnRemoteRequest(code, data, reply, option);
505     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
506 }
507 
508 /**
509  * @tc.name: OnRemoteRequest21
510  * @tc.desc: test TRANS_ID_RAISE_WINDOW_Z_ORDER success
511  * @tc.type: FUNC
512  */
513 HWTEST_F(WindowManagerStubTest, OnRemoteRequest21, Function | SmallTest | Level2)
514 {
515     MessageParcel data;
516     MessageParcel reply;
517     MessageOption option;
518 
519     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
520     data.WriteUint32(100);
521 
522     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_RAISE_WINDOW_Z_ORDER);
523 
524     int res = stub_->OnRemoteRequest(code, data, reply, option);
525     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
526 }
527 
528 /**
529  * @tc.name: OnRemoteRequest22
530  * @tc.desc: test TRANS_ID_RAISE_WINDOW_Z_ORDER success
531  * @tc.type: FUNC
532  */
533 HWTEST_F(WindowManagerStubTest, OnRemoteRequest22, Function | SmallTest | Level2)
534 {
535     MessageParcel data;
536     MessageParcel reply;
537     MessageOption option;
538 
539     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
540     data.WriteBool(true);
541     uint32_t code = static_cast<uint32_t>(IWindowManager::WindowManagerMessage::TRANS_ID_GESTURE_NAVIGATION_ENABLED);
542     int res = stub_->OnRemoteRequest(code, data, reply, option);
543     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
544 }
545 
546 /**
547  * @tc.name: OnRemoteRequest23
548  * @tc.desc: test TRANS_ID_GET_UNRELIABLE_WINDOW_INFO_ID success
549  * @tc.type: FUNC
550  */
551 HWTEST_F(WindowManagerStubTest, OnRemoteRequest23, Function | SmallTest | Level2)
552 {
553     MessageParcel data;
554     MessageParcel reply;
555     MessageOption option;
556 
557     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
558     data.WriteInt32(0);
559     uint32_t code = static_cast<uint32_t>(
560         IWindowManager::WindowManagerMessage::TRANS_ID_GET_UNRELIABLE_WINDOW_INFO_ID);
561     int res = stub_->OnRemoteRequest(code, data, reply, option);
562     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
563 }
564 
565 /**
566  * @tc.name: OnRemoteRequest24
567  * @tc.desc: test TRANS_ID_GET_SNAPSHOT success
568  * @tc.type: FUNC
569  */
570 HWTEST_F(WindowManagerStubTest, OnRemoteRequest24, Function | SmallTest | Level2)
571 {
572     MessageParcel data;
573     MessageParcel reply;
574     MessageOption option;
575 
576     data.WriteInterfaceToken(WindowManagerStub::GetDescriptor());
577     uint32_t writeValue = 0;
578     data.WriteInt32(writeValue);
579     uint32_t code = static_cast<uint32_t>(
580         IWindowManager::WindowManagerMessage::TRANS_ID_GET_SNAPSHOT);
581     int res = stub_->OnRemoteRequest(code, data, reply, option);
582     EXPECT_EQ(res, static_cast<int>(ERR_NONE));
583 }
584 }
585 }
586 }
587