OLD | NEW |
| (Empty) |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // This file implements mock GL Interface for unit testing. It has to mock | |
6 // Desktop GL, not GLES2 as it is used to test the service side code. | |
7 | |
8 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_MOCK_H_ | |
9 #define GPU_COMMAND_BUFFER_SERVICE_GL_MOCK_H_ | |
10 | |
11 #include "gpu/command_buffer/service/gl_interface.h" | |
12 #include "testing/gmock/include/gmock/gmock.h" | |
13 | |
14 namespace gles2 { | |
15 | |
16 class MockGLInterface : public GLInterface { | |
17 public: | |
18 virtual ~MockGLInterface() { | |
19 } | |
20 | |
21 MOCK_METHOD1(ActiveTexture, void(GLenum texture)); | |
22 | |
23 MOCK_METHOD2(AttachShader, void(GLuint program, GLuint shader)); | |
24 | |
25 MOCK_METHOD3(BindAttribLocation, void( | |
26 GLuint program, GLuint index, const char* name)); | |
27 | |
28 MOCK_METHOD2(BindBuffer, void(GLenum target, GLuint buffer)); | |
29 | |
30 MOCK_METHOD2(BindFramebufferEXT, void(GLenum target, GLuint framebuffer)); | |
31 | |
32 MOCK_METHOD2(BindRenderbufferEXT, void(GLenum target, GLuint renderbuffer)); | |
33 | |
34 MOCK_METHOD2(BindTexture, void(GLenum target, GLuint texture)); | |
35 | |
36 MOCK_METHOD4(BlendColor, void( | |
37 GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)); | |
38 | |
39 MOCK_METHOD1(BlendEquation, void(GLenum mode)); | |
40 | |
41 MOCK_METHOD2(BlendEquationSeparate, void(GLenum modeRGB, GLenum modeAlpha)); | |
42 | |
43 MOCK_METHOD2(BlendFunc, void(GLenum sfactor, GLenum dfactor)); | |
44 | |
45 MOCK_METHOD4(BlendFuncSeparate, void( | |
46 GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)); | |
47 | |
48 MOCK_METHOD4(BufferData, void( | |
49 GLenum target, GLsizeiptr size, const void* data, GLenum usage)); | |
50 | |
51 MOCK_METHOD4(BufferSubData, void( | |
52 GLenum target, GLintptr offset, GLsizeiptr size, const void* data)); | |
53 | |
54 MOCK_METHOD1(CheckFramebufferStatusEXT, GLenum(GLenum target)); | |
55 | |
56 MOCK_METHOD1(Clear, void(GLbitfield mask)); | |
57 | |
58 MOCK_METHOD4(ClearColor, void( | |
59 GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)); | |
60 | |
61 MOCK_METHOD1(ClearDepth, void(GLclampf depth)); | |
62 | |
63 MOCK_METHOD1(ClearStencil, void(GLint s)); | |
64 | |
65 MOCK_METHOD4(ColorMask, void( | |
66 GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)); | |
67 | |
68 MOCK_METHOD1(CompileShader, void(GLuint shader)); | |
69 | |
70 MOCK_METHOD8(CompressedTexImage2D, void( | |
71 GLenum target, GLint level, GLenum internalformat, GLsizei width, | |
72 GLsizei height, GLint border, GLsizei imageSize, const void* data)); | |
73 | |
74 MOCK_METHOD9(CompressedTexSubImage2D, void( | |
75 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, | |
76 GLsizei height, GLenum format, GLsizei imageSize, const void* data)); | |
77 | |
78 MOCK_METHOD8(CopyTexImage2D, void( | |
79 GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, | |
80 GLsizei width, GLsizei height, GLint border)); | |
81 | |
82 MOCK_METHOD8(CopyTexSubImage2D, void( | |
83 GLenum target, GLint level, GLint xoffset, GLint yoffset, | |
84 GLint x, GLint y, GLsizei width, GLsizei height)); | |
85 | |
86 MOCK_METHOD0(CreateProgram, GLuint()); | |
87 | |
88 MOCK_METHOD1(CreateShader, GLuint(GLenum type)); | |
89 | |
90 MOCK_METHOD1(CullFace, void(GLenum mode)); | |
91 | |
92 MOCK_METHOD2(DeleteBuffersARB, void(GLsizei n, const GLuint* buffers)); | |
93 | |
94 MOCK_METHOD2(DeleteFramebuffersEXT, | |
95 void(GLsizei n, const GLuint* framebuffers)); | |
96 | |
97 MOCK_METHOD1(DeleteProgram, void(GLuint program)); | |
98 | |
99 MOCK_METHOD2(DeleteRenderbuffersEXT, void( | |
100 GLsizei n, const GLuint* renderbuffers)); | |
101 | |
102 MOCK_METHOD1(DeleteShader, void(GLuint shader)); | |
103 | |
104 MOCK_METHOD2(DeleteTextures, void(GLsizei n, const GLuint* textures)); | |
105 | |
106 MOCK_METHOD1(DepthFunc, void(GLenum func)); | |
107 | |
108 MOCK_METHOD1(DepthMask, void(GLboolean flag)); | |
109 | |
110 MOCK_METHOD2(DepthRange, void(GLclampf zNear, GLclampf zFar)); | |
111 | |
112 MOCK_METHOD2(DetachShader, void(GLuint program, GLuint shader)); | |
113 | |
114 MOCK_METHOD1(Disable, void(GLenum cap)); | |
115 | |
116 MOCK_METHOD1(DisableVertexAttribArray, void(GLuint index)); | |
117 | |
118 MOCK_METHOD3(DrawArrays, void(GLenum mode, GLint first, GLsizei count)); | |
119 | |
120 MOCK_METHOD4(DrawElements, void( | |
121 GLenum mode, GLsizei count, GLenum type, const void* indices)); | |
122 | |
123 MOCK_METHOD1(Enable, void(GLenum cap)); | |
124 | |
125 MOCK_METHOD1(EnableVertexAttribArray, void(GLuint index)); | |
126 | |
127 MOCK_METHOD0(Finish, void()); | |
128 | |
129 MOCK_METHOD0(Flush, void()); | |
130 | |
131 MOCK_METHOD4(FramebufferRenderbufferEXT, void( | |
132 GLenum target, GLenum attachment, GLenum renderbuffertarget, | |
133 GLuint renderbuffer)); | |
134 | |
135 MOCK_METHOD5(FramebufferTexture2DEXT, void( | |
136 GLenum target, GLenum attachment, GLenum textarget, GLuint texture, | |
137 GLint level)); | |
138 | |
139 MOCK_METHOD1(FrontFace, void(GLenum mode)); | |
140 | |
141 MOCK_METHOD2(GenBuffersARB, void(GLsizei n, GLuint* buffers)); | |
142 | |
143 MOCK_METHOD1(GenerateMipmapEXT, void(GLenum target)); | |
144 | |
145 MOCK_METHOD2(GenFramebuffersEXT, void(GLsizei n, GLuint* framebuffers)); | |
146 | |
147 MOCK_METHOD2(GenRenderbuffersEXT, void(GLsizei n, GLuint* renderbuffers)); | |
148 | |
149 MOCK_METHOD2(GenTextures, void(GLsizei n, GLuint* textures)); | |
150 | |
151 MOCK_METHOD7(GetActiveAttrib, void( | |
152 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, | |
153 GLint* size, GLenum* type, char* name)); | |
154 | |
155 MOCK_METHOD7(GetActiveUniform, void( | |
156 GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, | |
157 GLint* size, GLenum* type, char* name)); | |
158 | |
159 MOCK_METHOD4(GetAttachedShaders, void( | |
160 GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)); | |
161 | |
162 MOCK_METHOD2(GetAttribLocation, GLint(GLuint program, const char* name)); | |
163 | |
164 MOCK_METHOD2(GetBooleanv, void(GLenum pname, GLboolean* params)); | |
165 | |
166 MOCK_METHOD3(GetBufferParameteriv, void( | |
167 GLenum target, GLenum pname, GLint* params)); | |
168 | |
169 MOCK_METHOD0(GetError, GLenum()); | |
170 | |
171 MOCK_METHOD2(GetFloatv, void(GLenum pname, GLfloat* params)); | |
172 | |
173 MOCK_METHOD4(GetFramebufferAttachmentParameterivEXT, void( | |
174 GLenum target, GLenum attachment, GLenum pname, GLint* params)); | |
175 | |
176 MOCK_METHOD2(GetIntegerv, void(GLenum pname, GLint* params)); | |
177 | |
178 MOCK_METHOD3(GetProgramiv, void(GLuint program, GLenum pname, GLint* params)); | |
179 | |
180 MOCK_METHOD4(GetProgramInfoLog, void( | |
181 GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)); | |
182 | |
183 MOCK_METHOD3(GetRenderbufferParameterivEXT, void( | |
184 GLenum target, GLenum pname, GLint* params)); | |
185 | |
186 MOCK_METHOD3(GetShaderiv, void(GLuint shader, GLenum pname, GLint* params)); | |
187 | |
188 MOCK_METHOD4(GetShaderInfoLog, void( | |
189 GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)); | |
190 | |
191 MOCK_METHOD4(GetShaderPrecisionFormat, void( | |
192 GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)); | |
193 | |
194 MOCK_METHOD4(GetShaderSource, void( | |
195 GLuint shader, GLsizei bufsize, GLsizei* length, char* source)); | |
196 | |
197 MOCK_METHOD1(GetString, const GLubyte*(GLenum name)); | |
198 | |
199 MOCK_METHOD3(GetTexParameterfv, void( | |
200 GLenum target, GLenum pname, GLfloat* params)); | |
201 | |
202 MOCK_METHOD3(GetTexParameteriv, void( | |
203 GLenum target, GLenum pname, GLint* params)); | |
204 | |
205 MOCK_METHOD3(GetUniformfv, | |
206 void(GLuint program, GLint location, GLfloat* params)); | |
207 | |
208 MOCK_METHOD3(GetUniformiv, | |
209 void(GLuint program, GLint location, GLint* params)); | |
210 | |
211 MOCK_METHOD2(GetUniformLocation, GLint(GLuint program, const char* name)); | |
212 | |
213 MOCK_METHOD3(GetVertexAttribfv, void( | |
214 GLuint index, GLenum pname, GLfloat* params)); | |
215 | |
216 MOCK_METHOD3(GetVertexAttribiv, | |
217 void(GLuint index, GLenum pname, GLint* params)); | |
218 | |
219 MOCK_METHOD3(GetVertexAttribPointerv, void( | |
220 GLuint index, GLenum pname, void** pointer)); | |
221 | |
222 MOCK_METHOD2(Hint, void(GLenum target, GLenum mode)); | |
223 | |
224 MOCK_METHOD1(IsBuffer, GLboolean(GLuint buffer)); | |
225 | |
226 MOCK_METHOD1(IsEnabled, GLboolean(GLenum cap)); | |
227 | |
228 MOCK_METHOD1(IsFramebuffer, GLboolean(GLuint framebuffer)); | |
229 | |
230 MOCK_METHOD1(IsProgram, GLboolean(GLuint program)); | |
231 | |
232 MOCK_METHOD1(IsRenderbuffer, GLboolean(GLuint renderbuffer)); | |
233 | |
234 MOCK_METHOD1(IsShader, GLboolean(GLuint shader)); | |
235 | |
236 MOCK_METHOD1(IsTexture, GLboolean(GLuint texture)); | |
237 | |
238 MOCK_METHOD1(LineWidth, void(GLfloat width)); | |
239 | |
240 MOCK_METHOD1(LinkProgram, void(GLuint program)); | |
241 | |
242 MOCK_METHOD2(PixelStorei, void(GLenum pname, GLint param)); | |
243 | |
244 MOCK_METHOD2(PolygonOffset, void(GLfloat factor, GLfloat units)); | |
245 | |
246 MOCK_METHOD7(ReadPixels, void( | |
247 GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, | |
248 GLenum type, void* pixels)); | |
249 | |
250 MOCK_METHOD0(ReleaseShaderCompiler, void()); | |
251 | |
252 MOCK_METHOD4(RenderbufferStorageEXT, void( | |
253 GLenum target, GLenum internalformat, GLsizei width, GLsizei height)); | |
254 | |
255 MOCK_METHOD2(SampleCoverage, void(GLclampf value, GLboolean invert)); | |
256 | |
257 MOCK_METHOD4(Scissor, void(GLint x, GLint y, GLsizei width, GLsizei height)); | |
258 | |
259 MOCK_METHOD5(ShaderBinary, void( | |
260 GLsizei n, const GLuint* shaders, GLenum binaryformat, | |
261 const void* binary, GLsizei length)); | |
262 | |
263 MOCK_METHOD4(ShaderSource, void( | |
264 GLuint shader, GLsizei count, const char** str, const GLint* length)); | |
265 | |
266 MOCK_METHOD3(StencilFunc, void(GLenum func, GLint ref, GLuint mask)); | |
267 | |
268 MOCK_METHOD4(StencilFuncSeparate, void( | |
269 GLenum face, GLenum func, GLint ref, GLuint mask)); | |
270 | |
271 MOCK_METHOD1(StencilMask, void(GLuint mask)); | |
272 | |
273 MOCK_METHOD2(StencilMaskSeparate, void(GLenum face, GLuint mask)); | |
274 | |
275 MOCK_METHOD3(StencilOp, void(GLenum fail, GLenum zfail, GLenum zpass)); | |
276 | |
277 MOCK_METHOD4(StencilOpSeparate, void( | |
278 GLenum face, GLenum fail, GLenum zfail, GLenum zpass)); | |
279 | |
280 MOCK_METHOD9(TexImage2D, void( | |
281 GLenum target, GLint level, GLint internalformat, GLsizei width, | |
282 GLsizei height, GLint border, GLenum format, GLenum type, | |
283 const void* pixels)); | |
284 | |
285 MOCK_METHOD3(TexParameterf, void(GLenum target, GLenum pname, GLfloat param)); | |
286 | |
287 MOCK_METHOD3(TexParameterfv, void( | |
288 GLenum target, GLenum pname, const GLfloat* params)); | |
289 | |
290 MOCK_METHOD3(TexParameteri, void(GLenum target, GLenum pname, GLint param)); | |
291 | |
292 MOCK_METHOD3(TexParameteriv, void( | |
293 GLenum target, GLenum pname, const GLint* params)); | |
294 | |
295 MOCK_METHOD9(TexSubImage2D, void( | |
296 GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, | |
297 GLsizei height, GLenum format, GLenum type, const void* pixels)); | |
298 | |
299 MOCK_METHOD2(Uniform1f, void(GLint location, GLfloat x)); | |
300 | |
301 MOCK_METHOD3(Uniform1fv, | |
302 void(GLint location, GLsizei count, const GLfloat* v)); | |
303 | |
304 MOCK_METHOD2(Uniform1i, void(GLint location, GLint x)); | |
305 | |
306 MOCK_METHOD3(Uniform1iv, void(GLint location, GLsizei count, const GLint* v)); | |
307 | |
308 MOCK_METHOD3(Uniform2f, void(GLint location, GLfloat x, GLfloat y)); | |
309 | |
310 MOCK_METHOD3(Uniform2fv, | |
311 void(GLint location, GLsizei count, const GLfloat* v)); | |
312 | |
313 MOCK_METHOD3(Uniform2i, void(GLint location, GLint x, GLint y)); | |
314 | |
315 MOCK_METHOD3(Uniform2iv, void(GLint location, GLsizei count, const GLint* v)); | |
316 | |
317 MOCK_METHOD4(Uniform3f, | |
318 void(GLint location, GLfloat x, GLfloat y, GLfloat z)); | |
319 | |
320 MOCK_METHOD3(Uniform3fv, | |
321 void(GLint location, GLsizei count, const GLfloat* v)); | |
322 | |
323 MOCK_METHOD4(Uniform3i, void(GLint location, GLint x, GLint y, GLint z)); | |
324 | |
325 MOCK_METHOD3(Uniform3iv, void(GLint location, GLsizei count, const GLint* v)); | |
326 | |
327 MOCK_METHOD5(Uniform4f, void( | |
328 GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)); | |
329 | |
330 MOCK_METHOD3(Uniform4fv, | |
331 void(GLint location, GLsizei count, const GLfloat* v)); | |
332 | |
333 MOCK_METHOD5(Uniform4i, | |
334 void(GLint location, GLint x, GLint y, GLint z, GLint w)); | |
335 | |
336 MOCK_METHOD3(Uniform4iv, void(GLint location, GLsizei count, const GLint* v)); | |
337 | |
338 MOCK_METHOD4(UniformMatrix2fv, void( | |
339 GLint location, GLsizei count, GLboolean transpose, | |
340 const GLfloat* value)); | |
341 | |
342 MOCK_METHOD4(UniformMatrix3fv, void( | |
343 GLint location, GLsizei count, GLboolean transpose, | |
344 const GLfloat* value)); | |
345 | |
346 MOCK_METHOD4(UniformMatrix4fv, void( | |
347 GLint location, GLsizei count, GLboolean transpose, | |
348 const GLfloat* value)); | |
349 | |
350 MOCK_METHOD1(UseProgram, void(GLuint program)); | |
351 | |
352 MOCK_METHOD1(ValidateProgram, void(GLuint program)); | |
353 | |
354 MOCK_METHOD2(VertexAttrib1f, void(GLuint indx, GLfloat x)); | |
355 | |
356 MOCK_METHOD2(VertexAttrib1fv, void(GLuint indx, const GLfloat* values)); | |
357 | |
358 MOCK_METHOD3(VertexAttrib2f, void(GLuint indx, GLfloat x, GLfloat y)); | |
359 | |
360 MOCK_METHOD2(VertexAttrib2fv, void(GLuint indx, const GLfloat* values)); | |
361 | |
362 MOCK_METHOD4(VertexAttrib3f, | |
363 void(GLuint indx, GLfloat x, GLfloat y, GLfloat z)); | |
364 | |
365 MOCK_METHOD2(VertexAttrib3fv, void(GLuint indx, const GLfloat* values)); | |
366 | |
367 MOCK_METHOD5(VertexAttrib4f, void( | |
368 GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)); | |
369 | |
370 MOCK_METHOD2(VertexAttrib4fv, void(GLuint indx, const GLfloat* values)); | |
371 | |
372 MOCK_METHOD6(VertexAttribPointer, void( | |
373 GLuint indx, GLint size, GLenum type, GLboolean normalized, | |
374 GLsizei stride, const void* ptr)); | |
375 | |
376 MOCK_METHOD4(Viewport, void(GLint x, GLint y, GLsizei width, GLsizei height)); | |
377 | |
378 MOCK_METHOD0(SwapBuffers, void()); | |
379 | |
380 MOCK_METHOD4(GetMaxValueInBuffer, GLuint( | |
381 GLuint buffer_id, GLsizei count, GLenum type, GLuint offset)); | |
382 }; | |
383 | |
384 } // namespace gles2 | |
385 | |
386 #endif // GPU_COMMAND_BUFFER_SERVICE_GL_MOCK_H_ | |
387 | |
388 | |
389 | |
OLD | NEW |