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
18 #include "common/rs_vector4.h"
19 #include "rs_window_animation_stub.h"
20 #include "rs_window_animation_finished_callback.h"
21 #include "rs_window_animation_target.h"
22 #include "ui/rs_surface_node.h"
23
24 using namespace testing;
25 using namespace testing::ext;
26
27 namespace OHOS {
28 namespace Rosen {
29 class RSWindowAnimationStubMock : public RSWindowAnimationStub {
30 public:
31 RSWindowAnimationStubMock() = default;
32 virtual ~RSWindowAnimationStubMock() = default;
33
OnStartApp(StartingAppType type,const sptr<RSWindowAnimationTarget> & startingWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)34 void OnStartApp(StartingAppType type, const sptr<RSWindowAnimationTarget>& startingWindowTarget,
35 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
36
OnAppTransition(const sptr<RSWindowAnimationTarget> & fromWindowTarget,const sptr<RSWindowAnimationTarget> & toWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)37 void OnAppTransition(const sptr<RSWindowAnimationTarget>& fromWindowTarget,
38 const sptr<RSWindowAnimationTarget>& toWindowTarget,
39 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
40
OnAppBackTransition(const sptr<RSWindowAnimationTarget> & fromWindowTarget,const sptr<RSWindowAnimationTarget> & toWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)41 void OnAppBackTransition(const sptr<RSWindowAnimationTarget>& fromWindowTarget,
42 const sptr<RSWindowAnimationTarget>& toWindowTarget,
43 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
44
OnMinimizeWindow(const sptr<RSWindowAnimationTarget> & minimizingWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)45 void OnMinimizeWindow(const sptr<RSWindowAnimationTarget>& minimizingWindowTarget,
46 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
47
OnMinimizeAllWindow(std::vector<sptr<RSWindowAnimationTarget>> minimizingWindowsTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)48 void OnMinimizeAllWindow(std::vector<sptr<RSWindowAnimationTarget>> minimizingWindowsTarget,
49 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
50
OnCloseWindow(const sptr<RSWindowAnimationTarget> & closingWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)51 void OnCloseWindow(const sptr<RSWindowAnimationTarget>& closingWindowTarget,
52 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
53
OnScreenUnlock(const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)54 void OnScreenUnlock(const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override {};
55
OnWindowAnimationTargetsUpdate(const sptr<RSWindowAnimationTarget> & fullScreenWindowTarget,const std::vector<sptr<RSWindowAnimationTarget>> & floatingWindowTargets)56 void OnWindowAnimationTargetsUpdate(const sptr<RSWindowAnimationTarget>& fullScreenWindowTarget,
57 const std::vector<sptr<RSWindowAnimationTarget>>& floatingWindowTargets) override {};
58
OnWallpaperUpdate(const sptr<RSWindowAnimationTarget> & wallpaperTarget)59 void OnWallpaperUpdate(const sptr<RSWindowAnimationTarget>& wallpaperTarget) override {};
60 };
61
62 class RSWindowAnimationStubTest : public testing::Test {
63 public:
64 static void SetUpTestCase();
65 static void TearDownTestCase();
66 void SetUp() override;
67 void TearDown() override;
68
69 static sptr<RSWindowAnimationFinishedCallback> finishCallBack_;
70 static std::shared_ptr<RSSurfaceNode> animationSurfaceNode;
71 static sptr<RSWindowAnimationStubMock> windowAnimationStub_;
72 static std::shared_ptr<RSWindowAnimationTarget> windowAnimationTarget_;
73 };
74 sptr<RSWindowAnimationFinishedCallback> RSWindowAnimationStubTest::finishCallBack_ = nullptr;
75 std::shared_ptr<RSSurfaceNode> RSWindowAnimationStubTest::animationSurfaceNode = nullptr;
76 sptr<RSWindowAnimationStubMock> RSWindowAnimationStubTest::windowAnimationStub_ = nullptr;
77 std::shared_ptr<RSWindowAnimationTarget> RSWindowAnimationStubTest::windowAnimationTarget_ =
78 nullptr;
79
SetUpTestCase()80 void RSWindowAnimationStubTest::SetUpTestCase()
81 {
82 finishCallBack_ = new RSWindowAnimationFinishedCallback(nullptr);
83 RSSurfaceNodeConfig config;
84 animationSurfaceNode = RSSurfaceNode::Create(config, true);
85 windowAnimationStub_ = new RSWindowAnimationStubMock();
86 windowAnimationTarget_ = std::make_shared<RSWindowAnimationTarget>();
87 windowAnimationTarget_->bundleName_ = "";
88 windowAnimationTarget_->abilityName_ = "";
89 windowAnimationTarget_->windowBounds_ = RRect();
90 windowAnimationTarget_->surfaceNode_ = animationSurfaceNode;
91 windowAnimationTarget_->windowId_ = 0;
92 windowAnimationTarget_->displayId_ = 0;
93 windowAnimationTarget_->missionId_ = 0;
94 }
TearDownTestCase()95 void RSWindowAnimationStubTest::TearDownTestCase()
96 {
97 windowAnimationStub_ = nullptr;
98 finishCallBack_ = nullptr;
99 }
SetUp()100 void RSWindowAnimationStubTest::SetUp() {}
TearDown()101 void RSWindowAnimationStubTest::TearDown() {}
102
103 /**
104 * @tc.name: OnRemoteRequest001
105 * @tc.desc: Verify the OnRemoteRequest
106 * @tc.type:FUNC
107 */
108 HWTEST_F(RSWindowAnimationStubTest, OnRemoteRequest001, TestSize.Level1)
109 {
110 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest OnRemoteRequest001 start";
111 MessageParcel data;
112 MessageParcel reply;
113 MessageOption option;
114
115 int res = windowAnimationStub_->OnRemoteRequest(
116 RSIWindowAnimationController::ON_START_APP, data, reply, option);
117 ASSERT_EQ(res, ERR_INVALID_STATE);
118 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest OnRemoteRequest001 end";
119 }
120
121 /**
122 * @tc.name: OnRemoteRequest002
123 * @tc.desc: Verify the OnRemoteRequest
124 * @tc.type:FUNC
125 */
126 HWTEST_F(RSWindowAnimationStubTest, OnRemoteRequest002, TestSize.Level1)
127 {
128 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest OnRemoteRequest002 start";
129 MessageParcel data;
130 MessageParcel reply;
131 MessageOption option;
132 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
133 int res = windowAnimationStub_->OnRemoteRequest(-1, data, reply, option);
134 ASSERT_EQ(res, ERR_UNKNOWN_TRANSACTION);
135 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest OnRemoteRequest002 end";
136 }
137
138 /**
139 * @tc.name: StartApp001
140 * @tc.desc: Verify the StartApp
141 * @tc.type:FUNC
142 */
143 HWTEST_F(RSWindowAnimationStubTest, StartApp001, TestSize.Level1)
144 {
145 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp001 start";
146 MessageParcel data;
147 MessageParcel reply;
148 MessageOption option;
149 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
150 data.WriteInt32(StartingAppType::FROM_LAUNCHER);
151 int res = windowAnimationStub_->OnRemoteRequest(
152 RSIWindowAnimationController::ON_START_APP, data, reply, option);
153 ASSERT_EQ(res, ERR_INVALID_DATA);
154 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp001 end";
155 }
156
157 /**
158 * @tc.name: StartApp002
159 * @tc.desc: Verify the StartApp
160 * @tc.type:FUNC
161 */
162 HWTEST_F(RSWindowAnimationStubTest, StartApp002, TestSize.Level1)
163 {
164 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp002 start";
165 MessageParcel data1;
166 MessageParcel reply;
167 MessageOption option;
168 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
169 data1.WriteInt32(StartingAppType::FROM_LAUNCHER);
170 data1.WriteParcelable(windowAnimationTarget_.get());
171 int res = windowAnimationStub_->OnRemoteRequest(
172 RSIWindowAnimationController::ON_START_APP, data1, reply, option);
173 ASSERT_EQ(res, ERR_INVALID_DATA);
174 MessageParcel data2;
175 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
176 data2.WriteInt32(StartingAppType::FROM_LAUNCHER);
177 data2.WriteParcelable(windowAnimationTarget_.get());
178 data2.WriteRemoteObject(finishCallBack_->AsObject());
179 res = windowAnimationStub_->OnRemoteRequest(
180 RSIWindowAnimationController::ON_START_APP, data2, reply, option);
181 ASSERT_EQ(res, ERR_NONE);
182 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest StartApp002 end";
183 }
184
185 /**
186 * @tc.name: AppTransition001
187 * @tc.desc: Verify the AppTransition
188 * @tc.type:FUNC
189 */
190 HWTEST_F(RSWindowAnimationStubTest, AppTransition001, TestSize.Level1)
191 {
192 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppTransition001 start";
193 MessageParcel data;
194 MessageParcel reply;
195 MessageOption option;
196 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
197 int res = windowAnimationStub_->OnRemoteRequest(
198 RSIWindowAnimationController::ON_APP_TRANSITION, data, reply, option);
199 ASSERT_EQ(res, ERR_INVALID_DATA);
200 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppTransition001 end";
201 }
202
203 /**
204 * @tc.name: AppTransition002
205 * @tc.desc: Verify the AppTransition
206 * @tc.type:FUNC
207 */
208 HWTEST_F(RSWindowAnimationStubTest, AppTransition002, TestSize.Level1)
209 {
210 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppTransition001 start";
211 MessageParcel data1;
212 MessageParcel reply;
213 MessageOption option;
214 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
215 data1.WriteParcelable(windowAnimationTarget_.get());
216 int res = windowAnimationStub_->OnRemoteRequest(
217 RSIWindowAnimationController::ON_APP_TRANSITION, data1, reply, option);
218 ASSERT_EQ(res, ERR_INVALID_DATA);
219 MessageParcel data2;
220 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
221 data2.WriteParcelable(windowAnimationTarget_.get());
222 data2.WriteParcelable(windowAnimationTarget_.get());
223 res = windowAnimationStub_->OnRemoteRequest(
224 RSIWindowAnimationController::ON_APP_TRANSITION, data2, reply, option);
225 ASSERT_EQ(res, ERR_INVALID_DATA);
226 MessageParcel data3;
227 data3.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
228 data3.WriteParcelable(windowAnimationTarget_.get());
229 data3.WriteParcelable(windowAnimationTarget_.get());
230 data3.WriteRemoteObject(finishCallBack_->AsObject());
231 res = windowAnimationStub_->OnRemoteRequest(
232 RSIWindowAnimationController::ON_APP_TRANSITION, data3, reply, option);
233 ASSERT_EQ(res, ERR_NONE);
234 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppTransition002 end";
235 }
236
237 /**
238 * @tc.name: AppBackTransition001
239 * @tc.desc: Verify the AppBackTransition
240 * @tc.type:FUNC
241 */
242 HWTEST_F(RSWindowAnimationStubTest, AppBackTransition001, TestSize.Level1)
243 {
244 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppBackTransition001 start";
245 MessageParcel data;
246 MessageParcel reply;
247 MessageOption option;
248 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
249 int res = windowAnimationStub_->OnRemoteRequest(
250 RSIWindowAnimationController::ON_APP_BACK_TRANSITION, data, reply, option);
251 ASSERT_EQ(res, ERR_INVALID_DATA);
252 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppBackTransition001 end";
253 }
254
255 /**
256 * @tc.name: AppBackTransition002
257 * @tc.desc: Verify the AppBackTransition
258 * @tc.type:FUNC
259 */
260 HWTEST_F(RSWindowAnimationStubTest, AppBackTransition002, TestSize.Level1)
261 {
262 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppBackTransition002 start";
263 MessageParcel data1;
264 MessageParcel reply;
265 MessageOption option;
266 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
267 data1.WriteParcelable(windowAnimationTarget_.get());
268 int res = windowAnimationStub_->OnRemoteRequest(
269 RSIWindowAnimationController::ON_APP_BACK_TRANSITION, data1, reply, option);
270 ASSERT_EQ(res, ERR_INVALID_DATA);
271 MessageParcel data2;
272 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
273 data2.WriteParcelable(windowAnimationTarget_.get());
274 data2.WriteParcelable(windowAnimationTarget_.get());
275 res = windowAnimationStub_->OnRemoteRequest(
276 RSIWindowAnimationController::ON_APP_BACK_TRANSITION, data2, reply, option);
277 ASSERT_EQ(res, ERR_INVALID_DATA);
278 MessageParcel data3;
279 data3.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
280 data3.WriteParcelable(windowAnimationTarget_.get());
281 data3.WriteParcelable(windowAnimationTarget_.get());
282 data3.WriteRemoteObject(finishCallBack_->AsObject());
283 res = windowAnimationStub_->OnRemoteRequest(
284 RSIWindowAnimationController::ON_APP_BACK_TRANSITION, data3, reply, option);
285 ASSERT_EQ(res, ERR_NONE);
286 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest AppBackTransition002 end";
287 }
288
289 /**
290 * @tc.name: MinimizeWindow001
291 * @tc.desc: Verify the MinimizeWindow
292 * @tc.type:FUNC
293 */
294 HWTEST_F(RSWindowAnimationStubTest, MinimizeWindow001, TestSize.Level1)
295 {
296 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeWindow001 start";
297 MessageParcel data;
298 MessageParcel reply;
299 MessageOption option;
300 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
301 data.WriteInt32(StartingAppType::FROM_LAUNCHER);
302 int res = windowAnimationStub_->OnRemoteRequest(
303 RSIWindowAnimationController::ON_MINIMIZE_WINDOW, data, reply, option);
304 ASSERT_EQ(res, ERR_INVALID_DATA);
305 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeWindow001 end";
306 }
307
308 /**
309 * @tc.name: MinimizeWindow002
310 * @tc.desc: Verify the MinimizeWindow
311 * @tc.type:FUNC
312 */
313 HWTEST_F(RSWindowAnimationStubTest, MinimizeWindow002, TestSize.Level1)
314 {
315 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeWindow002 start";
316 MessageParcel data1;
317 MessageParcel reply;
318 MessageOption option;
319 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
320 data1.WriteParcelable(windowAnimationTarget_.get());
321 int res = windowAnimationStub_->OnRemoteRequest(
322 RSIWindowAnimationController::ON_MINIMIZE_WINDOW, data1, reply, option);
323 ASSERT_EQ(res, ERR_INVALID_DATA);
324 MessageParcel data2;
325 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
326 data2.WriteParcelable(windowAnimationTarget_.get());
327 data2.WriteRemoteObject(finishCallBack_->AsObject());
328 res = windowAnimationStub_->OnRemoteRequest(
329 RSIWindowAnimationController::ON_MINIMIZE_WINDOW, data2, reply, option);
330 ASSERT_EQ(res, ERR_NONE);
331 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeWindow002 end";
332 }
333
334 /**
335 * @tc.name: MinimizeAllWindow001
336 * @tc.desc: Verify the MinimizeAllWindow
337 * @tc.type:FUNC
338 */
339 HWTEST_F(RSWindowAnimationStubTest, MinimizeAllWindow001, TestSize.Level1)
340 {
341 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeAllWindow001 start";
342 MessageParcel data;
343 MessageParcel reply;
344 MessageOption option;
345 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
346 data.WriteInt32(StartingAppType::FROM_LAUNCHER);
347 data.WriteUint32(1);
348 int res = windowAnimationStub_->OnRemoteRequest(
349 RSIWindowAnimationController::ON_MINIMIZE_ALLWINDOW, data, reply, option);
350 ASSERT_EQ(res, ERR_INVALID_DATA);
351 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeAllWindow001 end";
352 }
353
354 /**
355 * @tc.name: MinimizeAllWindow002
356 * @tc.desc: Verify the MinimizeAllWindow
357 * @tc.type:FUNC
358 */
359 HWTEST_F(RSWindowAnimationStubTest, MinimizeAllWindow002, TestSize.Level1)
360 {
361 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeAllWindow002 start";
362 MessageParcel data1;
363 MessageParcel reply;
364 MessageOption option;
365 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
366 data1.WriteUint32(1);
367 data1.WriteParcelable(windowAnimationTarget_.get());
368 int res = windowAnimationStub_->OnRemoteRequest(
369 RSIWindowAnimationController::ON_MINIMIZE_ALLWINDOW, data1, reply, option);
370 ASSERT_EQ(res, ERR_INVALID_DATA);
371 MessageParcel data2;
372 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
373 data2.WriteUint32(1);
374 data2.WriteParcelable(windowAnimationTarget_.get());
375 data2.WriteRemoteObject(finishCallBack_->AsObject());
376 res = windowAnimationStub_->OnRemoteRequest(
377 RSIWindowAnimationController::ON_MINIMIZE_ALLWINDOW, data2, reply, option);
378 ASSERT_EQ(res, ERR_NONE);
379 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest MinimizeAllWindow002 end";
380 }
381
382 /**
383 * @tc.name: CloseWindow001
384 * @tc.desc: Verify the CloseWindow
385 * @tc.type:FUNC
386 */
387 HWTEST_F(RSWindowAnimationStubTest, CloseWindow001, TestSize.Level1)
388 {
389 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWindow001 start";
390 MessageParcel data;
391 MessageParcel reply;
392 MessageOption option;
393 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
394 int res = windowAnimationStub_->OnRemoteRequest(
395 RSIWindowAnimationController::ON_CLOSE_WINDOW, data, reply, option);
396 ASSERT_EQ(res, ERR_INVALID_DATA);
397 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWindow001 end";
398 }
399
400 /**
401 * @tc.name: CloseWindow002
402 * @tc.desc: Verify the CloseWindow
403 * @tc.type:FUNC
404 */
405 HWTEST_F(RSWindowAnimationStubTest, CloseWindow002, TestSize.Level1)
406 {
407 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWindow002 start";
408 MessageParcel data1;
409 MessageParcel reply;
410 MessageOption option;
411 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
412 data1.WriteParcelable(windowAnimationTarget_.get());
413 int res = windowAnimationStub_->OnRemoteRequest(
414 RSIWindowAnimationController::ON_CLOSE_WINDOW, data1, reply, option);
415 ASSERT_EQ(res, ERR_INVALID_DATA);
416 MessageParcel data2;
417 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
418 data2.WriteParcelable(windowAnimationTarget_.get());
419 data2.WriteRemoteObject(finishCallBack_->AsObject());
420 res = windowAnimationStub_->OnRemoteRequest(
421 RSIWindowAnimationController::ON_CLOSE_WINDOW, data2, reply, option);
422 ASSERT_EQ(res, ERR_NONE);
423 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWindow002 end";
424 }
425
426 /**
427 * @tc.name: ScreenUnlock001
428 * @tc.desc: Verify the ScreenUnlock
429 * @tc.type:FUNC
430 */
431 HWTEST_F(RSWindowAnimationStubTest, ScreenUnlock001, TestSize.Level1)
432 {
433 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest ScreenUnlock001 start";
434 MessageParcel data1;
435 MessageParcel reply;
436 MessageOption option;
437 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
438 int res = windowAnimationStub_->OnRemoteRequest(
439 RSIWindowAnimationController::ON_SCREEN_UNLOCK, data1, reply, option);
440 ASSERT_EQ(res, ERR_INVALID_DATA);
441 MessageParcel data2;
442 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
443 data2.WriteRemoteObject(finishCallBack_->AsObject());
444 res = windowAnimationStub_->OnRemoteRequest(
445 RSIWindowAnimationController::ON_SCREEN_UNLOCK, data2, reply, option);
446 ASSERT_EQ(res, ERR_NONE);
447 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest ScreenUnlock001 end";
448 }
449
450 /**
451 * @tc.name: WindowAnimationTargetsUpdate001
452 * @tc.desc: Verify the WindowAnimationTargetsUpdate
453 * @tc.type:FUNC
454 */
455 HWTEST_F(RSWindowAnimationStubTest, WindowAnimationTargetsUpdate001, TestSize.Level1)
456 {
457 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest WindowAnimationTargetsUpdate001 start";
458 MessageParcel reply;
459 MessageOption option;
460 MessageParcel data1;
461 data1.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
462 data1.WriteBool(false);
463 data1.WriteUint32(1000);
464 int res = windowAnimationStub_->OnRemoteRequest(
465 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data1, reply, option);
466 ASSERT_EQ(res, ERR_INVALID_DATA);
467 MessageParcel data2;
468 data2.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
469 data2.WriteBool(false);
470 data2.WriteUint32(1);
471 res = windowAnimationStub_->OnRemoteRequest(
472 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data2, reply, option);
473 ASSERT_EQ(res, ERR_INVALID_DATA);
474 MessageParcel data3;
475 data3.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
476 data3.WriteBool(false);
477 data3.WriteUint32(1);
478 data3.WriteParcelable(windowAnimationTarget_.get());
479 res = windowAnimationStub_->OnRemoteRequest(
480 RSIWindowAnimationController::ON_WINDOW_ANIMATION_TARGETS_UPDATE, data3, reply, option);
481 ASSERT_EQ(res, ERR_NONE);
482 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest CloseWinWindowAnimationTargetsUpdate001dow001 end";
483 }
484
485 /**
486 * @tc.name: WallpaperUpdate001
487 * @tc.desc: Verify the WallpaperUpdate
488 * @tc.type:FUNC
489 */
490 HWTEST_F(RSWindowAnimationStubTest, WallpaperUpdate001, TestSize.Level1)
491 {
492 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest WallpaperUpdate001 start";
493 MessageParcel data;
494 MessageParcel reply;
495 MessageOption option;
496 data.WriteInterfaceToken(RSIWindowAnimationController::GetDescriptor());
497 data.WriteInt32(StartingAppType::FROM_LAUNCHER);
498 int res = windowAnimationStub_->OnRemoteRequest(
499 RSIWindowAnimationController::ON_WALLPAPER_UPDATE, data, reply, option);
500 ASSERT_EQ(res, ERR_NONE);
501 GTEST_LOG_(INFO) << "RSWindowAnimationStubTest WallpaperUpdate001 end";
502 }
503 } // namespace Rosen
504 } // namespace OHOS