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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/*
* Copyright 2021 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"
namespace android::HWC2::mock {
class Display : public HWC2::Display {
public:
Display();
~Display() override;
MOCK_METHOD(hal::HWDisplayId, getId, (), (const, override));
MOCK_METHOD(bool, isConnected, (), (const, override));
MOCK_METHOD(void, setConnected, (bool), (override));
MOCK_METHOD(const std::unordered_set<hal::DisplayCapability> &, getCapabilities, (),
(const, override));
MOCK_METHOD(bool, isVsyncPeriodSwitchSupported, (), (const, override));
MOCK_METHOD(void, onLayerDestroyed, (hal::HWLayerId), (override));
MOCK_METHOD(hal::Error, acceptChanges, (), (override));
MOCK_METHOD((base::expected<std::shared_ptr<HWC2::Layer>, hal::Error>), createLayer, (),
(override));
MOCK_METHOD(hal::Error, getChangedCompositionTypes,
((std::unordered_map<Layer *, hal::Composition> *)), (override));
MOCK_METHOD(hal::Error, getColorModes, (std::vector<hal::ColorMode> *), (const, override));
MOCK_METHOD(int32_t, getSupportedPerFrameMetadata, (), (const, override));
MOCK_METHOD(hal::Error, getRenderIntents, (hal::ColorMode, std::vector<hal::RenderIntent> *),
(const, override));
MOCK_METHOD(hal::Error, getDataspaceSaturationMatrix, (hal::Dataspace, android::mat4 *),
(override));
MOCK_METHOD(hal::Error, getName, (std::string *), (const, override));
MOCK_METHOD(hal::Error, getRequests,
(hal::DisplayRequest *, (std::unordered_map<Layer *, hal::LayerRequest> *)),
(override));
MOCK_METHOD(hal::Error, getConnectionType, (ui::DisplayConnectionType *), (const, override));
MOCK_METHOD(hal::Error, supportsDoze, (bool *), (const, override));
MOCK_METHOD(hal::Error, getHdrCapabilities, (android::HdrCapabilities *), (const, override));
MOCK_METHOD(hal::Error, getDisplayedContentSamplingAttributes,
(hal::PixelFormat *, hal::Dataspace *, uint8_t *), (const, override));
MOCK_METHOD(hal::Error, setDisplayContentSamplingEnabled, (bool, uint8_t, uint64_t),
(const, override));
MOCK_METHOD(hal::Error, getDisplayedContentSample,
(uint64_t, uint64_t, android::DisplayedFrameStats *), (const, override));
MOCK_METHOD(hal::Error, getReleaseFences,
((std::unordered_map<Layer *, android::sp<android::Fence>> *)), (const, override));
MOCK_METHOD(hal::Error, present, (android::sp<android::Fence> *), (override));
MOCK_METHOD(hal::Error, setClientTarget,
(uint32_t, const android::sp<android::GraphicBuffer> &,
const android::sp<android::Fence> &, hal::Dataspace),
(override));
MOCK_METHOD(hal::Error, setColorMode, (hal::ColorMode, hal::RenderIntent), (override));
MOCK_METHOD(hal::Error, setColorTransform, (const android::mat4 &, hal::ColorTransform),
(override));
MOCK_METHOD(hal::Error, setOutputBuffer,
(const android::sp<android::GraphicBuffer> &, const android::sp<android::Fence> &),
(override));
MOCK_METHOD(hal::Error, setPowerMode, (hal::PowerMode), (override));
MOCK_METHOD(hal::Error, setVsyncEnabled, (hal::Vsync), (override));
MOCK_METHOD(hal::Error, validate, (uint32_t *, uint32_t *), (override));
MOCK_METHOD(hal::Error, presentOrValidate,
(uint32_t *, uint32_t *, android::sp<android::Fence> *, uint32_t *), (override));
MOCK_METHOD(std::future<hal::Error>, setDisplayBrightness, (float), (override));
MOCK_METHOD(hal::Error, setActiveConfigWithConstraints,
(hal::HWConfigId, const hal::VsyncPeriodChangeConstraints &,
hal::VsyncPeriodChangeTimeline *),
(override));
MOCK_METHOD(hal::Error, setAutoLowLatencyMode, (bool), (override));
MOCK_METHOD(hal::Error, getSupportedContentTypes, (std::vector<hal::ContentType> *),
(const, override));
MOCK_METHOD(hal::Error, setContentType, (hal::ContentType), (override));
MOCK_METHOD(hal::Error, getClientTargetProperty, (hal::ClientTargetProperty *), (override));
};
class Layer : public HWC2::Layer {
public:
Layer();
~Layer() override;
MOCK_METHOD(hal::HWLayerId, getId, (), (const, override));
MOCK_METHOD(hal::Error, setCursorPosition, (int32_t, int32_t), (override));
MOCK_METHOD(hal::Error, setBuffer,
(uint32_t, const android::sp<android::GraphicBuffer> &,
const android::sp<android::Fence> &),
(override));
MOCK_METHOD(hal::Error, setSurfaceDamage, (const android::Region &), (override));
MOCK_METHOD(hal::Error, setBlendMode, (hal::BlendMode), (override));
MOCK_METHOD(hal::Error, setColor, (hal::Color), (override));
MOCK_METHOD(hal::Error, setCompositionType, (hal::Composition), (override));
MOCK_METHOD(hal::Error, setDataspace, (android::ui::Dataspace), (override));
MOCK_METHOD(hal::Error, setPerFrameMetadata, (const int32_t, const android::HdrMetadata &),
(override));
MOCK_METHOD(hal::Error, setDisplayFrame, (const android::Rect &), (override));
MOCK_METHOD(hal::Error, setPlaneAlpha, (float), (override));
MOCK_METHOD(hal::Error, setSidebandStream, (const native_handle_t *), (override));
MOCK_METHOD(hal::Error, setSourceCrop, (const android::FloatRect &), (override));
MOCK_METHOD(hal::Error, setTransform, (hal::Transform), (override));
MOCK_METHOD(hal::Error, setVisibleRegion, (const android::Region &), (override));
MOCK_METHOD(hal::Error, setZOrder, (uint32_t), (override));
MOCK_METHOD(hal::Error, setColorTransform, (const android::mat4 &), (override));
MOCK_METHOD(hal::Error, setLayerGenericMetadata,
(const std::string &, bool, const std::vector<uint8_t> &), (override));
};
} // namespace android::HWC2::mock
|