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
25namespace OHOS {
26namespace Rosen {
27class RSIWindowAnimationControllerMocker : public RSIWindowAnimationController {
28public:
29    RSIWindowAnimationControllerMocker()
30    {
31        remoteObject_ = new IRemoteObjectMocker();
32    }
33
34    ~RSIWindowAnimationControllerMocker() {};
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
43    void OnWallpaperUpdate(const sptr<RSWindowAnimationTarget>& wallpaperTarget) override
44    {
45        animationTarget_ = wallpaperTarget;
46        return;
47    }
48
49    void OnStartApp(StartingAppType type, const sptr<RSWindowAnimationTarget>& startingWindowTarget,
50        const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback) override
51    {
52        finishedCallback_ = finishedCallback;
53    }
54
55    void OnAppTransition(const sptr<RSWindowAnimationTarget>& from, const sptr<RSWindowAnimationTarget>& to,
56        const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback)
57    {
58        finishedCallback_ = finishedCallback;
59    }
60
61    void OnAppBackTransition(const sptr<RSWindowAnimationTarget>& from, const sptr<RSWindowAnimationTarget>& to,
62        const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback)
63    {
64        finishedCallback_ = finishedCallback;
65    }
66
67    void OnMinimizeWindow(const sptr<RSWindowAnimationTarget>& minimizingWindow,
68        const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback)
69    {
70        finishedCallback_ = finishedCallback;
71    }
72
73    void OnMinimizeAllWindow(std::vector<sptr<RSWindowAnimationTarget>> minimizingWindows,
74        const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback)
75    {
76        finishedCallback_ = finishedCallback;
77    }
78
79    void OnCloseWindow(const sptr<RSWindowAnimationTarget>& closingWindow,
80        const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback)
81    {
82        finishedCallback_ = finishedCallback;
83    }
84
85    void OnScreenUnlock(const sptr<RSIWindowAnimationFinishedCallback>& finishedCallback)
86    {
87        finishedCallback_ = finishedCallback;
88    }
89
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