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, notifyDisplayUpdateImminent, (), (override)); 36 MOCK_METHOD(bool, usePowerHintSession, (), (override)); 37 MOCK_METHOD(bool, supportsPowerHintSession, (), (override)); 38 MOCK_METHOD(bool, isPowerHintSessionRunning, (), (override)); 39 MOCK_METHOD(void, setTargetWorkDuration, (int64_t targetDuration), (override)); 40 MOCK_METHOD(void, sendActualWorkDuration, (), (override)); 41 MOCK_METHOD(void, sendPredictedWorkDuration, (), (override)); 42 MOCK_METHOD(void, enablePowerHint, (bool enabled), (override)); 43 MOCK_METHOD(bool, startPowerHintSession, (const std::vector<int32_t>& threadIds), (override)); 44 MOCK_METHOD(void, setGpuFenceTime, 45 (DisplayId displayId, std::unique_ptr<FenceTime>&& fenceTime), (override)); 46 MOCK_METHOD(void, setHwcValidateTiming, 47 (DisplayId displayId, nsecs_t valiateStartTime, nsecs_t validateEndTime), 48 (override)); 49 MOCK_METHOD(void, setHwcPresentTiming, 50 (DisplayId displayId, nsecs_t presentStartTime, nsecs_t presentEndTime), 51 (override)); 52 MOCK_METHOD(void, setSkippedValidate, (DisplayId displayId, bool skipped), (override)); 53 MOCK_METHOD(void, setRequiresClientComposition, 54 (DisplayId displayId, bool requiresClientComposition), (override)); 55 MOCK_METHOD(void, setExpectedPresentTime, (nsecs_t expectedPresentTime), (override)); 56 MOCK_METHOD(void, setSfPresentTiming, (nsecs_t presentFenceTime, nsecs_t presentEndTime), 57 (override)); 58 MOCK_METHOD(void, setHwcPresentDelayedTime, 59 (DisplayId displayId, 60 std::chrono::steady_clock::time_point earliestFrameStartTime)); 61 MOCK_METHOD(void, setFrameDelay, (nsecs_t frameDelayDuration), (override)); 62 MOCK_METHOD(void, setCommitStart, (nsecs_t commitStartTime), (override)); 63 MOCK_METHOD(void, setCompositeEnd, (nsecs_t compositeEndtime), (override)); 64 MOCK_METHOD(void, setDisplays, (std::vector<DisplayId> & displayIds), (override)); 65 MOCK_METHOD(void, setTotalFrameTargetWorkDuration, (int64_t targetDuration), (override)); 66 }; 67 68 } // namespace android::Hwc2::mock 69