summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/tests/unittests/mock/DisplayHardware/MockDisplay.h
blob: fe99e771584001a124cb4f8290c872dd93a38760 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*
 * Copyright 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <gmock/gmock.h>

#include "DisplayHardware/HWC2.h"

using android::HWC2::Layer;

namespace android {
namespace Hwc2 {
namespace mock {

namespace hal = android::hardware::graphics::composer::hal;

class Display : public HWC2::Display {
public:
    using Layer = ::Layer;

    Display();
    ~Display();

    MOCK_CONST_METHOD0(getId, hal::HWDisplayId());
    MOCK_CONST_METHOD0(isConnected, bool());
    MOCK_METHOD1(setConnected, void(bool));
    MOCK_CONST_METHOD0(getCapabilities, const std::unordered_set<hal::DisplayCapability>&());

    MOCK_METHOD0(acceptChanges, hal::Error());
    MOCK_METHOD1(createLayer, hal::Error(Layer**));
    MOCK_METHOD1(destroyLayer, hal::Error(Layer*));
    MOCK_CONST_METHOD1(getActiveConfig, hal::Error(std::shared_ptr<const Config>*));
    MOCK_CONST_METHOD1(getActiveConfigIndex, hal::Error(int* outIndex));
    MOCK_METHOD1(getChangedCompositionTypes,
                 hal::Error(std::unordered_map<Layer*, hal::Composition>*));
    MOCK_CONST_METHOD1(getColorModes, hal::Error(std::vector<hal::ColorMode>*));

    MOCK_CONST_METHOD0(getSupportedPerFrameMetadata, int32_t());
    MOCK_CONST_METHOD2(getRenderIntents,
                       hal::Error(hal::ColorMode, std::vector<hal::RenderIntent>*));
    MOCK_METHOD2(getDataspaceSaturationMatrix, hal::Error(hal::Dataspace, android::mat4*));
    MOCK_CONST_METHOD0(getConfigs, std::vector<std::shared_ptr<const Config>>());

    MOCK_CONST_METHOD1(getName, hal::Error(std::string*));
    MOCK_METHOD2(getRequests,
                 hal::Error(hal::DisplayRequest*, std::unordered_map<Layer*, hal::LayerRequest>*));
    MOCK_CONST_METHOD1(getType, hal::Error(hal::DisplayType*));
    MOCK_CONST_METHOD1(supportsDoze, hal::Error(bool*));
    MOCK_CONST_METHOD1(getHdrCapabilities, hal::Error(android::HdrCapabilities*));
    MOCK_CONST_METHOD3(getDisplayedContentSamplingAttributes,
                       hal::Error(hal::PixelFormat*, hal::Dataspace*, uint8_t*));
    MOCK_CONST_METHOD3(setDisplayContentSamplingEnabled, hal::Error(bool, uint8_t, uint64_t));
    MOCK_CONST_METHOD3(getDisplayedContentSample,
                       hal::Error(uint64_t, uint64_t, android::DisplayedFrameStats*));
    MOCK_CONST_METHOD1(
            getReleaseFences,
            hal::Error(std::unordered_map<Layer*, android::sp<android::Fence>>* outFences));
    MOCK_METHOD1(present, hal::Error(android::sp<android::Fence>*));
    MOCK_METHOD1(setActiveConfig, hal::Error(const std::shared_ptr<const HWC2::Display::Config>&));
    MOCK_METHOD4(setClientTarget,
                 hal::Error(uint32_t, const android::sp<android::GraphicBuffer>&,
                            const android::sp<android::Fence>&, hal::Dataspace));
    MOCK_METHOD2(setColorMode, hal::Error(hal::ColorMode, hal::RenderIntent));
    MOCK_METHOD2(setColorTransform, hal::Error(const android::mat4&, hal::ColorTransform));
    MOCK_METHOD2(setOutputBuffer,
                 hal::Error(const android::sp<android::GraphicBuffer>&,
                            const android::sp<android::Fence>&));
    MOCK_METHOD1(setPowerMode, hal::Error(hal::PowerMode));
    MOCK_METHOD1(setVsyncEnabled, hal::Error(hal::Vsync));
    MOCK_METHOD2(validate, hal::Error(uint32_t*, uint32_t*));
    MOCK_METHOD4(presentOrValidate,
                 hal::Error(uint32_t*, uint32_t*, android::sp<android::Fence>*, uint32_t*));
    MOCK_METHOD1(setDisplayBrightness, std::future<hal::Error>(float));
    MOCK_CONST_METHOD1(getDisplayVsyncPeriod, hal::Error(nsecs_t*));
    MOCK_METHOD3(setActiveConfigWithConstraints,
                 hal::Error(const std::shared_ptr<const HWC2::Display::Config>&,
                            const hal::VsyncPeriodChangeConstraints&,
                            hal::VsyncPeriodChangeTimeline*));
    MOCK_METHOD1(setAutoLowLatencyMode, hal::Error(bool on));
    MOCK_CONST_METHOD1(getSupportedContentTypes, hal::Error(std::vector<hal::ContentType>*));
    MOCK_METHOD1(setContentType, hal::Error(hal::ContentType));
    MOCK_METHOD1(getClientTargetProperty, hal::Error(hal::ClientTargetProperty*));
    MOCK_CONST_METHOD1(getConnectionType, hal::Error(android::DisplayConnectionType*));
    MOCK_CONST_METHOD0(isVsyncPeriodSwitchSupported, bool());
};

} // namespace mock
} // namespace Hwc2
} // namespace android