| Lloyd Pique | 2ee3957 | 2017-12-20 16:48:10 -0800 | [diff] [blame] | 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 "RenderEngine/Image.h" | 
|  | 22 | #include "RenderEngine/Mesh.h" | 
|  | 23 | #include "RenderEngine/RenderEngine.h" | 
|  | 24 | #include "RenderEngine/Surface.h" | 
|  | 25 | #include "RenderEngine/Texture.h" | 
|  | 26 |  | 
|  | 27 | namespace android { | 
|  | 28 | namespace RE { | 
|  | 29 | namespace mock { | 
|  | 30 |  | 
|  | 31 | class RenderEngine : public RE::RenderEngine { | 
|  | 32 | public: | 
|  | 33 | RenderEngine(); | 
|  | 34 | ~RenderEngine() override; | 
|  | 35 |  | 
|  | 36 | MOCK_METHOD0(createSurface, std::unique_ptr<RE::Surface>()); | 
|  | 37 | MOCK_METHOD0(createImage, std::unique_ptr<RE::Image>()); | 
|  | 38 | MOCK_CONST_METHOD0(primeCache, void()); | 
|  | 39 | MOCK_METHOD1(dump, void(String8&)); | 
|  | 40 | MOCK_CONST_METHOD0(supportsImageCrop, bool()); | 
|  | 41 | MOCK_CONST_METHOD0(isCurrent, bool()); | 
|  | 42 | MOCK_METHOD1(setCurrentSurface, bool(const RE::Surface&)); | 
|  | 43 | MOCK_METHOD0(resetCurrentSurface, void()); | 
|  | 44 | MOCK_METHOD0(flush, base::unique_fd()); | 
|  | 45 | MOCK_METHOD0(finish, bool()); | 
|  | 46 | MOCK_METHOD1(waitFence, bool(base::unique_fd*)); | 
|  | 47 | bool waitFence(base::unique_fd fd) override { return waitFence(&fd); }; | 
|  | 48 | MOCK_METHOD4(clearWithColor, void(float, float, float, float)); | 
|  | 49 | MOCK_METHOD6(fillRegionWithColor, void(const Region&, uint32_t, float, float, float, float)); | 
|  | 50 | MOCK_METHOD4(setScissor, void(uint32_t, uint32_t, uint32_t, uint32_t)); | 
|  | 51 | MOCK_METHOD0(disableScissor, void()); | 
|  | 52 | MOCK_METHOD2(genTextures, void(size_t, uint32_t*)); | 
|  | 53 | MOCK_METHOD2(deleteTextures, void(size_t, uint32_t const*)); | 
|  | 54 | MOCK_METHOD2(bindExternalTextureImage, void(uint32_t, const RE::Image&)); | 
|  | 55 | MOCK_METHOD5(readPixels, void(size_t, size_t, size_t, size_t, uint32_t*)); | 
|  | 56 | MOCK_CONST_METHOD0(checkErrors, void()); | 
|  | 57 | MOCK_METHOD6(setViewportAndProjection, | 
|  | 58 | void(size_t, size_t, Rect, size_t, bool, Transform::orientation_flags)); | 
|  | 59 | MOCK_METHOD4(setupLayerBlending, void(bool, bool, bool, const half4&)); | 
| Lloyd Pique | 2ee3957 | 2017-12-20 16:48:10 -0800 | [diff] [blame] | 60 | MOCK_METHOD1(setupLayerTexturing, void(const Texture&)); | 
|  | 61 | MOCK_METHOD0(setupLayerBlackedOut, void()); | 
|  | 62 | MOCK_METHOD4(setupFillWithColor, void(float, float, float, float)); | 
|  | 63 | MOCK_METHOD1(setupColorTransform, mat4(const mat4&)); | 
|  | 64 | MOCK_METHOD0(disableTexturing, void()); | 
|  | 65 | MOCK_METHOD0(disableBlending, void()); | 
| Chia-I Wu | 69bf10f | 2018-02-20 13:04:50 -0800 | [diff] [blame] | 66 | MOCK_METHOD1(setSourceY410BT2020, void(bool)); | 
| Peiyong Lin | 34beb7a | 2018-03-28 11:57:12 -0700 | [diff] [blame] | 67 | MOCK_METHOD1(setSourceDataSpace, void(ui::Dataspace)); | 
|  | 68 | MOCK_METHOD1(setOutputDataSpace, void(ui::Dataspace)); | 
| Lloyd Pique | 2ee3957 | 2017-12-20 16:48:10 -0800 | [diff] [blame] | 69 | MOCK_METHOD2(bindNativeBufferAsFrameBuffer, | 
|  | 70 | void(ANativeWindowBuffer*, RE::BindNativeBufferAsFramebuffer*)); | 
|  | 71 | MOCK_METHOD1(unbindNativeBufferAsFrameBuffer, void(RE::BindNativeBufferAsFramebuffer*)); | 
|  | 72 | MOCK_METHOD1(drawMesh, void(const Mesh&)); | 
|  | 73 | MOCK_CONST_METHOD0(getMaxTextureSize, size_t()); | 
|  | 74 | MOCK_CONST_METHOD0(getMaxViewportDims, size_t()); | 
|  | 75 | }; | 
|  | 76 |  | 
|  | 77 | class Surface : public RE::Surface { | 
|  | 78 | public: | 
|  | 79 | Surface(); | 
|  | 80 | ~Surface() override; | 
|  | 81 |  | 
|  | 82 | MOCK_METHOD1(setCritical, void(bool)); | 
|  | 83 | MOCK_METHOD1(setAsync, void(bool)); | 
|  | 84 | MOCK_METHOD1(setNativeWindow, void(ANativeWindow*)); | 
|  | 85 | MOCK_CONST_METHOD0(swapBuffers, void()); | 
|  | 86 | MOCK_CONST_METHOD0(queryRedSize, int32_t()); | 
|  | 87 | MOCK_CONST_METHOD0(queryGreenSize, int32_t()); | 
|  | 88 | MOCK_CONST_METHOD0(queryBlueSize, int32_t()); | 
|  | 89 | MOCK_CONST_METHOD0(queryAlphaSize, int32_t()); | 
|  | 90 | MOCK_CONST_METHOD0(queryWidth, int32_t()); | 
|  | 91 | MOCK_CONST_METHOD0(queryHeight, int32_t()); | 
|  | 92 | }; | 
|  | 93 |  | 
|  | 94 | class Image : public RE::Image { | 
|  | 95 | public: | 
|  | 96 | Image(); | 
|  | 97 | ~Image() override; | 
|  | 98 |  | 
|  | 99 | MOCK_METHOD4(setNativeWindowBuffer, | 
|  | 100 | bool(ANativeWindowBuffer* buffer, bool isProtected, int32_t cropWidth, | 
|  | 101 | int32_t cropHeight)); | 
|  | 102 | }; | 
|  | 103 |  | 
|  | 104 | } // namespace mock | 
|  | 105 | } // namespace RE | 
|  | 106 | } // namespace android |