• 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 <compositionengine/CompositionRefreshArgs.h>
20 #include <compositionengine/DisplayColorProfile.h>
21 #include <compositionengine/LayerFE.h>
22 #include <compositionengine/Output.h>
23 #include <compositionengine/OutputLayer.h>
24 #include <compositionengine/RenderSurface.h>
25 #include <compositionengine/impl/OutputCompositionState.h>
26 #include <gmock/gmock.h>
27 
28 namespace android::compositionengine::mock {
29 
30 class Output : public virtual compositionengine::Output {
31 public:
32     Output();
33     virtual ~Output();
34 
35     MOCK_CONST_METHOD0(isValid, bool());
36     MOCK_CONST_METHOD0(getDisplayId, std::optional<DisplayId>());
37 
38     MOCK_METHOD1(setCompositionEnabled, void(bool));
39     MOCK_METHOD1(setLayerCachingEnabled, void(bool));
40     MOCK_METHOD3(setProjection, void(ui::Rotation, const Rect&, const Rect&));
41     MOCK_METHOD1(setDisplaySize, void(const ui::Size&));
42     MOCK_METHOD2(setLayerStackFilter, void(uint32_t, bool));
43     MOCK_CONST_METHOD0(getTransformHint, ui::Transform::RotationFlags());
44 
45     MOCK_METHOD1(setColorTransform, void(const compositionengine::CompositionRefreshArgs&));
46     MOCK_METHOD1(setColorProfile, void(const ColorProfile&));
47     MOCK_METHOD2(setDisplayBrightness, void(float, float));
48 
49     MOCK_CONST_METHOD1(dump, void(std::string&));
50     MOCK_CONST_METHOD2(dumpPlannerInfo, void(const Vector<String16>&, std::string&));
51     MOCK_CONST_METHOD0(getName, const std::string&());
52     MOCK_METHOD1(setName, void(const std::string&));
53 
54     MOCK_CONST_METHOD0(getDisplayColorProfile, compositionengine::DisplayColorProfile*());
55     MOCK_METHOD1(setDisplayColorProfile,
56                  void(std::unique_ptr<compositionengine::DisplayColorProfile>));
57 
58     MOCK_CONST_METHOD0(getRenderSurface, compositionengine::RenderSurface*());
59     MOCK_METHOD1(setRenderSurface, void(std::unique_ptr<compositionengine::RenderSurface>));
60 
61     MOCK_CONST_METHOD0(getState, const OutputCompositionState&());
62     MOCK_METHOD0(editState, OutputCompositionState&());
63 
64     MOCK_CONST_METHOD1(getDirtyRegion, Region(bool));
65     MOCK_CONST_METHOD2(belongsInOutput, bool(std::optional<uint32_t>, bool));
66     MOCK_CONST_METHOD1(belongsInOutput, bool(const sp<compositionengine::LayerFE>&));
67 
68     MOCK_CONST_METHOD1(getOutputLayerForLayer,
69                        compositionengine::OutputLayer*(const sp<compositionengine::LayerFE>&));
70     MOCK_METHOD0(clearOutputLayers, void());
71     MOCK_METHOD1(injectOutputLayerForTest,
72                  compositionengine::OutputLayer*(const sp<compositionengine::LayerFE>&));
73     MOCK_CONST_METHOD0(getOutputLayerCount, size_t());
74     MOCK_CONST_METHOD1(getOutputLayerOrderedByZByIndex, OutputLayer*(size_t));
75 
76     MOCK_METHOD1(setReleasedLayers, void(ReleasedLayers&&));
77 
78     MOCK_METHOD2(prepare, void(const compositionengine::CompositionRefreshArgs&, LayerFESet&));
79     MOCK_METHOD1(present, void(const compositionengine::CompositionRefreshArgs&));
80 
81     MOCK_METHOD2(rebuildLayerStacks,
82                  void(const compositionengine::CompositionRefreshArgs&, LayerFESet&));
83     MOCK_METHOD2(collectVisibleLayers,
84                  void(const compositionengine::CompositionRefreshArgs&,
85                       compositionengine::Output::CoverageState&));
86     MOCK_METHOD2(ensureOutputLayerIfVisible,
87                  void(sp<compositionengine::LayerFE>&, compositionengine::Output::CoverageState&));
88     MOCK_METHOD1(setReleasedLayers, void(const compositionengine::CompositionRefreshArgs&));
89 
90     MOCK_CONST_METHOD1(updateLayerStateFromFE, void(const CompositionRefreshArgs&));
91     MOCK_METHOD1(updateCompositionState, void(const CompositionRefreshArgs&));
92     MOCK_METHOD0(planComposition, void());
93     MOCK_METHOD1(writeCompositionState, void(const CompositionRefreshArgs&));
94     MOCK_METHOD1(updateColorProfile, void(const compositionengine::CompositionRefreshArgs&));
95 
96     MOCK_METHOD0(beginFrame, void());
97 
98     MOCK_METHOD0(prepareFrame, void());
99     MOCK_METHOD0(chooseCompositionStrategy, void());
100 
101     MOCK_METHOD1(devOptRepaintFlash, void(const compositionengine::CompositionRefreshArgs&));
102 
103     MOCK_METHOD1(finishFrame, void(const compositionengine::CompositionRefreshArgs&));
104 
105     MOCK_METHOD2(composeSurfaces,
106                  std::optional<base::unique_fd>(
107                          const Region&,
108                          const compositionengine::CompositionRefreshArgs& refreshArgs));
109     MOCK_CONST_METHOD0(getSkipColorTransform, bool());
110 
111     MOCK_METHOD0(postFramebuffer, void());
112     MOCK_METHOD1(renderCachedSets, void(const CompositionRefreshArgs&));
113     MOCK_METHOD0(presentAndGetFrameFences, compositionengine::Output::FrameFences());
114 
115     MOCK_METHOD3(generateClientCompositionRequests,
116                  std::vector<LayerFE::LayerSettings>(bool, Region&, ui::Dataspace));
117     MOCK_METHOD2(appendRegionFlashRequests,
118                  void(const Region&, std::vector<LayerFE::LayerSettings>&));
119     MOCK_METHOD1(setExpensiveRenderingExpected, void(bool));
120     MOCK_METHOD1(cacheClientCompositionRequests, void(uint32_t));
121 };
122 
123 } // namespace android::compositionengine::mock
124