1 /*
2  * Copyright 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <gmock/gmock.h>
20 
21 #include "DisplayHardware/PowerAdvisor.h"
22 
23 namespace android::Hwc2::mock {
24 
25 class PowerAdvisor : public android::Hwc2::PowerAdvisor {
26 public:
27     PowerAdvisor();
28     ~PowerAdvisor() override;
29 
30     MOCK_METHOD(void, init, (), (override));
31     MOCK_METHOD(void, onBootFinished, (), (override));
32     MOCK_METHOD(void, setExpensiveRenderingExpected, (DisplayId displayId, bool expected),
33                 (override));
34     MOCK_METHOD(bool, isUsingExpensiveRendering, (), (override));
35     MOCK_METHOD(void, notifyCpuLoadUp, (), (override));
36     MOCK_METHOD(void, notifyDisplayUpdateImminentAndCpuReset, (), (override));
37     MOCK_METHOD(bool, usePowerHintSession, (), (override));
38     MOCK_METHOD(bool, supportsPowerHintSession, (), (override));
39     MOCK_METHOD(bool, supportsGpuReporting, (), (override));
40     MOCK_METHOD(void, updateTargetWorkDuration, (Duration targetDuration), (override));
41     MOCK_METHOD(void, reportActualWorkDuration, (), (override));
42     MOCK_METHOD(void, enablePowerHintSession, (bool enabled), (override));
43     MOCK_METHOD(bool, startPowerHintSession, (std::vector<int32_t> && threadIds), (override));
44     MOCK_METHOD(void, setGpuStartTime, (DisplayId displayId, TimePoint startTime), (override));
45     MOCK_METHOD(void, setGpuFenceTime,
46                 (DisplayId displayId, std::unique_ptr<FenceTime>&& fenceTime), (override));
47     MOCK_METHOD(void, setHwcValidateTiming,
48                 (DisplayId displayId, TimePoint validateStartTime, TimePoint validateEndTime),
49                 (override));
50     MOCK_METHOD(void, setHwcPresentTiming,
51                 (DisplayId displayId, TimePoint presentStartTime, TimePoint presentEndTime),
52                 (override));
53     MOCK_METHOD(void, setSkippedValidate, (DisplayId displayId, bool skipped), (override));
54     MOCK_METHOD(void, setRequiresRenderEngine, (DisplayId displayId, bool requiresRenderEngine),
55                 (override));
56     MOCK_METHOD(void, setExpectedPresentTime, (TimePoint expectedPresentTime), (override));
57     MOCK_METHOD(void, setSfPresentTiming, (TimePoint presentFenceTime, TimePoint presentEndTime),
58                 (override));
59     MOCK_METHOD(void, setHwcPresentDelayedTime,
60                 (DisplayId displayId, TimePoint earliestFrameStartTime));
61     MOCK_METHOD(void, setFrameDelay, (Duration frameDelayDuration), (override));
62     MOCK_METHOD(void, setCommitStart, (TimePoint commitStartTime), (override));
63     MOCK_METHOD(void, setCompositeEnd, (TimePoint compositeEndTime), (override));
64     MOCK_METHOD(void, setDisplays, (std::vector<DisplayId> & displayIds), (override));
65     MOCK_METHOD(void, setTotalFrameTargetWorkDuration, (Duration targetDuration), (override));
66 };
67 
68 } // namespace android::Hwc2::mock
69