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 #ifndef FRAMEWORKS_WM_TEST_UT_MOCK_RSIWINDOWANIMATIONCONTROLLER_H 16 #define FRAMEWORKS_WM_TEST_UT_MOCK_RSIWINDOWANIMATIONCONTROLLER_H 17 18 #include <vector> 19 #include <iremote_broker.h> 20 #include <gmock/gmock.h> 21 22 #include "rs_iwindow_animation_controller.h" 23 #include "iremote_object_mocker.h" 24 25 namespace OHOS { 26 namespace Rosen { 27 class RSIWindowAnimationControllerMocker : public RSIWindowAnimationController { 28 public: RSIWindowAnimationControllerMocker()29 RSIWindowAnimationControllerMocker() 30 { 31 remoteObject_ = new IRemoteObjectMocker(); 32 } 33 ~RSIWindowAnimationControllerMocker()34 ~RSIWindowAnimationControllerMocker() {}; OnWindowAnimationTargetsUpdate(const sptr<RSWindowAnimationTarget> & fullScreenWindowTarget,const std::vector<sptr<RSWindowAnimationTarget>> & floatingWindowTargets)35 void OnWindowAnimationTargetsUpdate(const sptr<RSWindowAnimationTarget>& fullScreenWindowTarget, 36 const std::vector<sptr<RSWindowAnimationTarget>>& floatingWindowTargets) override 37 { 38 animationTarget_ = fullScreenWindowTarget; 39 floatingWindowTargets_ = floatingWindowTargets; 40 return; 41 } 42 OnWallpaperUpdate(const sptr<RSWindowAnimationTarget> & wallpaperTarget)43 void OnWallpaperUpdate(const sptr<RSWindowAnimationTarget>& wallpaperTarget) override 44 { 45 animationTarget_ = wallpaperTarget; 46 return; 47 } 48 OnStartApp(StartingAppType type,const sptr<RSWindowAnimationTarget> & startingWindowTarget,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)49 void OnStartApp(StartingAppType type, const sptr<RSWindowAnimationTarget>& startingWindowTarget, 50 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override 51 { 52 finishedCallback_ = finishedCallback; 53 } 54 OnAppTransition(const sptr<RSWindowAnimationTarget> & from,const sptr<RSWindowAnimationTarget> & to,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)55 void OnAppTransition(const sptr<RSWindowAnimationTarget>& from, const sptr<RSWindowAnimationTarget>& to, 56 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) 57 { 58 finishedCallback_ = finishedCallback; 59 } 60 OnAppBackTransition(const sptr<RSWindowAnimationTarget> & from,const sptr<RSWindowAnimationTarget> & to,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)61 void OnAppBackTransition(const sptr<RSWindowAnimationTarget>& from, const sptr<RSWindowAnimationTarget>& to, 62 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) 63 { 64 finishedCallback_ = finishedCallback; 65 } 66 OnMinimizeWindow(const sptr<RSWindowAnimationTarget> & minimizingWindow,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)67 void OnMinimizeWindow(const sptr<RSWindowAnimationTarget>& minimizingWindow, 68 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) 69 { 70 finishedCallback_ = finishedCallback; 71 } 72 OnMinimizeAllWindow(std::vector<sptr<RSWindowAnimationTarget>> minimizingWindows,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)73 void OnMinimizeAllWindow(std::vector<sptr<RSWindowAnimationTarget>> minimizingWindows, 74 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) 75 { 76 finishedCallback_ = finishedCallback; 77 } 78 OnCloseWindow(const sptr<RSWindowAnimationTarget> & closingWindow,const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)79 void OnCloseWindow(const sptr<RSWindowAnimationTarget>& closingWindow, 80 const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) 81 { 82 finishedCallback_ = finishedCallback; 83 } 84 OnScreenUnlock(const sptr<RSIWindowAnimationFinishedCallback> & finishedCallback)85 void OnScreenUnlock(const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) 86 { 87 finishedCallback_ = finishedCallback; 88 } 89 AsObject()90 sptr<IRemoteObject> AsObject() override 91 { 92 return remoteObject_; 93 }; 94 95 sptr<RSIWindowAnimationFinishedCallback> finishedCallback_ = nullptr; 96 sptr<IRemoteObject> remoteObject_ = nullptr; 97 sptr<RSWindowAnimationTarget> animationTarget_ = nullptr; 98 std::vector<sptr<RSWindowAnimationTarget>> floatingWindowTargets_; 99 }; 100 } // namespace Rosen 101 } // namespace OHOS 102 #endif // FRAMEWORKS_WM_TEST_UT_MOCK_RSIWINDOWANIMATIONCONTROLLER_H