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