• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 <gmock/gmock.h>
20 
21 #include <com_android_graphics_libgui_flags.h>
22 #include <gui/IGraphicBufferConsumer.h>
23 
24 #include <utils/RefBase.h>
25 
26 namespace android {
27 namespace mock {
28 
29 class GraphicBufferConsumer : public IGraphicBufferConsumer {
30 public:
31     GraphicBufferConsumer();
32     ~GraphicBufferConsumer();
33 
34     MOCK_METHOD3(acquireBuffer, status_t(BufferItem*, nsecs_t, uint64_t));
35     MOCK_METHOD1(detachBuffer, status_t(int));
36     MOCK_METHOD2(attachBuffer, status_t(int*, const sp<GraphicBuffer>&));
37 #if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_GL_FENCE_CLEANUP)
38     MOCK_METHOD3(releaseBuffer, status_t(int, uint64_t, const sp<Fence>&));
39 #else
40     MOCK_METHOD5(releaseBuffer, status_t(int, uint64_t, EGLDisplay, EGLSyncKHR, const sp<Fence>&));
41 #endif
42     MOCK_METHOD2(consumerConnect, status_t(const sp<IConsumerListener>&, bool));
43     MOCK_METHOD0(consumerDisconnect, status_t());
44     MOCK_METHOD1(allowUnlimitedSlots, status_t(bool));
45     MOCK_METHOD1(getReleasedBuffers, status_t(uint64_t*));
46     MOCK_METHOD1(getReleasedBuffersExtended, status_t(std::vector<bool>*));
47     MOCK_METHOD2(setDefaultBufferSize, status_t(uint32_t, uint32_t));
48     MOCK_METHOD1(setMaxBufferCount, status_t(int));
49     MOCK_METHOD1(setMaxAcquiredBufferCount, status_t(int));
50     MOCK_METHOD2(setMaxAcquiredBufferCount, status_t(int, std::optional<OnBufferReleasedCallback>));
51     MOCK_METHOD1(setConsumerName, status_t(const String8&));
52     MOCK_METHOD1(setDefaultBufferFormat, status_t(PixelFormat));
53     MOCK_METHOD1(setDefaultBufferDataSpace, status_t(android_dataspace));
54     MOCK_METHOD1(setConsumerUsageBits, status_t(uint64_t));
55     MOCK_METHOD1(setConsumerIsProtected, status_t(bool));
56     MOCK_METHOD1(setTransformHint, status_t(uint32_t));
57     MOCK_CONST_METHOD1(getSidebandStream, status_t(sp<NativeHandle>*));
58     MOCK_METHOD2(getOccupancyHistory, status_t(bool, std::vector<OccupancyTracker::Segment>*));
59     MOCK_METHOD0(discardFreeBuffers, status_t());
60     MOCK_CONST_METHOD2(dumpState, status_t(const String8&, String8*));
61 };
62 
63 } // namespace mock
64 } // namespace android
65