• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 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/HWC2.h"
22 
23 using HWC2::Error;
24 using HWC2::Layer;
25 
26 namespace android {
27 namespace Hwc2 {
28 namespace mock {
29 
30 class Display : public HWC2::Display {
31 public:
32     Display();
33     ~Display();
34 
35     MOCK_CONST_METHOD0(getId, hwc2_layer_t());
36     MOCK_CONST_METHOD0(isConnected, bool());
37     MOCK_METHOD1(setConnected, void(bool));
38     MOCK_CONST_METHOD0(getCapabilities, const std::unordered_set<HWC2::DisplayCapability>&());
39 
40     MOCK_METHOD0(acceptChanges, Error());
41     MOCK_METHOD1(createLayer, Error(Layer**));
42     MOCK_METHOD1(destroyLayer, Error(Layer*));
43     MOCK_CONST_METHOD1(getActiveConfig, Error(std::shared_ptr<const Config>*));
44     MOCK_CONST_METHOD1(getActiveConfigIndex, Error(int* outIndex));
45     MOCK_METHOD1(getChangedCompositionTypes, Error(std::unordered_map<Layer*, HWC2::Composition>*));
46     MOCK_CONST_METHOD1(getColorModes, Error(std::vector<android::ui::ColorMode>*));
47 
48     MOCK_CONST_METHOD0(getSupportedPerFrameMetadata, int32_t());
49     MOCK_CONST_METHOD2(getRenderIntents,
50                        Error(android::ui::ColorMode, std::vector<android::ui::RenderIntent>*));
51     MOCK_METHOD2(getDataspaceSaturationMatrix, Error(android::ui::Dataspace, android::mat4*));
52     MOCK_CONST_METHOD0(getConfigs, std::vector<std::shared_ptr<const Config>>());
53 
54     MOCK_CONST_METHOD1(getName, Error(std::string*));
55     MOCK_METHOD2(getRequests,
56                  Error(HWC2::DisplayRequest*, std::unordered_map<Layer*, HWC2::LayerRequest>*));
57     MOCK_CONST_METHOD1(getType, Error(HWC2::DisplayType*));
58     MOCK_CONST_METHOD1(supportsDoze, Error(bool*));
59     MOCK_CONST_METHOD1(getHdrCapabilities, Error(android::HdrCapabilities*));
60     MOCK_CONST_METHOD3(getDisplayedContentSamplingAttributes,
61                        Error(android::ui::PixelFormat*, android::ui::Dataspace*, uint8_t*));
62     MOCK_CONST_METHOD3(setDisplayContentSamplingEnabled, Error(bool, uint8_t, uint64_t));
63     MOCK_CONST_METHOD3(getDisplayedContentSample,
64                        Error(uint64_t, uint64_t, android::DisplayedFrameStats*));
65     MOCK_CONST_METHOD1(getReleaseFences,
66                        Error(std::unordered_map<Layer*, android::sp<android::Fence>>* outFences));
67     MOCK_METHOD1(present, Error(android::sp<android::Fence>*));
68     MOCK_METHOD1(setActiveConfig, Error(const std::shared_ptr<const HWC2::Display::Config>&));
69     MOCK_METHOD4(setClientTarget,
70                  Error(uint32_t, const android::sp<android::GraphicBuffer>&,
71                        const android::sp<android::Fence>&, android::ui::Dataspace));
72     MOCK_METHOD2(setColorMode, Error(android::ui::ColorMode, android::ui::RenderIntent));
73     MOCK_METHOD2(setColorTransform, Error(const android::mat4&, android_color_transform_t));
74     MOCK_METHOD2(setOutputBuffer,
75                  Error(const android::sp<android::GraphicBuffer>&,
76                        const android::sp<android::Fence>&));
77     MOCK_METHOD1(setPowerMode, Error(HWC2::PowerMode));
78     MOCK_METHOD1(setVsyncEnabled, Error(HWC2::Vsync));
79     MOCK_METHOD2(validate, Error(uint32_t*, uint32_t*));
80     MOCK_METHOD4(presentOrValidate,
81                  Error(uint32_t*, uint32_t*, android::sp<android::Fence>*, uint32_t*));
82     MOCK_CONST_METHOD1(setDisplayBrightness, Error(float));
83 };
84 
85 } // namespace mock
86 } // namespace Hwc2
87 } // namespace android
88