• Home
  • History
  • Annotate
  • 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 <gui/IGraphicBufferConsumer.h>
22 
23 #include <utils/RefBase.h>
24 
25 namespace android {
26 namespace mock {
27 
28 class GraphicBufferConsumer : public BnGraphicBufferConsumer, public virtual android::RefBase {
29 public:
30     GraphicBufferConsumer();
31     ~GraphicBufferConsumer() override;
32 
33     MOCK_METHOD3(acquireBuffer, status_t(BufferItem*, nsecs_t, uint64_t));
34     MOCK_METHOD1(detachBuffer, status_t(int));
35     MOCK_METHOD2(attachBuffer, status_t(int*, const sp<GraphicBuffer>&));
36     MOCK_METHOD5(releaseBuffer, status_t(int, uint64_t, EGLDisplay, EGLSyncKHR, const sp<Fence>&));
37     MOCK_METHOD2(consumerConnect, status_t(const sp<IConsumerListener>&, bool));
38     MOCK_METHOD0(consumerDisconnect, status_t());
39     MOCK_METHOD1(getReleasedBuffers, status_t(uint64_t*));
40     MOCK_METHOD2(setDefaultBufferSize, status_t(uint32_t, uint32_t));
41     MOCK_METHOD1(setMaxBufferCount, status_t(int));
42     MOCK_METHOD1(setMaxAcquiredBufferCount, status_t(int));
43     MOCK_METHOD1(setConsumerName, status_t(const String8&));
44     MOCK_METHOD1(setDefaultBufferFormat, status_t(PixelFormat));
45     MOCK_METHOD1(setDefaultBufferDataSpace, status_t(android_dataspace));
46     MOCK_METHOD1(setConsumerUsageBits, status_t(uint64_t));
47     MOCK_METHOD1(setConsumerIsProtected, status_t(bool));
48     MOCK_METHOD1(setTransformHint, status_t(uint32_t));
49     MOCK_CONST_METHOD1(getSidebandStream, status_t(sp<NativeHandle>*));
50     MOCK_METHOD2(getOccupancyHistory, status_t(bool, std::vector<OccupancyTracker::Segment>*));
51     MOCK_METHOD0(discardFreeBuffers, status_t());
52     MOCK_CONST_METHOD2(dumpState, status_t(const String8&, String8*));
53 };
54 
55 } // namespace mock
56 } // namespace android
57