blob: 8579d8c4449353c358f0393c8def84b64236dc14 [file] [log] [blame]
Lloyd Pique31cb2942018-10-19 17:23:03 -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
Marin Shalamanovbed7fd32020-12-21 20:02:20 +010017// TODO(b/129481165): remove the #pragma below and fix conversion issues
Alec Mouria90a5702021-04-16 16:36:21 +000018#include "renderengine/ExternalTexture.h"
19#include "ui/GraphicBuffer.h"
Marin Shalamanovbed7fd32020-12-21 20:02:20 +010020#pragma clang diagnostic push
21#pragma clang diagnostic ignored "-Wextra"
22
Lloyd Pique31cb2942018-10-19 17:23:03 -070023#include <cstdarg>
24#include <cstdint>
25
26#include <compositionengine/RenderSurfaceCreationArgs.h>
Lloyd Pique66d68602019-02-13 14:23:31 -080027#include <compositionengine/impl/OutputCompositionState.h>
Lloyd Pique31cb2942018-10-19 17:23:03 -070028#include <compositionengine/impl/RenderSurface.h>
29#include <compositionengine/mock/CompositionEngine.h>
30#include <compositionengine/mock/Display.h>
31#include <compositionengine/mock/DisplaySurface.h>
chaviw8beb4142019-04-11 13:09:05 -070032#include <compositionengine/mock/NativeWindow.h>
Lloyd Pique37c2c9b2018-12-04 17:25:10 -080033#include <compositionengine/mock/OutputLayer.h>
Lloyd Pique31cb2942018-10-19 17:23:03 -070034#include <gtest/gtest.h>
35#include <renderengine/mock/RenderEngine.h>
Lloyd Pique31cb2942018-10-19 17:23:03 -070036
Lloyd Pique31cb2942018-10-19 17:23:03 -070037namespace android::compositionengine {
38namespace {
39
Lloyd Pique31cb2942018-10-19 17:23:03 -070040constexpr int32_t DEFAULT_DISPLAY_WIDTH = 1920;
41constexpr int32_t DEFAULT_DISPLAY_HEIGHT = 1080;
Dominik Laskowskif1833852021-03-23 15:06:50 -070042constexpr DisplayId DEFAULT_DISPLAY_ID = PhysicalDisplayId::fromPort(123u);
Lloyd Pique31cb2942018-10-19 17:23:03 -070043const std::string DEFAULT_DISPLAY_NAME = "Mock Display";
44
45using testing::_;
46using testing::ByMove;
47using testing::DoAll;
48using testing::Ref;
49using testing::Return;
50using testing::ReturnRef;
51using testing::SetArgPointee;
52using testing::StrictMock;
53
54class RenderSurfaceTest : public testing::Test {
55public:
56 RenderSurfaceTest() {
Marin Shalamanov0f10d0d2020-08-06 20:04:06 +020057 EXPECT_CALL(mDisplay, getId()).WillRepeatedly(Return(DEFAULT_DISPLAY_ID));
Lloyd Pique31cb2942018-10-19 17:23:03 -070058 EXPECT_CALL(mDisplay, getName()).WillRepeatedly(ReturnRef(DEFAULT_DISPLAY_NAME));
Lloyd Pique31cb2942018-10-19 17:23:03 -070059 EXPECT_CALL(mCompositionEngine, getRenderEngine).WillRepeatedly(ReturnRef(mRenderEngine));
chaviw8beb4142019-04-11 13:09:05 -070060 EXPECT_CALL(*mNativeWindow, disconnect(NATIVE_WINDOW_API_EGL))
61 .WillRepeatedly(Return(NO_ERROR));
Lloyd Pique31cb2942018-10-19 17:23:03 -070062 }
Lloyd Pique31cb2942018-10-19 17:23:03 -070063
Lloyd Pique31cb2942018-10-19 17:23:03 -070064 StrictMock<renderengine::mock::RenderEngine> mRenderEngine;
65 StrictMock<mock::CompositionEngine> mCompositionEngine;
66 StrictMock<mock::Display> mDisplay;
chaviw8beb4142019-04-11 13:09:05 -070067 sp<mock::NativeWindow> mNativeWindow = new StrictMock<mock::NativeWindow>();
Lloyd Pique31cb2942018-10-19 17:23:03 -070068 sp<mock::DisplaySurface> mDisplaySurface = new StrictMock<mock::DisplaySurface>();
69 impl::RenderSurface mSurface{mCompositionEngine, mDisplay,
70 RenderSurfaceCreationArgs{DEFAULT_DISPLAY_WIDTH,
71 DEFAULT_DISPLAY_HEIGHT, mNativeWindow,
72 mDisplaySurface}};
73};
74
Lloyd Pique66d68602019-02-13 14:23:31 -080075/*
Lloyd Pique31cb2942018-10-19 17:23:03 -070076 * Basic construction
77 */
78
79TEST_F(RenderSurfaceTest, canInstantiate) {
80 EXPECT_TRUE(mSurface.isValid());
81}
82
Lloyd Pique66d68602019-02-13 14:23:31 -080083/*
Lloyd Pique31cb2942018-10-19 17:23:03 -070084 * RenderSurface::initialize()
85 */
86
87TEST_F(RenderSurfaceTest, initializeConfiguresNativeWindow) {
88 EXPECT_CALL(*mNativeWindow, connect(NATIVE_WINDOW_API_EGL)).WillOnce(Return(NO_ERROR));
89 EXPECT_CALL(*mNativeWindow, setBuffersFormat(HAL_PIXEL_FORMAT_RGBA_8888))
90 .WillOnce(Return(NO_ERROR));
John Reck44418f52020-09-15 18:02:17 -070091 EXPECT_CALL(*mNativeWindow, setUsage(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE))
92 .WillOnce(Return(NO_ERROR));
Lloyd Pique31cb2942018-10-19 17:23:03 -070093
94 mSurface.initialize();
95}
96
Lloyd Pique66d68602019-02-13 14:23:31 -080097/*
Lloyd Pique31cb2942018-10-19 17:23:03 -070098 * RenderSurface::getSize()
99 */
100
101TEST_F(RenderSurfaceTest, sizeReturnsConstructedSize) {
102 const ui::Size expected{DEFAULT_DISPLAY_WIDTH, DEFAULT_DISPLAY_HEIGHT};
103
104 EXPECT_EQ(expected, mSurface.getSize());
105}
106
Lloyd Pique66d68602019-02-13 14:23:31 -0800107/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700108 * RenderSurface::getClientTargetAcquireFence()
109 */
110
111TEST_F(RenderSurfaceTest, getClientTargetAcquireFenceForwardsCall) {
112 sp<Fence> fence = new Fence();
113
114 EXPECT_CALL(*mDisplaySurface, getClientTargetAcquireFence()).WillOnce(ReturnRef(fence));
115
116 EXPECT_EQ(fence.get(), mSurface.getClientTargetAcquireFence().get());
117}
118
Lloyd Pique66d68602019-02-13 14:23:31 -0800119/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700120 * RenderSurface::setDisplaySize()
121 */
122
123TEST_F(RenderSurfaceTest, setDisplaySizeAppliesChange) {
Marin Shalamanov045b7002021-01-07 16:56:24 +0100124 const ui::Size size(640, 480);
125 EXPECT_CALL(*mDisplaySurface, resizeBuffers(size)).Times(1);
Lloyd Pique31cb2942018-10-19 17:23:03 -0700126
Marin Shalamanov045b7002021-01-07 16:56:24 +0100127 mSurface.setDisplaySize(size);
Lloyd Pique31cb2942018-10-19 17:23:03 -0700128}
129
Lloyd Pique66d68602019-02-13 14:23:31 -0800130/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700131 * RenderSurface::setBufferDataspace()
132 */
133
134TEST_F(RenderSurfaceTest, setBufferDataspaceAppliesChange) {
135 EXPECT_CALL(*mNativeWindow, setBuffersDataSpace(ui::Dataspace::DISPLAY_P3))
136 .WillOnce(Return(NO_ERROR));
137
138 mSurface.setBufferDataspace(ui::Dataspace::DISPLAY_P3);
139}
140
Lloyd Pique66d68602019-02-13 14:23:31 -0800141/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700142 * RenderSurface::setProtected()
143 */
144
145TEST_F(RenderSurfaceTest, setProtectedTrueEnablesProtection) {
Peiyong Lin52010312019-05-02 14:22:16 -0700146 EXPECT_FALSE(mSurface.isProtected());
John Reck44418f52020-09-15 18:02:17 -0700147 EXPECT_CALL(*mNativeWindow,
148 setUsage(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE |
149 GRALLOC_USAGE_PROTECTED))
Lloyd Pique31cb2942018-10-19 17:23:03 -0700150 .WillOnce(Return(NO_ERROR));
151
152 mSurface.setProtected(true);
Peiyong Lin52010312019-05-02 14:22:16 -0700153 EXPECT_TRUE(mSurface.isProtected());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700154}
155
156TEST_F(RenderSurfaceTest, setProtectedFalseDisablesProtection) {
Peiyong Lin52010312019-05-02 14:22:16 -0700157 EXPECT_FALSE(mSurface.isProtected());
John Reck44418f52020-09-15 18:02:17 -0700158 EXPECT_CALL(*mNativeWindow, setUsage(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE))
159 .WillOnce(Return(NO_ERROR));
Lloyd Pique31cb2942018-10-19 17:23:03 -0700160
161 mSurface.setProtected(false);
Peiyong Lin52010312019-05-02 14:22:16 -0700162 EXPECT_FALSE(mSurface.isProtected());
163}
164
165TEST_F(RenderSurfaceTest, setProtectedEnableAndDisable) {
166 EXPECT_FALSE(mSurface.isProtected());
John Reck44418f52020-09-15 18:02:17 -0700167 EXPECT_CALL(*mNativeWindow,
168 setUsage(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE |
169 GRALLOC_USAGE_PROTECTED))
Peiyong Lin52010312019-05-02 14:22:16 -0700170 .WillOnce(Return(NO_ERROR));
John Reck44418f52020-09-15 18:02:17 -0700171 EXPECT_CALL(*mNativeWindow, setUsage(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE))
172 .WillOnce(Return(NO_ERROR));
Peiyong Lin52010312019-05-02 14:22:16 -0700173
174 mSurface.setProtected(true);
175 EXPECT_TRUE(mSurface.isProtected());
176 mSurface.setProtected(false);
177 EXPECT_FALSE(mSurface.isProtected());
178}
179
180TEST_F(RenderSurfaceTest, setProtectedEnableWithError) {
181 EXPECT_FALSE(mSurface.isProtected());
John Reck44418f52020-09-15 18:02:17 -0700182 EXPECT_CALL(*mNativeWindow,
183 setUsage(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE |
184 GRALLOC_USAGE_PROTECTED))
Peiyong Lin52010312019-05-02 14:22:16 -0700185 .WillOnce(Return(INVALID_OPERATION));
186 mSurface.setProtected(true);
187 EXPECT_FALSE(mSurface.isProtected());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700188}
189
Lloyd Pique66d68602019-02-13 14:23:31 -0800190/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700191 * RenderSurface::beginFrame()
192 */
193
194TEST_F(RenderSurfaceTest, beginFrameAppliesChange) {
195 EXPECT_CALL(*mDisplaySurface, beginFrame(true)).WillOnce(Return(NO_ERROR));
196
197 EXPECT_EQ(NO_ERROR, mSurface.beginFrame(true));
198}
199
Lloyd Pique66d68602019-02-13 14:23:31 -0800200/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700201 * RenderSurface::prepareFrame()
202 */
203
Lloyd Pique31cb2942018-10-19 17:23:03 -0700204TEST_F(RenderSurfaceTest, prepareFrameHandlesMixedComposition) {
Lloyd Pique31cb2942018-10-19 17:23:03 -0700205 EXPECT_CALL(*mDisplaySurface, prepareFrame(DisplaySurface::COMPOSITION_MIXED))
Lloyd Pique66d68602019-02-13 14:23:31 -0800206 .WillOnce(Return(NO_ERROR));
Lloyd Pique31cb2942018-10-19 17:23:03 -0700207
Lloyd Pique66d68602019-02-13 14:23:31 -0800208 mSurface.prepareFrame(true, true);
Lloyd Pique31cb2942018-10-19 17:23:03 -0700209}
210
Peiyong Linf3ffc4e2019-12-13 00:46:24 -0800211TEST_F(RenderSurfaceTest, prepareFrameHandlesOnlyGpuComposition) {
212 EXPECT_CALL(*mDisplaySurface, prepareFrame(DisplaySurface::COMPOSITION_GPU))
Lloyd Pique31cb2942018-10-19 17:23:03 -0700213 .WillOnce(Return(NO_ERROR));
214
Lloyd Pique66d68602019-02-13 14:23:31 -0800215 mSurface.prepareFrame(true, false);
Lloyd Pique31cb2942018-10-19 17:23:03 -0700216}
217
218TEST_F(RenderSurfaceTest, prepareFrameHandlesOnlyHwcComposition) {
Lloyd Pique31cb2942018-10-19 17:23:03 -0700219 EXPECT_CALL(*mDisplaySurface, prepareFrame(DisplaySurface::COMPOSITION_HWC))
220 .WillOnce(Return(NO_ERROR));
221
Lloyd Pique66d68602019-02-13 14:23:31 -0800222 mSurface.prepareFrame(false, true);
Lloyd Pique31cb2942018-10-19 17:23:03 -0700223}
224
225TEST_F(RenderSurfaceTest, prepareFrameHandlesNoComposition) {
Lloyd Pique31cb2942018-10-19 17:23:03 -0700226 EXPECT_CALL(*mDisplaySurface, prepareFrame(DisplaySurface::COMPOSITION_HWC))
227 .WillOnce(Return(NO_ERROR));
228
Lloyd Pique66d68602019-02-13 14:23:31 -0800229 mSurface.prepareFrame(false, false);
Lloyd Pique31cb2942018-10-19 17:23:03 -0700230}
231
Lloyd Pique66d68602019-02-13 14:23:31 -0800232/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700233 * RenderSurface::dequeueBuffer()
234 */
235
236TEST_F(RenderSurfaceTest, dequeueBufferObtainsABuffer) {
237 sp<GraphicBuffer> buffer = new GraphicBuffer();
238
239 EXPECT_CALL(*mNativeWindow, dequeueBuffer(_, _))
240 .WillOnce(
241 DoAll(SetArgPointee<0>(buffer.get()), SetArgPointee<1>(-1), Return(NO_ERROR)));
242
Alec Mouri6338c9d2019-02-07 16:57:51 -0800243 base::unique_fd fence;
Alec Mouria90a5702021-04-16 16:36:21 +0000244 EXPECT_EQ(buffer.get(), mSurface.dequeueBuffer(&fence)->getBuffer().get());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700245
Alec Mouria90a5702021-04-16 16:36:21 +0000246 EXPECT_EQ(buffer.get(), mSurface.mutableTextureForTest()->getBuffer().get());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700247}
248
Lloyd Pique66d68602019-02-13 14:23:31 -0800249/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700250 * RenderSurface::queueBuffer()
251 */
252
253TEST_F(RenderSurfaceTest, queueBufferHandlesNoClientComposition) {
Alec Mouria90a5702021-04-16 16:36:21 +0000254 const auto buffer = std::make_shared<
255 renderengine::ExternalTexture>(new GraphicBuffer(), mRenderEngine,
256 renderengine::ExternalTexture::Usage::READABLE |
257 renderengine::ExternalTexture::Usage::WRITEABLE);
258 mSurface.mutableTextureForTest() = buffer;
Lloyd Pique31cb2942018-10-19 17:23:03 -0700259
Lloyd Pique66d68602019-02-13 14:23:31 -0800260 impl::OutputCompositionState state;
261 state.usesClientComposition = false;
262 state.flipClientTarget = false;
263
264 EXPECT_CALL(mDisplay, getState()).WillOnce(ReturnRef(state));
Lloyd Pique31cb2942018-10-19 17:23:03 -0700265 EXPECT_CALL(*mDisplaySurface, advanceFrame()).Times(1);
266
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000267 mSurface.queueBuffer(base::unique_fd());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700268
Alec Mouria90a5702021-04-16 16:36:21 +0000269 EXPECT_EQ(buffer.get(), mSurface.mutableTextureForTest().get());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700270}
271
272TEST_F(RenderSurfaceTest, queueBufferHandlesClientComposition) {
Alec Mouria90a5702021-04-16 16:36:21 +0000273 const auto buffer = std::make_shared<renderengine::ExternalTexture>(new GraphicBuffer(),
274 mRenderEngine, false);
275 mSurface.mutableTextureForTest() = buffer;
Lloyd Pique31cb2942018-10-19 17:23:03 -0700276
Lloyd Pique66d68602019-02-13 14:23:31 -0800277 impl::OutputCompositionState state;
278 state.usesClientComposition = true;
279 state.flipClientTarget = false;
280
281 EXPECT_CALL(mDisplay, getState()).WillOnce(ReturnRef(state));
Alec Mouria90a5702021-04-16 16:36:21 +0000282 EXPECT_CALL(*mNativeWindow, queueBuffer(buffer->getBuffer()->getNativeBuffer(), -1))
Lloyd Pique31cb2942018-10-19 17:23:03 -0700283 .WillOnce(Return(NO_ERROR));
284 EXPECT_CALL(*mDisplaySurface, advanceFrame()).Times(1);
285
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000286 mSurface.queueBuffer(base::unique_fd());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700287
Alec Mouria90a5702021-04-16 16:36:21 +0000288 EXPECT_EQ(nullptr, mSurface.mutableTextureForTest().get());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700289}
290
291TEST_F(RenderSurfaceTest, queueBufferHandlesFlipClientTargetRequest) {
Alec Mouria90a5702021-04-16 16:36:21 +0000292 const auto buffer = std::make_shared<renderengine::ExternalTexture>(new GraphicBuffer(),
293 mRenderEngine, false);
294 mSurface.mutableTextureForTest() = buffer;
Lloyd Pique31cb2942018-10-19 17:23:03 -0700295
Lloyd Pique66d68602019-02-13 14:23:31 -0800296 impl::OutputCompositionState state;
297 state.usesClientComposition = false;
298 state.flipClientTarget = true;
299
300 EXPECT_CALL(mDisplay, getState()).WillOnce(ReturnRef(state));
Alec Mouria90a5702021-04-16 16:36:21 +0000301 EXPECT_CALL(*mNativeWindow, queueBuffer(buffer->getBuffer()->getNativeBuffer(), -1))
Lloyd Pique31cb2942018-10-19 17:23:03 -0700302 .WillOnce(Return(NO_ERROR));
303 EXPECT_CALL(*mDisplaySurface, advanceFrame()).Times(1);
304
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000305 mSurface.queueBuffer(base::unique_fd());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700306
Alec Mouria90a5702021-04-16 16:36:21 +0000307 EXPECT_EQ(nullptr, mSurface.mutableTextureForTest().get());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700308}
309
310TEST_F(RenderSurfaceTest, queueBufferHandlesFlipClientTargetRequestWithNoBufferYetDequeued) {
311 sp<GraphicBuffer> buffer = new GraphicBuffer();
312
Lloyd Pique66d68602019-02-13 14:23:31 -0800313 impl::OutputCompositionState state;
314 state.usesClientComposition = false;
315 state.flipClientTarget = true;
316
317 EXPECT_CALL(mDisplay, getState()).WillOnce(ReturnRef(state));
Lloyd Pique31cb2942018-10-19 17:23:03 -0700318 EXPECT_CALL(*mNativeWindow, dequeueBuffer(_, _))
319 .WillOnce(
320 DoAll(SetArgPointee<0>(buffer.get()), SetArgPointee<1>(-1), Return(NO_ERROR)));
321 EXPECT_CALL(*mNativeWindow, queueBuffer(buffer->getNativeBuffer(), -1))
322 .WillOnce(Return(NO_ERROR));
323 EXPECT_CALL(*mDisplaySurface, advanceFrame()).Times(1);
324
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000325 mSurface.queueBuffer(base::unique_fd());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700326
Alec Mouria90a5702021-04-16 16:36:21 +0000327 EXPECT_EQ(nullptr, mSurface.mutableTextureForTest().get());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700328}
329
330TEST_F(RenderSurfaceTest, queueBufferHandlesNativeWindowQueueBufferFailureOnVirtualDisplay) {
Alec Mouria90a5702021-04-16 16:36:21 +0000331 const auto buffer = std::make_shared<renderengine::ExternalTexture>(new GraphicBuffer(),
332 mRenderEngine, false);
333 mSurface.mutableTextureForTest() = buffer;
Lloyd Pique31cb2942018-10-19 17:23:03 -0700334
Lloyd Pique66d68602019-02-13 14:23:31 -0800335 impl::OutputCompositionState state;
336 state.usesClientComposition = true;
337
338 EXPECT_CALL(mDisplay, getState()).WillOnce(ReturnRef(state));
Alec Mouria90a5702021-04-16 16:36:21 +0000339 EXPECT_CALL(*mNativeWindow, queueBuffer(buffer->getBuffer()->getNativeBuffer(), -1))
Lloyd Pique31cb2942018-10-19 17:23:03 -0700340 .WillOnce(Return(INVALID_OPERATION));
341 EXPECT_CALL(mDisplay, isVirtual()).WillOnce(Return(true));
Alec Mouria90a5702021-04-16 16:36:21 +0000342 EXPECT_CALL(*mNativeWindow, cancelBuffer(buffer->getBuffer()->getNativeBuffer(), -1))
Lloyd Pique31cb2942018-10-19 17:23:03 -0700343 .WillOnce(Return(NO_ERROR));
344 EXPECT_CALL(*mDisplaySurface, advanceFrame()).Times(1);
345
Alec Mourie7d1d4a2019-02-05 01:13:46 +0000346 mSurface.queueBuffer(base::unique_fd());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700347
Alec Mouria90a5702021-04-16 16:36:21 +0000348 EXPECT_EQ(nullptr, mSurface.mutableTextureForTest().get());
Lloyd Pique31cb2942018-10-19 17:23:03 -0700349}
350
Lloyd Pique66d68602019-02-13 14:23:31 -0800351/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700352 * RenderSurface::onPresentDisplayCompleted()
353 */
354
355TEST_F(RenderSurfaceTest, onPresentDisplayCompletedForwardsSignal) {
356 EXPECT_CALL(*mDisplaySurface, onFrameCommitted()).Times(1);
357
358 mSurface.onPresentDisplayCompleted();
359}
360
Lloyd Pique66d68602019-02-13 14:23:31 -0800361/*
Lloyd Pique31cb2942018-10-19 17:23:03 -0700362 * RenderSurface::flip()
363 */
364
365TEST_F(RenderSurfaceTest, flipForwardsSignal) {
366 mSurface.setPageFlipCountForTest(500);
367
368 mSurface.flip();
369
370 EXPECT_EQ(501, mSurface.getPageFlipCount());
371}
372
373} // namespace
374} // namespace android::compositionengine
Marin Shalamanovbed7fd32020-12-21 20:02:20 +0100375
376// TODO(b/129481165): remove the #pragma below and fix conversion issues
Dominik Laskowskif1833852021-03-23 15:06:50 -0700377#pragma clang diagnostic pop // ignored "-Wextra"