blob: 4661c5d616abb10744be99d8f4bf29cfa9914664 [file] [log] [blame]
Lloyd Pique32cbe282018-10-19 13:09:22 -07001/*
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
Lloyd Piquef8cf14d2019-02-28 16:03:12 -080019#include <compositionengine/CompositionRefreshArgs.h>
Lloyd Pique3d0c02e2018-10-19 18:38:12 -070020#include <compositionengine/DisplayColorProfile.h>
Lloyd Piquecc01a452018-12-04 17:24:00 -080021#include <compositionengine/LayerFE.h>
Lloyd Pique32cbe282018-10-19 13:09:22 -070022#include <compositionengine/Output.h>
Lloyd Piquecc01a452018-12-04 17:24:00 -080023#include <compositionengine/OutputLayer.h>
Lloyd Pique31cb2942018-10-19 17:23:03 -070024#include <compositionengine/RenderSurface.h>
Lloyd Pique32cbe282018-10-19 13:09:22 -070025#include <compositionengine/impl/OutputCompositionState.h>
26#include <gmock/gmock.h>
27
28namespace android::compositionengine::mock {
29
30class Output : public virtual compositionengine::Output {
31public:
32 Output();
33 virtual ~Output();
34
35 MOCK_CONST_METHOD0(isValid, bool());
Lloyd Pique6c564cf2019-05-17 17:31:36 -070036 MOCK_CONST_METHOD0(getDisplayId, std::optional<DisplayId>());
Lloyd Pique32cbe282018-10-19 13:09:22 -070037
38 MOCK_METHOD1(setCompositionEnabled, void(bool));
Lloyd Piquee8fe4742020-01-21 15:26:18 -080039 MOCK_METHOD7(setProjection,
40 void(const ui::Transform&, uint32_t, const Rect&, const Rect&, const Rect&,
41 const Rect&, bool));
Lloyd Pique31cb2942018-10-19 17:23:03 -070042 MOCK_METHOD1(setBounds, void(const ui::Size&));
Lloyd Piqueef36b002019-01-23 17:52:04 -080043 MOCK_METHOD2(setLayerStackFilter, void(uint32_t, bool));
Lloyd Pique32cbe282018-10-19 13:09:22 -070044
Lloyd Pique3eb1b212019-03-07 21:15:40 -080045 MOCK_METHOD1(setColorTransform, void(const compositionengine::CompositionRefreshArgs&));
Lloyd Pique6a3b4462019-03-07 20:58:12 -080046 MOCK_METHOD1(setColorProfile, void(const ColorProfile&));
Lloyd Pique32cbe282018-10-19 13:09:22 -070047
48 MOCK_CONST_METHOD1(dump, void(std::string&));
49 MOCK_CONST_METHOD0(getName, const std::string&());
50 MOCK_METHOD1(setName, void(const std::string&));
51
Lloyd Piquef5275482019-01-29 18:42:42 -080052 MOCK_CONST_METHOD0(getDisplayColorProfile, compositionengine::DisplayColorProfile*());
53 MOCK_METHOD1(setDisplayColorProfile,
54 void(std::unique_ptr<compositionengine::DisplayColorProfile>));
Lloyd Pique3d0c02e2018-10-19 18:38:12 -070055
Lloyd Piquef5275482019-01-29 18:42:42 -080056 MOCK_CONST_METHOD0(getRenderSurface, compositionengine::RenderSurface*());
57 MOCK_METHOD1(setRenderSurface, void(std::unique_ptr<compositionengine::RenderSurface>));
Lloyd Pique31cb2942018-10-19 17:23:03 -070058
Lloyd Pique32cbe282018-10-19 13:09:22 -070059 MOCK_CONST_METHOD0(getState, const OutputCompositionState&());
60 MOCK_METHOD0(editState, OutputCompositionState&());
61
Alec Mourie7d1d4a2019-02-05 01:13:46 +000062 MOCK_CONST_METHOD1(getDirtyRegion, Region(bool));
Lloyd Piquec6687342019-03-07 21:34:57 -080063 MOCK_CONST_METHOD2(belongsInOutput, bool(std::optional<uint32_t>, bool));
Lloyd Piquede196652020-01-22 17:29:58 -080064 MOCK_CONST_METHOD1(belongsInOutput, bool(const sp<compositionengine::LayerFE>&));
Lloyd Piquecc01a452018-12-04 17:24:00 -080065
66 MOCK_CONST_METHOD1(getOutputLayerForLayer,
Lloyd Piquede196652020-01-22 17:29:58 -080067 compositionengine::OutputLayer*(const sp<compositionengine::LayerFE>&));
Lloyd Pique01c77c12019-04-17 12:48:32 -070068 MOCK_METHOD0(clearOutputLayers, void());
Lloyd Piquede196652020-01-22 17:29:58 -080069 MOCK_METHOD1(injectOutputLayerForTest,
70 compositionengine::OutputLayer*(const sp<compositionengine::LayerFE>&));
Lloyd Pique01c77c12019-04-17 12:48:32 -070071 MOCK_CONST_METHOD0(getOutputLayerCount, size_t());
72 MOCK_CONST_METHOD1(getOutputLayerOrderedByZByIndex, OutputLayer*(size_t));
Lloyd Piquec7ef21b2019-01-29 18:43:00 -080073
74 MOCK_METHOD1(setReleasedLayers, void(ReleasedLayers&&));
Lloyd Pique66d68602019-02-13 14:23:31 -080075
Lloyd Piquec29e4c62019-03-07 21:48:19 -080076 MOCK_METHOD2(prepare, void(const compositionengine::CompositionRefreshArgs&, LayerFESet&));
Lloyd Piqued7b429f2019-03-07 21:11:02 -080077 MOCK_METHOD1(present, void(const compositionengine::CompositionRefreshArgs&));
78
Lloyd Piquec29e4c62019-03-07 21:48:19 -080079 MOCK_METHOD2(rebuildLayerStacks,
80 void(const compositionengine::CompositionRefreshArgs&, LayerFESet&));
81 MOCK_METHOD2(collectVisibleLayers,
82 void(const compositionengine::CompositionRefreshArgs&,
83 compositionengine::Output::CoverageState&));
Lloyd Pique01c77c12019-04-17 12:48:32 -070084 MOCK_METHOD2(ensureOutputLayerIfVisible,
Lloyd Piquede196652020-01-22 17:29:58 -080085 void(sp<compositionengine::LayerFE>&, compositionengine::Output::CoverageState&));
Lloyd Piquec29e4c62019-03-07 21:48:19 -080086 MOCK_METHOD1(setReleasedLayers, void(const compositionengine::CompositionRefreshArgs&));
87
Lloyd Pique3eb1b212019-03-07 21:15:40 -080088 MOCK_CONST_METHOD1(updateLayerStateFromFE, void(const CompositionRefreshArgs&));
89 MOCK_METHOD1(updateAndWriteCompositionState, void(const CompositionRefreshArgs&));
Lloyd Pique6a3b4462019-03-07 20:58:12 -080090 MOCK_METHOD1(updateColorProfile, void(const compositionengine::CompositionRefreshArgs&));
91
Lloyd Piqued0a92a02019-02-19 17:47:26 -080092 MOCK_METHOD0(beginFrame, void());
Lloyd Piqued7b429f2019-03-07 21:11:02 -080093
Lloyd Pique66d68602019-02-13 14:23:31 -080094 MOCK_METHOD0(prepareFrame, void());
95 MOCK_METHOD0(chooseCompositionStrategy, void());
Lloyd Pique35fca9d2019-02-13 14:24:11 -080096
Lloyd Piquef8cf14d2019-02-28 16:03:12 -080097 MOCK_METHOD1(devOptRepaintFlash, void(const compositionengine::CompositionRefreshArgs&));
98
Lloyd Piqued3d69882019-02-28 16:03:46 -080099 MOCK_METHOD1(finishFrame, void(const compositionengine::CompositionRefreshArgs&));
100
Lucas Dupin2dd6f392020-02-18 17:43:36 -0800101 MOCK_METHOD2(composeSurfaces,
102 std::optional<base::unique_fd>(
103 const Region&,
104 const compositionengine::CompositionRefreshArgs& refreshArgs));
Lloyd Pique688abd42019-02-15 15:42:24 -0800105 MOCK_CONST_METHOD0(getSkipColorTransform, bool());
106
Lloyd Pique35fca9d2019-02-13 14:24:11 -0800107 MOCK_METHOD0(postFramebuffer, void());
108 MOCK_METHOD0(presentAndGetFrameFences, compositionengine::Output::FrameFences());
Lloyd Pique688abd42019-02-15 15:42:24 -0800109
Vishnu Nair3a7346c2019-12-04 08:09:09 -0800110 MOCK_METHOD3(generateClientCompositionRequests,
Vishnu Nair9b079a22020-01-21 14:36:08 -0800111 std::vector<LayerFE::LayerSettings>(bool, Region&, ui::Dataspace));
Lloyd Pique688abd42019-02-15 15:42:24 -0800112 MOCK_METHOD2(appendRegionFlashRequests,
Vishnu Nair9b079a22020-01-21 14:36:08 -0800113 void(const Region&, std::vector<LayerFE::LayerSettings>&));
Lloyd Pique688abd42019-02-15 15:42:24 -0800114 MOCK_METHOD1(setExpensiveRenderingExpected, void(bool));
Vishnu Nair9b079a22020-01-21 14:36:08 -0800115 MOCK_METHOD1(cacheClientCompositionRequests, void(uint32_t));
Lloyd Pique32cbe282018-10-19 13:09:22 -0700116};
117
118} // namespace android::compositionengine::mock