| Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 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 |  | 
| Lloyd Pique | 37c2c9b | 2018-12-04 17:25:10 -0800 | [diff] [blame] | 19 | #include <compositionengine/Output.h> | 
| Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 20 | #include <gmock/gmock.h> | 
|  | 21 |  | 
| Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 22 | #include "DisplayHardware/HWComposer.h" | 
|  | 23 |  | 
|  | 24 | namespace android { | 
|  | 25 | namespace mock { | 
|  | 26 |  | 
|  | 27 | class HWComposer : public android::HWComposer { | 
|  | 28 | public: | 
|  | 29 | HWComposer(); | 
|  | 30 | ~HWComposer() override; | 
|  | 31 |  | 
|  | 32 | MOCK_METHOD2(registerCallback, void(HWC2::ComposerCallback*, int32_t)); | 
|  | 33 | MOCK_CONST_METHOD3(getDisplayIdentificationData, | 
|  | 34 | bool(hwc2_display_t, uint8_t*, DisplayIdentificationData*)); | 
|  | 35 | MOCK_CONST_METHOD1(hasCapability, bool(HWC2::Capability)); | 
|  | 36 | MOCK_CONST_METHOD2(hasDisplayCapability, | 
|  | 37 | bool(const std::optional<DisplayId>&, HWC2::DisplayCapability)); | 
|  | 38 |  | 
|  | 39 | MOCK_METHOD3(allocateVirtualDisplay, | 
|  | 40 | std::optional<DisplayId>(uint32_t, uint32_t, ui::PixelFormat*)); | 
|  | 41 | MOCK_METHOD1(createLayer, HWC2::Layer*(DisplayId)); | 
|  | 42 | MOCK_METHOD2(destroyLayer, void(DisplayId, HWC2::Layer*)); | 
| Lloyd Pique | 37c2c9b | 2018-12-04 17:25:10 -0800 | [diff] [blame] | 43 | MOCK_METHOD2(prepare, status_t(DisplayId, const compositionengine::Output&)); | 
| Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 44 | MOCK_METHOD5(setClientTarget, | 
|  | 45 | status_t(DisplayId, uint32_t, const sp<Fence>&, const sp<GraphicBuffer>&, | 
|  | 46 | ui::Dataspace)); | 
|  | 47 | MOCK_METHOD1(presentAndGetReleaseFences, status_t(DisplayId)); | 
|  | 48 | MOCK_METHOD2(setPowerMode, status_t(DisplayId, int)); | 
|  | 49 | MOCK_METHOD2(setActiveConfig, status_t(DisplayId, size_t)); | 
|  | 50 | MOCK_METHOD2(setColorTransform, status_t(DisplayId, const mat4&)); | 
|  | 51 | MOCK_METHOD1(disconnectDisplay, void(DisplayId)); | 
|  | 52 | MOCK_CONST_METHOD1(hasDeviceComposition, bool(const std::optional<DisplayId>&)); | 
|  | 53 | MOCK_CONST_METHOD1(hasFlipClientTargetRequest, bool(const std::optional<DisplayId>&)); | 
|  | 54 | MOCK_CONST_METHOD1(hasClientComposition, bool(const std::optional<DisplayId>&)); | 
|  | 55 | MOCK_CONST_METHOD1(getPresentFence, sp<Fence>(DisplayId)); | 
|  | 56 | MOCK_CONST_METHOD2(getLayerReleaseFence, sp<Fence>(DisplayId, HWC2::Layer*)); | 
|  | 57 | MOCK_METHOD3(setOutputBuffer, status_t(DisplayId, const sp<Fence>&, const sp<GraphicBuffer>&)); | 
|  | 58 | MOCK_METHOD1(clearReleaseFences, void(DisplayId)); | 
|  | 59 | MOCK_METHOD2(getHdrCapabilities, status_t(DisplayId, HdrCapabilities*)); | 
|  | 60 | MOCK_CONST_METHOD1(getSupportedPerFrameMetadata, int32_t(DisplayId)); | 
|  | 61 | MOCK_CONST_METHOD2(getRenderIntents, std::vector<ui::RenderIntent>(DisplayId, ui::ColorMode)); | 
|  | 62 | MOCK_METHOD2(getDataspaceSaturationMatrix, mat4(DisplayId, ui::Dataspace)); | 
|  | 63 | MOCK_METHOD4(getDisplayedContentSamplingAttributes, | 
|  | 64 | status_t(DisplayId, ui::PixelFormat*, ui::Dataspace*, uint8_t*)); | 
|  | 65 | MOCK_METHOD4(setDisplayContentSamplingEnabled, status_t(DisplayId, bool, uint8_t, uint64_t)); | 
|  | 66 | MOCK_METHOD4(getDisplayedContentSample, | 
|  | 67 | status_t(DisplayId, uint64_t, uint64_t, DisplayedFrameStats*)); | 
| Dan Gittik | 57e63c5 | 2019-01-18 16:37:54 +0000 | [diff] [blame] | 68 | MOCK_METHOD2(setDisplayBrightness, status_t(DisplayId, float)); | 
|  | 69 | MOCK_METHOD2(getDisplayBrightnessSupport, status_t(DisplayId, bool*)); | 
| Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 70 |  | 
|  | 71 | MOCK_METHOD2(onHotplug, | 
|  | 72 | std::optional<DisplayIdentificationInfo>(hwc2_display_t, HWC2::Connection)); | 
|  | 73 | MOCK_METHOD2(onVsync, bool(hwc2_display_t, int64_t)); | 
|  | 74 | MOCK_METHOD2(setVsyncEnabled, void(DisplayId, HWC2::Vsync)); | 
|  | 75 | MOCK_CONST_METHOD1(getRefreshTimestamp, nsecs_t(DisplayId)); | 
|  | 76 | MOCK_CONST_METHOD1(isConnected, bool(DisplayId)); | 
|  | 77 | MOCK_CONST_METHOD1(getConfigs, | 
|  | 78 | std::vector<std::shared_ptr<const HWC2::Display::Config>>(DisplayId)); | 
|  | 79 | MOCK_CONST_METHOD1(getActiveConfig, std::shared_ptr<const HWC2::Display::Config>(DisplayId)); | 
|  | 80 | MOCK_CONST_METHOD1(getActiveConfigIndex, int(DisplayId)); | 
|  | 81 | MOCK_CONST_METHOD1(getColorModes, std::vector<ui::ColorMode>(DisplayId)); | 
|  | 82 | MOCK_METHOD3(setActiveColorMode, status_t(DisplayId, ui::ColorMode, ui::RenderIntent)); | 
|  | 83 | MOCK_CONST_METHOD0(isUsingVrComposer, bool()); | 
|  | 84 |  | 
|  | 85 | MOCK_CONST_METHOD1(dump, void(std::string&)); | 
|  | 86 | MOCK_CONST_METHOD0(getComposer, android::Hwc2::Composer*()); | 
|  | 87 | MOCK_CONST_METHOD1(getHwcDisplayId, std::optional<hwc2_display_t>(int32_t)); | 
|  | 88 | MOCK_CONST_METHOD0(getInternalHwcDisplayId, std::optional<hwc2_display_t>()); | 
|  | 89 | MOCK_CONST_METHOD0(getExternalHwcDisplayId, std::optional<hwc2_display_t>()); | 
|  | 90 | MOCK_CONST_METHOD1(toPhysicalDisplayId, std::optional<DisplayId>(hwc2_display_t)); | 
|  | 91 | MOCK_CONST_METHOD1(fromPhysicalDisplayId, std::optional<hwc2_display_t>(DisplayId)); | 
|  | 92 | }; | 
|  | 93 |  | 
|  | 94 | } // namespace mock | 
|  | 95 | } // namespace android |