1 //
2 // Copyright (c) 2015 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // TextureImpl_mock.h: Defines a mock of the TextureImpl class.
8 
9 #ifndef LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_
10 #define LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_
11 
12 #include "gmock/gmock.h"
13 
14 #include "libANGLE/renderer/TextureImpl.h"
15 
16 namespace rx
17 {
18 
19 class MockTextureImpl : public TextureImpl
20 {
21   public:
MockTextureImpl()22     MockTextureImpl() : TextureImpl(mMockState), mMockState(GL_TEXTURE_2D) {}
~MockTextureImpl()23     virtual ~MockTextureImpl() { destructor(); }
24     MOCK_METHOD9(setImage,
25                  gl::Error(const gl::Context *,
26                            GLenum,
27                            size_t,
28                            GLenum,
29                            const gl::Extents &,
30                            GLenum,
31                            GLenum,
32                            const gl::PixelUnpackState &,
33                            const uint8_t *));
34     MOCK_METHOD8(setSubImage,
35                  gl::Error(const gl::Context *,
36                            GLenum,
37                            size_t,
38                            const gl::Box &,
39                            GLenum,
40                            GLenum,
41                            const gl::PixelUnpackState &,
42                            const uint8_t *));
43     MOCK_METHOD8(setCompressedImage,
44                  gl::Error(const gl::Context *,
45                            GLenum,
46                            size_t,
47                            GLenum,
48                            const gl::Extents &,
49                            const gl::PixelUnpackState &,
50                            size_t,
51                            const uint8_t *));
52     MOCK_METHOD8(setCompressedSubImage,
53                  gl::Error(const gl::Context *,
54                            GLenum,
55                            size_t,
56                            const gl::Box &,
57                            GLenum,
58                            const gl::PixelUnpackState &,
59                            size_t,
60                            const uint8_t *));
61     MOCK_METHOD6(copyImage,
62                  gl::Error(const gl::Context *,
63                            GLenum,
64                            size_t,
65                            const gl::Rectangle &,
66                            GLenum,
67                            const gl::Framebuffer *));
68     MOCK_METHOD6(copySubImage,
69                  gl::Error(const gl::Context *,
70                            GLenum,
71                            size_t,
72                            const gl::Offset &,
73                            const gl::Rectangle &,
74                            const gl::Framebuffer *));
75     MOCK_METHOD10(copyTexture,
76                   gl::Error(const gl::Context *,
77                             GLenum,
78                             size_t,
79                             GLenum,
80                             GLenum,
81                             size_t,
82                             bool,
83                             bool,
84                             bool,
85                             const gl::Texture *));
86     MOCK_METHOD10(copySubTexture,
87                   gl::Error(const gl::Context *,
88                             GLenum,
89                             size_t,
90                             const gl::Offset &,
91                             size_t,
92                             const gl::Rectangle &,
93                             bool,
94                             bool,
95                             bool,
96                             const gl::Texture *));
97     MOCK_METHOD2(copyCompressedTexture, gl::Error(const gl::Context *, const gl::Texture *source));
98     MOCK_METHOD5(setStorage,
99                  gl::Error(const gl::Context *, GLenum, size_t, GLenum, const gl::Extents &));
100     MOCK_METHOD4(setImageExternal,
101                  gl::Error(const gl::Context *,
102                            GLenum,
103                            egl::Stream *,
104                            const egl::Stream::GLTextureDescription &));
105     MOCK_METHOD3(setEGLImageTarget, gl::Error(const gl::Context *, GLenum, egl::Image *));
106     MOCK_METHOD1(generateMipmap, gl::Error(const gl::Context *));
107     MOCK_METHOD2(bindTexImage, gl::Error(const gl::Context *, egl::Surface *));
108     MOCK_METHOD1(releaseTexImage, gl::Error(const gl::Context *));
109 
110     MOCK_METHOD4(getAttachmentRenderTarget,
111                  gl::Error(const gl::Context *,
112                            GLenum,
113                            const gl::ImageIndex &,
114                            FramebufferAttachmentRenderTarget **));
115 
116     MOCK_METHOD6(setStorageMultisample,
117                  gl::Error(const gl::Context *, GLenum, GLsizei, GLint, const gl::Extents &, bool));
118 
119     MOCK_METHOD2(setBaseLevel, gl::Error(const gl::Context *, GLuint));
120 
121     MOCK_METHOD1(syncState, void(const gl::Texture::DirtyBits &));
122 
123     MOCK_METHOD0(destructor, void());
124 
125   protected:
126     gl::TextureState mMockState;
127 };
128 
129 }
130 
131 #endif // LIBANGLE_RENDERER_TEXTUREIMPLMOCK_H_
132