1 // Copyright 2014 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.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
11 // It is included by gles2_cmd_decoder_unittest_1.cc
12 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_
13 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_
15 // TODO(gman): ActiveTexture
17 TEST_P(GLES2DecoderTest1
, AttachShaderValidArgs
) {
18 EXPECT_CALL(*gl_
, AttachShader(kServiceProgramId
, kServiceShaderId
));
19 SpecializedSetup
<cmds::AttachShader
, 0>(true);
20 cmds::AttachShader cmd
;
21 cmd
.Init(client_program_id_
, client_shader_id_
);
22 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
23 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
25 // TODO(gman): BindAttribLocationBucket
27 TEST_P(GLES2DecoderTest1
, BindBufferValidArgs
) {
28 EXPECT_CALL(*gl_
, BindBuffer(GL_ARRAY_BUFFER
, kServiceBufferId
));
29 SpecializedSetup
<cmds::BindBuffer
, 0>(true);
31 cmd
.Init(GL_ARRAY_BUFFER
, client_buffer_id_
);
32 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
33 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
36 TEST_P(GLES2DecoderTest1
, BindBufferValidArgsNewId
) {
37 EXPECT_CALL(*gl_
, BindBuffer(GL_ARRAY_BUFFER
, kNewServiceId
));
38 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
39 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
40 SpecializedSetup
<cmds::BindBuffer
, 0>(true);
42 cmd
.Init(GL_ARRAY_BUFFER
, kNewClientId
);
43 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
44 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
45 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
48 TEST_P(GLES2DecoderTest1
, BindBufferInvalidArgs0_0
) {
49 EXPECT_CALL(*gl_
, BindBuffer(_
, _
)).Times(0);
50 SpecializedSetup
<cmds::BindBuffer
, 0>(false);
52 cmd
.Init(GL_RENDERBUFFER
, client_buffer_id_
);
53 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
54 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
57 TEST_P(GLES2DecoderTest1
, BindFramebufferValidArgs
) {
58 EXPECT_CALL(*gl_
, BindFramebufferEXT(GL_FRAMEBUFFER
, kServiceFramebufferId
));
59 SpecializedSetup
<cmds::BindFramebuffer
, 0>(true);
60 cmds::BindFramebuffer cmd
;
61 cmd
.Init(GL_FRAMEBUFFER
, client_framebuffer_id_
);
62 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
63 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
66 TEST_P(GLES2DecoderTest1
, BindFramebufferValidArgsNewId
) {
67 EXPECT_CALL(*gl_
, BindFramebufferEXT(GL_FRAMEBUFFER
, kNewServiceId
));
68 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
69 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
70 SpecializedSetup
<cmds::BindFramebuffer
, 0>(true);
71 cmds::BindFramebuffer cmd
;
72 cmd
.Init(GL_FRAMEBUFFER
, kNewClientId
);
73 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
74 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
75 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
78 TEST_P(GLES2DecoderTest1
, BindFramebufferInvalidArgs0_0
) {
79 EXPECT_CALL(*gl_
, BindFramebufferEXT(_
, _
)).Times(0);
80 SpecializedSetup
<cmds::BindFramebuffer
, 0>(false);
81 cmds::BindFramebuffer cmd
;
82 cmd
.Init(GL_DRAW_FRAMEBUFFER
, client_framebuffer_id_
);
83 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
84 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
87 TEST_P(GLES2DecoderTest1
, BindFramebufferInvalidArgs0_1
) {
88 EXPECT_CALL(*gl_
, BindFramebufferEXT(_
, _
)).Times(0);
89 SpecializedSetup
<cmds::BindFramebuffer
, 0>(false);
90 cmds::BindFramebuffer cmd
;
91 cmd
.Init(GL_READ_FRAMEBUFFER
, client_framebuffer_id_
);
92 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
93 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
96 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgs
) {
98 BindRenderbufferEXT(GL_RENDERBUFFER
, kServiceRenderbufferId
));
99 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
100 cmds::BindRenderbuffer cmd
;
101 cmd
.Init(GL_RENDERBUFFER
, client_renderbuffer_id_
);
102 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
103 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
106 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgsNewId
) {
107 EXPECT_CALL(*gl_
, BindRenderbufferEXT(GL_RENDERBUFFER
, kNewServiceId
));
108 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
109 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
110 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
111 cmds::BindRenderbuffer cmd
;
112 cmd
.Init(GL_RENDERBUFFER
, kNewClientId
);
113 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
114 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
115 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
118 TEST_P(GLES2DecoderTest1
, BindRenderbufferInvalidArgs0_0
) {
119 EXPECT_CALL(*gl_
, BindRenderbufferEXT(_
, _
)).Times(0);
120 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(false);
121 cmds::BindRenderbuffer cmd
;
122 cmd
.Init(GL_FRAMEBUFFER
, client_renderbuffer_id_
);
123 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
124 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
127 TEST_P(GLES2DecoderTest1
, BindSamplerValidArgs
) {
128 EXPECT_CALL(*gl_
, BindSampler(1, kServiceSamplerId
));
129 SpecializedSetup
<cmds::BindSampler
, 0>(true);
130 cmds::BindSampler cmd
;
131 cmd
.Init(1, client_sampler_id_
);
132 decoder_
->set_unsafe_es3_apis_enabled(true);
133 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
134 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
135 decoder_
->set_unsafe_es3_apis_enabled(false);
136 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
139 TEST_P(GLES2DecoderTest1
, BindTextureValidArgs
) {
140 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kServiceTextureId
));
141 SpecializedSetup
<cmds::BindTexture
, 0>(true);
142 cmds::BindTexture cmd
;
143 cmd
.Init(GL_TEXTURE_2D
, client_texture_id_
);
144 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
145 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
148 TEST_P(GLES2DecoderTest1
, BindTextureValidArgsNewId
) {
149 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kNewServiceId
));
150 EXPECT_CALL(*gl_
, GenTextures(1, _
))
151 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
152 SpecializedSetup
<cmds::BindTexture
, 0>(true);
153 cmds::BindTexture cmd
;
154 cmd
.Init(GL_TEXTURE_2D
, kNewClientId
);
155 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
156 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
157 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
160 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_0
) {
161 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
162 SpecializedSetup
<cmds::BindTexture
, 0>(false);
163 cmds::BindTexture cmd
;
164 cmd
.Init(GL_TEXTURE_1D
, client_texture_id_
);
165 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
166 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
169 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_1
) {
170 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
171 SpecializedSetup
<cmds::BindTexture
, 0>(false);
172 cmds::BindTexture cmd
;
173 cmd
.Init(GL_TEXTURE_3D
, client_texture_id_
);
174 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
175 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
178 TEST_P(GLES2DecoderTest1
, BindTransformFeedbackValidArgs
) {
179 EXPECT_CALL(*gl_
, BindTransformFeedback(GL_TRANSFORM_FEEDBACK
,
180 kServiceTransformFeedbackId
));
181 SpecializedSetup
<cmds::BindTransformFeedback
, 0>(true);
182 cmds::BindTransformFeedback cmd
;
183 cmd
.Init(GL_TRANSFORM_FEEDBACK
, client_transformfeedback_id_
);
184 decoder_
->set_unsafe_es3_apis_enabled(true);
185 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
186 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
187 decoder_
->set_unsafe_es3_apis_enabled(false);
188 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
191 TEST_P(GLES2DecoderTest1
, BlendColorValidArgs
) {
192 EXPECT_CALL(*gl_
, BlendColor(1, 2, 3, 4));
193 SpecializedSetup
<cmds::BlendColor
, 0>(true);
194 cmds::BlendColor cmd
;
195 cmd
.Init(1, 2, 3, 4);
196 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
197 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
200 TEST_P(GLES2DecoderTest1
, BlendEquationValidArgs
) {
201 EXPECT_CALL(*gl_
, BlendEquation(GL_FUNC_SUBTRACT
));
202 SpecializedSetup
<cmds::BlendEquation
, 0>(true);
203 cmds::BlendEquation cmd
;
204 cmd
.Init(GL_FUNC_SUBTRACT
);
205 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
206 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
209 TEST_P(GLES2DecoderTest1
, BlendEquationInvalidArgs0_0
) {
210 EXPECT_CALL(*gl_
, BlendEquation(_
)).Times(0);
211 SpecializedSetup
<cmds::BlendEquation
, 0>(false);
212 cmds::BlendEquation cmd
;
214 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
215 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
218 TEST_P(GLES2DecoderTest1
, BlendEquationInvalidArgs0_1
) {
219 EXPECT_CALL(*gl_
, BlendEquation(_
)).Times(0);
220 SpecializedSetup
<cmds::BlendEquation
, 0>(false);
221 cmds::BlendEquation cmd
;
223 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
224 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
227 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateValidArgs
) {
228 EXPECT_CALL(*gl_
, BlendEquationSeparate(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
));
229 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(true);
230 cmds::BlendEquationSeparate cmd
;
231 cmd
.Init(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
);
232 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
233 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
236 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs0_0
) {
237 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
238 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
239 cmds::BlendEquationSeparate cmd
;
240 cmd
.Init(GL_MIN
, GL_FUNC_ADD
);
241 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
242 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
245 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs0_1
) {
246 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
247 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
248 cmds::BlendEquationSeparate cmd
;
249 cmd
.Init(GL_MAX
, GL_FUNC_ADD
);
250 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
251 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
254 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs1_0
) {
255 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
256 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
257 cmds::BlendEquationSeparate cmd
;
258 cmd
.Init(GL_FUNC_SUBTRACT
, GL_MIN
);
259 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
260 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
263 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs1_1
) {
264 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
265 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
266 cmds::BlendEquationSeparate cmd
;
267 cmd
.Init(GL_FUNC_SUBTRACT
, GL_MAX
);
268 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
269 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
272 TEST_P(GLES2DecoderTest1
, BlendFuncValidArgs
) {
273 EXPECT_CALL(*gl_
, BlendFunc(GL_ZERO
, GL_ZERO
));
274 SpecializedSetup
<cmds::BlendFunc
, 0>(true);
276 cmd
.Init(GL_ZERO
, GL_ZERO
);
277 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
278 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
281 TEST_P(GLES2DecoderTest1
, BlendFuncSeparateValidArgs
) {
282 EXPECT_CALL(*gl_
, BlendFuncSeparate(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
));
283 SpecializedSetup
<cmds::BlendFuncSeparate
, 0>(true);
284 cmds::BlendFuncSeparate cmd
;
285 cmd
.Init(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
);
286 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
287 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
289 // TODO(gman): BufferData
291 // TODO(gman): BufferSubData
293 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusValidArgs
) {
294 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
));
295 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(true);
296 cmds::CheckFramebufferStatus cmd
;
297 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
298 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
299 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
302 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgs0_0
) {
303 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(_
)).Times(0);
304 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
305 cmds::CheckFramebufferStatus cmd
;
306 cmd
.Init(GL_DRAW_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
307 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
308 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
311 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgs0_1
) {
312 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(_
)).Times(0);
313 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
314 cmds::CheckFramebufferStatus cmd
;
315 cmd
.Init(GL_READ_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
316 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
317 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
320 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgsBadSharedMemoryId
) {
321 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
)).Times(0);
322 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
323 cmds::CheckFramebufferStatus cmd
;
324 cmd
.Init(GL_FRAMEBUFFER
, kInvalidSharedMemoryId
, shared_memory_offset_
);
325 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
326 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
327 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
330 TEST_P(GLES2DecoderTest1
, ClearValidArgs
) {
331 EXPECT_CALL(*gl_
, Clear(1));
332 SpecializedSetup
<cmds::Clear
, 0>(true);
335 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
336 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
339 TEST_P(GLES2DecoderTest1
, ClearColorValidArgs
) {
340 EXPECT_CALL(*gl_
, ClearColor(1, 2, 3, 4));
341 SpecializedSetup
<cmds::ClearColor
, 0>(true);
342 cmds::ClearColor cmd
;
343 cmd
.Init(1, 2, 3, 4);
344 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
345 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
348 TEST_P(GLES2DecoderTest1
, ClearDepthfValidArgs
) {
349 EXPECT_CALL(*gl_
, ClearDepth(0.5f
));
350 SpecializedSetup
<cmds::ClearDepthf
, 0>(true);
351 cmds::ClearDepthf cmd
;
353 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
354 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
357 TEST_P(GLES2DecoderTest1
, ClearStencilValidArgs
) {
358 EXPECT_CALL(*gl_
, ClearStencil(1));
359 SpecializedSetup
<cmds::ClearStencil
, 0>(true);
360 cmds::ClearStencil cmd
;
362 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
363 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
366 TEST_P(GLES2DecoderTest1
, ColorMaskValidArgs
) {
367 SpecializedSetup
<cmds::ColorMask
, 0>(true);
369 cmd
.Init(true, true, true, true);
370 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
371 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
373 // TODO(gman): CompileShader
374 // TODO(gman): CompressedTexImage2DBucket
375 // TODO(gman): CompressedTexImage2D
377 // TODO(gman): CompressedTexSubImage2DBucket
378 // TODO(gman): CompressedTexSubImage2D
380 TEST_P(GLES2DecoderTest1
, CopyBufferSubDataValidArgs
) {
382 CopyBufferSubData(GL_ARRAY_BUFFER
, GL_ARRAY_BUFFER
, 3, 4, 5));
383 SpecializedSetup
<cmds::CopyBufferSubData
, 0>(true);
384 cmds::CopyBufferSubData cmd
;
385 cmd
.Init(GL_ARRAY_BUFFER
, GL_ARRAY_BUFFER
, 3, 4, 5);
386 decoder_
->set_unsafe_es3_apis_enabled(true);
387 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
388 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
389 decoder_
->set_unsafe_es3_apis_enabled(false);
390 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
392 // TODO(gman): CopyTexImage2D
394 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DValidArgs
) {
395 EXPECT_CALL(*gl_
, CopyTexSubImage2D(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8));
396 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(true);
397 cmds::CopyTexSubImage2D cmd
;
398 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8);
399 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
400 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
403 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs0_0
) {
404 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
405 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
406 cmds::CopyTexSubImage2D cmd
;
407 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, 2, 3, 4, 5, 6, 7, 8);
408 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
409 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
412 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs6_0
) {
413 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
414 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
415 cmds::CopyTexSubImage2D cmd
;
416 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, -1, 8);
417 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
418 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
421 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs7_0
) {
422 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
423 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
424 cmds::CopyTexSubImage2D cmd
;
425 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, -1);
426 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
427 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
430 TEST_P(GLES2DecoderTest1
, CreateProgramValidArgs
) {
431 EXPECT_CALL(*gl_
, CreateProgram()).WillOnce(Return(kNewServiceId
));
432 SpecializedSetup
<cmds::CreateProgram
, 0>(true);
433 cmds::CreateProgram cmd
;
434 cmd
.Init(kNewClientId
);
435 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
436 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
437 EXPECT_TRUE(GetProgram(kNewClientId
) != NULL
);
440 TEST_P(GLES2DecoderTest1
, CreateShaderValidArgs
) {
441 EXPECT_CALL(*gl_
, CreateShader(GL_VERTEX_SHADER
))
442 .WillOnce(Return(kNewServiceId
));
443 SpecializedSetup
<cmds::CreateShader
, 0>(true);
444 cmds::CreateShader cmd
;
445 cmd
.Init(GL_VERTEX_SHADER
, kNewClientId
);
446 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
447 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
448 EXPECT_TRUE(GetShader(kNewClientId
) != NULL
);
451 TEST_P(GLES2DecoderTest1
, CreateShaderInvalidArgs0_0
) {
452 EXPECT_CALL(*gl_
, CreateShader(_
)).Times(0);
453 SpecializedSetup
<cmds::CreateShader
, 0>(false);
454 cmds::CreateShader cmd
;
455 cmd
.Init(GL_GEOMETRY_SHADER
, kNewClientId
);
456 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
457 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
460 TEST_P(GLES2DecoderTest1
, CullFaceValidArgs
) {
461 EXPECT_CALL(*gl_
, CullFace(GL_FRONT
));
462 SpecializedSetup
<cmds::CullFace
, 0>(true);
465 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
466 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
469 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateValidArgs
) {
470 EXPECT_CALL(*gl_
, DeleteBuffersARB(1, Pointee(kServiceBufferId
))).Times(1);
471 cmds::DeleteBuffersImmediate
& cmd
=
472 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
473 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(true);
474 cmd
.Init(1, &client_buffer_id_
);
475 EXPECT_EQ(error::kNoError
,
476 ExecuteImmediateCmd(cmd
, sizeof(client_buffer_id_
)));
477 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
478 EXPECT_TRUE(GetBuffer(client_buffer_id_
) == NULL
);
481 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateInvalidArgs
) {
482 cmds::DeleteBuffersImmediate
& cmd
=
483 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
484 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(false);
485 GLuint temp
= kInvalidClientId
;
487 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
490 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateValidArgs
) {
491 EXPECT_CALL(*gl_
, DeleteFramebuffersEXT(1, Pointee(kServiceFramebufferId
)))
493 cmds::DeleteFramebuffersImmediate
& cmd
=
494 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
495 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(true);
496 cmd
.Init(1, &client_framebuffer_id_
);
497 EXPECT_EQ(error::kNoError
,
498 ExecuteImmediateCmd(cmd
, sizeof(client_framebuffer_id_
)));
499 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
500 EXPECT_TRUE(GetFramebuffer(client_framebuffer_id_
) == NULL
);
503 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateInvalidArgs
) {
504 cmds::DeleteFramebuffersImmediate
& cmd
=
505 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
506 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(false);
507 GLuint temp
= kInvalidClientId
;
509 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
512 TEST_P(GLES2DecoderTest1
, DeleteProgramValidArgs
) {
513 EXPECT_CALL(*gl_
, DeleteProgram(kServiceProgramId
));
514 SpecializedSetup
<cmds::DeleteProgram
, 0>(true);
515 cmds::DeleteProgram cmd
;
516 cmd
.Init(client_program_id_
);
517 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
518 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
521 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateValidArgs
) {
522 EXPECT_CALL(*gl_
, DeleteRenderbuffersEXT(1, Pointee(kServiceRenderbufferId
)))
524 cmds::DeleteRenderbuffersImmediate
& cmd
=
525 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
526 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(true);
527 cmd
.Init(1, &client_renderbuffer_id_
);
528 EXPECT_EQ(error::kNoError
,
529 ExecuteImmediateCmd(cmd
, sizeof(client_renderbuffer_id_
)));
530 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
531 EXPECT_TRUE(GetRenderbuffer(client_renderbuffer_id_
) == NULL
);
534 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateInvalidArgs
) {
535 cmds::DeleteRenderbuffersImmediate
& cmd
=
536 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
537 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(false);
538 GLuint temp
= kInvalidClientId
;
540 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
543 TEST_P(GLES2DecoderTest1
, DeleteSamplersImmediateValidArgs
) {
544 EXPECT_CALL(*gl_
, DeleteSamplers(1, Pointee(kServiceSamplerId
))).Times(1);
545 cmds::DeleteSamplersImmediate
& cmd
=
546 *GetImmediateAs
<cmds::DeleteSamplersImmediate
>();
547 SpecializedSetup
<cmds::DeleteSamplersImmediate
, 0>(true);
548 cmd
.Init(1, &client_sampler_id_
);
549 decoder_
->set_unsafe_es3_apis_enabled(true);
550 EXPECT_EQ(error::kNoError
,
551 ExecuteImmediateCmd(cmd
, sizeof(client_sampler_id_
)));
552 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
553 EXPECT_FALSE(GetSamplerServiceId(client_sampler_id_
, NULL
));
554 decoder_
->set_unsafe_es3_apis_enabled(false);
555 EXPECT_EQ(error::kUnknownCommand
,
556 ExecuteImmediateCmd(cmd
, sizeof(client_sampler_id_
)));
559 TEST_P(GLES2DecoderTest1
, DeleteSamplersImmediateInvalidArgs
) {
560 cmds::DeleteSamplersImmediate
& cmd
=
561 *GetImmediateAs
<cmds::DeleteSamplersImmediate
>();
562 SpecializedSetup
<cmds::DeleteSamplersImmediate
, 0>(false);
563 GLuint temp
= kInvalidClientId
;
565 decoder_
->set_unsafe_es3_apis_enabled(true);
566 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
567 decoder_
->set_unsafe_es3_apis_enabled(false);
568 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
571 TEST_P(GLES2DecoderTest1
, DeleteShaderValidArgs
) {
572 EXPECT_CALL(*gl_
, DeleteShader(kServiceShaderId
));
573 SpecializedSetup
<cmds::DeleteShader
, 0>(true);
574 cmds::DeleteShader cmd
;
575 cmd
.Init(client_shader_id_
);
576 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
577 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
580 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateValidArgs
) {
581 EXPECT_CALL(*gl_
, DeleteTextures(1, Pointee(kServiceTextureId
))).Times(1);
582 cmds::DeleteTexturesImmediate
& cmd
=
583 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
584 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(true);
585 cmd
.Init(1, &client_texture_id_
);
586 EXPECT_EQ(error::kNoError
,
587 ExecuteImmediateCmd(cmd
, sizeof(client_texture_id_
)));
588 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
589 EXPECT_TRUE(GetTexture(client_texture_id_
) == NULL
);
592 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateInvalidArgs
) {
593 cmds::DeleteTexturesImmediate
& cmd
=
594 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
595 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(false);
596 GLuint temp
= kInvalidClientId
;
598 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
601 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateValidArgs
) {
602 EXPECT_CALL(*gl_
, DeleteTransformFeedbacks(
603 1, Pointee(kServiceTransformFeedbackId
))).Times(1);
604 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
605 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
606 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(true);
607 cmd
.Init(1, &client_transformfeedback_id_
);
608 decoder_
->set_unsafe_es3_apis_enabled(true);
609 EXPECT_EQ(error::kNoError
,
610 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
611 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
613 GetTransformFeedbackServiceId(client_transformfeedback_id_
, NULL
));
614 decoder_
->set_unsafe_es3_apis_enabled(false);
615 EXPECT_EQ(error::kUnknownCommand
,
616 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
619 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateInvalidArgs
) {
620 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
621 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
622 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(false);
623 GLuint temp
= kInvalidClientId
;
625 decoder_
->set_unsafe_es3_apis_enabled(true);
626 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
627 decoder_
->set_unsafe_es3_apis_enabled(false);
628 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
631 TEST_P(GLES2DecoderTest1
, DepthFuncValidArgs
) {
632 EXPECT_CALL(*gl_
, DepthFunc(GL_NEVER
));
633 SpecializedSetup
<cmds::DepthFunc
, 0>(true);
636 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
637 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
640 TEST_P(GLES2DecoderTest1
, DepthMaskValidArgs
) {
641 SpecializedSetup
<cmds::DepthMask
, 0>(true);
644 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
645 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
648 TEST_P(GLES2DecoderTest1
, DepthRangefValidArgs
) {
649 EXPECT_CALL(*gl_
, DepthRange(1, 2));
650 SpecializedSetup
<cmds::DepthRangef
, 0>(true);
651 cmds::DepthRangef cmd
;
653 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
654 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
657 TEST_P(GLES2DecoderTest1
, DetachShaderValidArgs
) {
658 EXPECT_CALL(*gl_
, DetachShader(kServiceProgramId
, kServiceShaderId
));
659 SpecializedSetup
<cmds::DetachShader
, 0>(true);
660 cmds::DetachShader cmd
;
661 cmd
.Init(client_program_id_
, client_shader_id_
);
662 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
663 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
666 TEST_P(GLES2DecoderTest1
, DisableValidArgs
) {
667 SetupExpectationsForEnableDisable(GL_BLEND
, false);
668 SpecializedSetup
<cmds::Disable
, 0>(true);
671 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
672 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
675 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_0
) {
676 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
677 SpecializedSetup
<cmds::Disable
, 0>(false);
679 cmd
.Init(GL_CLIP_PLANE0
);
680 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
681 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
684 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_1
) {
685 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
686 SpecializedSetup
<cmds::Disable
, 0>(false);
688 cmd
.Init(GL_POINT_SPRITE
);
689 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
690 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
693 TEST_P(GLES2DecoderTest1
, DisableVertexAttribArrayValidArgs
) {
694 EXPECT_CALL(*gl_
, DisableVertexAttribArray(1));
695 SpecializedSetup
<cmds::DisableVertexAttribArray
, 0>(true);
696 cmds::DisableVertexAttribArray cmd
;
698 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
699 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
701 // TODO(gman): DrawArrays
703 // TODO(gman): DrawElements
705 TEST_P(GLES2DecoderTest1
, EnableValidArgs
) {
706 SetupExpectationsForEnableDisable(GL_BLEND
, true);
707 SpecializedSetup
<cmds::Enable
, 0>(true);
710 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
711 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
714 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_0
) {
715 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
716 SpecializedSetup
<cmds::Enable
, 0>(false);
718 cmd
.Init(GL_CLIP_PLANE0
);
719 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
720 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
723 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_1
) {
724 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
725 SpecializedSetup
<cmds::Enable
, 0>(false);
727 cmd
.Init(GL_POINT_SPRITE
);
728 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
729 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
732 TEST_P(GLES2DecoderTest1
, EnableVertexAttribArrayValidArgs
) {
733 EXPECT_CALL(*gl_
, EnableVertexAttribArray(1));
734 SpecializedSetup
<cmds::EnableVertexAttribArray
, 0>(true);
735 cmds::EnableVertexAttribArray cmd
;
737 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
738 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
741 TEST_P(GLES2DecoderTest1
, FinishValidArgs
) {
742 EXPECT_CALL(*gl_
, Finish());
743 SpecializedSetup
<cmds::Finish
, 0>(true);
746 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
747 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
750 TEST_P(GLES2DecoderTest1
, FlushValidArgs
) {
751 EXPECT_CALL(*gl_
, Flush());
752 SpecializedSetup
<cmds::Flush
, 0>(true);
755 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
756 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
759 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferValidArgs
) {
760 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(
761 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
762 kServiceRenderbufferId
));
763 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(true);
764 cmds::FramebufferRenderbuffer cmd
;
765 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
766 client_renderbuffer_id_
);
767 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
768 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
771 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_0
) {
772 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
773 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
774 cmds::FramebufferRenderbuffer cmd
;
775 cmd
.Init(GL_DRAW_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
776 client_renderbuffer_id_
);
777 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
778 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
781 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_1
) {
782 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
783 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
784 cmds::FramebufferRenderbuffer cmd
;
785 cmd
.Init(GL_READ_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
786 client_renderbuffer_id_
);
787 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
788 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
791 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs2_0
) {
792 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
793 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
794 cmds::FramebufferRenderbuffer cmd
;
795 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_FRAMEBUFFER
,
796 client_renderbuffer_id_
);
797 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
798 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
801 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DValidArgs
) {
803 FramebufferTexture2DEXT(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
804 GL_TEXTURE_2D
, kServiceTextureId
, 0));
805 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(true);
806 cmds::FramebufferTexture2D cmd
;
807 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
809 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
810 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
813 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_0
) {
814 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
815 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
816 cmds::FramebufferTexture2D cmd
;
817 cmd
.Init(GL_DRAW_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
819 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
820 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
823 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_1
) {
824 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
825 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
826 cmds::FramebufferTexture2D cmd
;
827 cmd
.Init(GL_READ_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
829 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
830 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
833 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs2_0
) {
834 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
835 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
836 cmds::FramebufferTexture2D cmd
;
837 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_PROXY_TEXTURE_CUBE_MAP
,
839 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
840 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
843 TEST_P(GLES2DecoderTest1
, FramebufferTextureLayerValidArgs
) {
845 FramebufferTextureLayer(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
846 kServiceTextureId
, 4, 5));
847 SpecializedSetup
<cmds::FramebufferTextureLayer
, 0>(true);
848 cmds::FramebufferTextureLayer cmd
;
849 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, client_texture_id_
, 4, 5);
850 decoder_
->set_unsafe_es3_apis_enabled(true);
851 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
852 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
853 decoder_
->set_unsafe_es3_apis_enabled(false);
854 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
857 TEST_P(GLES2DecoderTest1
, FrontFaceValidArgs
) {
858 EXPECT_CALL(*gl_
, FrontFace(GL_CW
));
859 SpecializedSetup
<cmds::FrontFace
, 0>(true);
862 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
863 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
866 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateValidArgs
) {
867 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
868 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
869 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
870 GLuint temp
= kNewClientId
;
871 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(true);
873 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
874 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
875 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
878 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateInvalidArgs
) {
879 EXPECT_CALL(*gl_
, GenBuffersARB(_
, _
)).Times(0);
880 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
881 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(false);
882 cmd
->Init(1, &client_buffer_id_
);
883 EXPECT_EQ(error::kInvalidArguments
,
884 ExecuteImmediateCmd(*cmd
, sizeof(&client_buffer_id_
)));
887 TEST_P(GLES2DecoderTest1
, GenerateMipmapValidArgs
) {
888 EXPECT_CALL(*gl_
, GenerateMipmapEXT(GL_TEXTURE_2D
));
889 SpecializedSetup
<cmds::GenerateMipmap
, 0>(true);
890 cmds::GenerateMipmap cmd
;
891 cmd
.Init(GL_TEXTURE_2D
);
892 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
893 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
896 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_0
) {
897 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
898 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
899 cmds::GenerateMipmap cmd
;
900 cmd
.Init(GL_TEXTURE_1D
);
901 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
902 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
905 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_1
) {
906 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
907 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
908 cmds::GenerateMipmap cmd
;
909 cmd
.Init(GL_TEXTURE_3D
);
910 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
911 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
914 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateValidArgs
) {
915 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
916 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
917 cmds::GenFramebuffersImmediate
* cmd
=
918 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
919 GLuint temp
= kNewClientId
;
920 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(true);
922 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
923 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
924 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
927 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateInvalidArgs
) {
928 EXPECT_CALL(*gl_
, GenFramebuffersEXT(_
, _
)).Times(0);
929 cmds::GenFramebuffersImmediate
* cmd
=
930 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
931 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(false);
932 cmd
->Init(1, &client_framebuffer_id_
);
933 EXPECT_EQ(error::kInvalidArguments
,
934 ExecuteImmediateCmd(*cmd
, sizeof(&client_framebuffer_id_
)));
937 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateValidArgs
) {
938 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
939 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
940 cmds::GenRenderbuffersImmediate
* cmd
=
941 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
942 GLuint temp
= kNewClientId
;
943 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(true);
945 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
946 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
947 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
950 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateInvalidArgs
) {
951 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(_
, _
)).Times(0);
952 cmds::GenRenderbuffersImmediate
* cmd
=
953 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
954 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(false);
955 cmd
->Init(1, &client_renderbuffer_id_
);
956 EXPECT_EQ(error::kInvalidArguments
,
957 ExecuteImmediateCmd(*cmd
, sizeof(&client_renderbuffer_id_
)));
960 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateValidArgs
) {
961 EXPECT_CALL(*gl_
, GenSamplers(1, _
))
962 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
963 cmds::GenSamplersImmediate
* cmd
=
964 GetImmediateAs
<cmds::GenSamplersImmediate
>();
965 GLuint temp
= kNewClientId
;
966 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(true);
967 decoder_
->set_unsafe_es3_apis_enabled(true);
969 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
970 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
972 EXPECT_TRUE(GetSamplerServiceId(kNewClientId
, &service_id
));
973 EXPECT_EQ(kNewServiceId
, service_id
);
974 decoder_
->set_unsafe_es3_apis_enabled(false);
975 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
978 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateInvalidArgs
) {
979 EXPECT_CALL(*gl_
, GenSamplers(_
, _
)).Times(0);
980 cmds::GenSamplersImmediate
* cmd
=
981 GetImmediateAs
<cmds::GenSamplersImmediate
>();
982 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(false);
983 cmd
->Init(1, &client_sampler_id_
);
984 decoder_
->set_unsafe_es3_apis_enabled(true);
985 EXPECT_EQ(error::kInvalidArguments
,
986 ExecuteImmediateCmd(*cmd
, sizeof(&client_sampler_id_
)));
987 decoder_
->set_unsafe_es3_apis_enabled(false);
990 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateValidArgs
) {
991 EXPECT_CALL(*gl_
, GenTextures(1, _
))
992 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
993 cmds::GenTexturesImmediate
* cmd
=
994 GetImmediateAs
<cmds::GenTexturesImmediate
>();
995 GLuint temp
= kNewClientId
;
996 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(true);
998 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
999 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1000 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
1003 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateInvalidArgs
) {
1004 EXPECT_CALL(*gl_
, GenTextures(_
, _
)).Times(0);
1005 cmds::GenTexturesImmediate
* cmd
=
1006 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1007 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(false);
1008 cmd
->Init(1, &client_texture_id_
);
1009 EXPECT_EQ(error::kInvalidArguments
,
1010 ExecuteImmediateCmd(*cmd
, sizeof(&client_texture_id_
)));
1013 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateValidArgs
) {
1014 EXPECT_CALL(*gl_
, GenTransformFeedbacks(1, _
))
1015 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1016 cmds::GenTransformFeedbacksImmediate
* cmd
=
1017 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1018 GLuint temp
= kNewClientId
;
1019 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(true);
1020 decoder_
->set_unsafe_es3_apis_enabled(true);
1021 cmd
->Init(1, &temp
);
1022 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1023 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1025 EXPECT_TRUE(GetTransformFeedbackServiceId(kNewClientId
, &service_id
));
1026 EXPECT_EQ(kNewServiceId
, service_id
);
1027 decoder_
->set_unsafe_es3_apis_enabled(false);
1028 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1031 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateInvalidArgs
) {
1032 EXPECT_CALL(*gl_
, GenTransformFeedbacks(_
, _
)).Times(0);
1033 cmds::GenTransformFeedbacksImmediate
* cmd
=
1034 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1035 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(false);
1036 cmd
->Init(1, &client_transformfeedback_id_
);
1037 decoder_
->set_unsafe_es3_apis_enabled(true);
1038 EXPECT_EQ(error::kInvalidArguments
,
1039 ExecuteImmediateCmd(*cmd
, sizeof(&client_transformfeedback_id_
)));
1040 decoder_
->set_unsafe_es3_apis_enabled(false);
1042 // TODO(gman): GetActiveAttrib
1044 // TODO(gman): GetActiveUniform
1046 // TODO(gman): GetAttachedShaders
1048 // TODO(gman): GetAttribLocation
1050 TEST_P(GLES2DecoderTest1
, GetBooleanvValidArgs
) {
1051 EXPECT_CALL(*gl_
, GetError())
1052 .WillOnce(Return(GL_NO_ERROR
))
1053 .WillOnce(Return(GL_NO_ERROR
))
1054 .RetiresOnSaturation();
1055 SpecializedSetup
<cmds::GetBooleanv
, 0>(true);
1056 typedef cmds::GetBooleanv::Result Result
;
1057 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1058 EXPECT_CALL(*gl_
, GetBooleanv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1060 cmds::GetBooleanv cmd
;
1061 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1062 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1063 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1064 result
->GetNumResults());
1065 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1068 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs0_0
) {
1069 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1070 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1071 cmds::GetBooleanv::Result
* result
=
1072 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1074 cmds::GetBooleanv cmd
;
1075 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1076 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1077 EXPECT_EQ(0u, result
->size
);
1078 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1081 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_0
) {
1082 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1083 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1084 cmds::GetBooleanv::Result
* result
=
1085 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1087 cmds::GetBooleanv cmd
;
1088 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1089 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1090 EXPECT_EQ(0u, result
->size
);
1093 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_1
) {
1094 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1095 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1096 cmds::GetBooleanv::Result
* result
=
1097 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1099 cmds::GetBooleanv cmd
;
1100 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1101 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1102 EXPECT_EQ(0u, result
->size
);
1105 TEST_P(GLES2DecoderTest1
, GetBufferParameterivValidArgs
) {
1106 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(true);
1107 typedef cmds::GetBufferParameteriv::Result Result
;
1108 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1110 cmds::GetBufferParameteriv cmd
;
1111 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1112 shared_memory_offset_
);
1113 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1114 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1115 result
->GetNumResults());
1116 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1119 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs0_0
) {
1120 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1121 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1122 cmds::GetBufferParameteriv::Result
* result
=
1123 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1125 cmds::GetBufferParameteriv cmd
;
1126 cmd
.Init(GL_RENDERBUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1127 shared_memory_offset_
);
1128 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1129 EXPECT_EQ(0u, result
->size
);
1130 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1133 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs1_0
) {
1134 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1135 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1136 cmds::GetBufferParameteriv::Result
* result
=
1137 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1139 cmds::GetBufferParameteriv cmd
;
1140 cmd
.Init(GL_ARRAY_BUFFER
, GL_PIXEL_PACK_BUFFER
, shared_memory_id_
,
1141 shared_memory_offset_
);
1142 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1143 EXPECT_EQ(0u, result
->size
);
1144 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1147 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_0
) {
1148 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1149 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1150 cmds::GetBufferParameteriv::Result
* result
=
1151 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1153 cmds::GetBufferParameteriv cmd
;
1154 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, kInvalidSharedMemoryId
, 0);
1155 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1156 EXPECT_EQ(0u, result
->size
);
1159 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_1
) {
1160 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1161 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1162 cmds::GetBufferParameteriv::Result
* result
=
1163 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1165 cmds::GetBufferParameteriv cmd
;
1166 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1167 kInvalidSharedMemoryOffset
);
1168 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1169 EXPECT_EQ(0u, result
->size
);
1172 TEST_P(GLES2DecoderTest1
, GetErrorValidArgs
) {
1173 EXPECT_CALL(*gl_
, GetError());
1174 SpecializedSetup
<cmds::GetError
, 0>(true);
1176 cmd
.Init(shared_memory_id_
, shared_memory_offset_
);
1177 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1178 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1181 TEST_P(GLES2DecoderTest1
, GetErrorInvalidArgsBadSharedMemoryId
) {
1182 EXPECT_CALL(*gl_
, GetError()).Times(0);
1183 SpecializedSetup
<cmds::GetError
, 0>(false);
1185 cmd
.Init(kInvalidSharedMemoryId
, shared_memory_offset_
);
1186 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1187 cmd
.Init(shared_memory_id_
, kInvalidSharedMemoryOffset
);
1188 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1191 TEST_P(GLES2DecoderTest1
, GetFloatvValidArgs
) {
1192 EXPECT_CALL(*gl_
, GetError())
1193 .WillOnce(Return(GL_NO_ERROR
))
1194 .WillOnce(Return(GL_NO_ERROR
))
1195 .RetiresOnSaturation();
1196 SpecializedSetup
<cmds::GetFloatv
, 0>(true);
1197 typedef cmds::GetFloatv::Result Result
;
1198 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1199 EXPECT_CALL(*gl_
, GetFloatv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1201 cmds::GetFloatv cmd
;
1202 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1203 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1204 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1205 result
->GetNumResults());
1206 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1209 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs0_0
) {
1210 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1211 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1212 cmds::GetFloatv::Result
* result
=
1213 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1215 cmds::GetFloatv cmd
;
1216 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1217 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1218 EXPECT_EQ(0u, result
->size
);
1219 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1222 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_0
) {
1223 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1224 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1225 cmds::GetFloatv::Result
* result
=
1226 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1228 cmds::GetFloatv cmd
;
1229 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1230 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1231 EXPECT_EQ(0u, result
->size
);
1234 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_1
) {
1235 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1236 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1237 cmds::GetFloatv::Result
* result
=
1238 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1240 cmds::GetFloatv cmd
;
1241 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1242 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1243 EXPECT_EQ(0u, result
->size
);
1246 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivValidArgs
) {
1247 EXPECT_CALL(*gl_
, GetError())
1248 .WillOnce(Return(GL_NO_ERROR
))
1249 .WillOnce(Return(GL_NO_ERROR
))
1250 .RetiresOnSaturation();
1251 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(true);
1252 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
1253 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1255 GetFramebufferAttachmentParameterivEXT(
1256 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1257 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, result
->GetData()));
1259 cmds::GetFramebufferAttachmentParameteriv cmd
;
1260 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1261 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1262 shared_memory_offset_
);
1263 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1264 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1265 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
),
1266 result
->GetNumResults());
1267 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1270 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_0
) {
1271 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1273 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1274 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1275 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1276 shared_memory_address_
);
1278 cmds::GetFramebufferAttachmentParameteriv cmd
;
1279 cmd
.Init(GL_DRAW_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1280 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1281 shared_memory_offset_
);
1282 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1283 EXPECT_EQ(0u, result
->size
);
1284 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1287 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_1
) {
1288 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1290 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1291 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1292 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1293 shared_memory_address_
);
1295 cmds::GetFramebufferAttachmentParameteriv cmd
;
1296 cmd
.Init(GL_READ_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1297 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1298 shared_memory_offset_
);
1299 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1300 EXPECT_EQ(0u, result
->size
);
1301 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1304 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_0
) {
1305 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1307 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1308 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1309 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1310 shared_memory_address_
);
1312 cmds::GetFramebufferAttachmentParameteriv cmd
;
1313 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1314 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, kInvalidSharedMemoryId
, 0);
1315 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1316 EXPECT_EQ(0u, result
->size
);
1319 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_1
) {
1320 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1322 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1323 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1324 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1325 shared_memory_address_
);
1327 cmds::GetFramebufferAttachmentParameteriv cmd
;
1328 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1329 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1330 kInvalidSharedMemoryOffset
);
1331 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1332 EXPECT_EQ(0u, result
->size
);
1335 TEST_P(GLES2DecoderTest1
, GetIntegervValidArgs
) {
1336 EXPECT_CALL(*gl_
, GetError())
1337 .WillOnce(Return(GL_NO_ERROR
))
1338 .WillOnce(Return(GL_NO_ERROR
))
1339 .RetiresOnSaturation();
1340 SpecializedSetup
<cmds::GetIntegerv
, 0>(true);
1341 typedef cmds::GetIntegerv::Result Result
;
1342 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1343 EXPECT_CALL(*gl_
, GetIntegerv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1345 cmds::GetIntegerv cmd
;
1346 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1347 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1348 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1349 result
->GetNumResults());
1350 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1353 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs0_0
) {
1354 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1355 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1356 cmds::GetIntegerv::Result
* result
=
1357 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1359 cmds::GetIntegerv cmd
;
1360 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1361 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1362 EXPECT_EQ(0u, result
->size
);
1363 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1366 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_0
) {
1367 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1368 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1369 cmds::GetIntegerv::Result
* result
=
1370 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1372 cmds::GetIntegerv cmd
;
1373 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1374 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1375 EXPECT_EQ(0u, result
->size
);
1378 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_1
) {
1379 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1380 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1381 cmds::GetIntegerv::Result
* result
=
1382 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1384 cmds::GetIntegerv cmd
;
1385 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1386 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1387 EXPECT_EQ(0u, result
->size
);
1390 TEST_P(GLES2DecoderTest1
, GetInternalformativValidArgs
) {
1391 EXPECT_CALL(*gl_
, GetError())
1392 .WillOnce(Return(GL_NO_ERROR
))
1393 .WillOnce(Return(GL_NO_ERROR
))
1394 .RetiresOnSaturation();
1395 SpecializedSetup
<cmds::GetInternalformativ
, 0>(true);
1396 typedef cmds::GetInternalformativ::Result Result
;
1397 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1398 EXPECT_CALL(*gl_
, GetInternalformativ(GL_RENDERBUFFER
, GL_RGBA4
,
1399 GL_RENDERBUFFER_RED_SIZE
, 4,
1400 result
->GetData()));
1402 cmds::GetInternalformativ cmd
;
1403 cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, GL_RENDERBUFFER_RED_SIZE
, 4,
1404 shared_memory_id_
, shared_memory_offset_
);
1405 decoder_
->set_unsafe_es3_apis_enabled(true);
1406 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1407 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1408 GL_RENDERBUFFER_RED_SIZE
),
1409 result
->GetNumResults());
1410 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1411 decoder_
->set_unsafe_es3_apis_enabled(false);
1412 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1415 TEST_P(GLES2DecoderTest1
, GetProgramivValidArgs
) {
1416 SpecializedSetup
<cmds::GetProgramiv
, 0>(true);
1417 typedef cmds::GetProgramiv::Result Result
;
1418 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1420 cmds::GetProgramiv cmd
;
1421 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1422 shared_memory_offset_
);
1423 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1424 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_DELETE_STATUS
),
1425 result
->GetNumResults());
1426 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1429 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_0
) {
1430 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1431 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1432 cmds::GetProgramiv::Result
* result
=
1433 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1435 cmds::GetProgramiv cmd
;
1436 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, kInvalidSharedMemoryId
, 0);
1437 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1438 EXPECT_EQ(0u, result
->size
);
1441 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_1
) {
1442 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1443 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1444 cmds::GetProgramiv::Result
* result
=
1445 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1447 cmds::GetProgramiv cmd
;
1448 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1449 kInvalidSharedMemoryOffset
);
1450 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1451 EXPECT_EQ(0u, result
->size
);
1454 TEST_P(GLES2DecoderTest1
, GetProgramInfoLogValidArgs
) {
1455 const char* kInfo
= "hello";
1456 const uint32_t kBucketId
= 123;
1457 SpecializedSetup
<cmds::GetProgramInfoLog
, 0>(true);
1459 cmds::GetProgramInfoLog cmd
;
1460 cmd
.Init(client_program_id_
, kBucketId
);
1461 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1462 CommonDecoder::Bucket
* bucket
= decoder_
->GetBucket(kBucketId
);
1463 ASSERT_TRUE(bucket
!= NULL
);
1464 EXPECT_EQ(strlen(kInfo
) + 1, bucket
->size());
1466 memcmp(bucket
->GetData(0, bucket
->size()), kInfo
, bucket
->size()));
1467 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1470 TEST_P(GLES2DecoderTest1
, GetProgramInfoLogInvalidArgs
) {
1471 const uint32_t kBucketId
= 123;
1472 cmds::GetProgramInfoLog cmd
;
1473 cmd
.Init(kInvalidClientId
, kBucketId
);
1474 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1475 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1478 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivValidArgs
) {
1479 EXPECT_CALL(*gl_
, GetError())
1480 .WillOnce(Return(GL_NO_ERROR
))
1481 .WillOnce(Return(GL_NO_ERROR
))
1482 .RetiresOnSaturation();
1483 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(true);
1484 typedef cmds::GetRenderbufferParameteriv::Result Result
;
1485 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1487 *gl_
, GetRenderbufferParameterivEXT(
1488 GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, result
->GetData()));
1490 cmds::GetRenderbufferParameteriv cmd
;
1491 cmd
.Init(GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, shared_memory_id_
,
1492 shared_memory_offset_
);
1493 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1494 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1495 GL_RENDERBUFFER_RED_SIZE
),
1496 result
->GetNumResults());
1497 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1500 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs0_0
) {
1501 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1502 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1503 cmds::GetRenderbufferParameteriv::Result
* result
=
1504 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1505 shared_memory_address_
);
1507 cmds::GetRenderbufferParameteriv cmd
;
1508 cmd
.Init(GL_FRAMEBUFFER
, GL_RENDERBUFFER_RED_SIZE
, shared_memory_id_
,
1509 shared_memory_offset_
);
1510 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1511 EXPECT_EQ(0u, result
->size
);
1512 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1515 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs2_0
) {
1516 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1517 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1518 cmds::GetRenderbufferParameteriv::Result
* result
=
1519 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1520 shared_memory_address_
);
1522 cmds::GetRenderbufferParameteriv cmd
;
1523 cmd
.Init(GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, kInvalidSharedMemoryId
,
1525 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1526 EXPECT_EQ(0u, result
->size
);
1529 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs2_1
) {
1530 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1531 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1532 cmds::GetRenderbufferParameteriv::Result
* result
=
1533 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1534 shared_memory_address_
);
1536 cmds::GetRenderbufferParameteriv cmd
;
1537 cmd
.Init(GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, shared_memory_id_
,
1538 kInvalidSharedMemoryOffset
);
1539 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1540 EXPECT_EQ(0u, result
->size
);
1543 TEST_P(GLES2DecoderTest1
, GetSamplerParameterfvValidArgs
) {
1544 EXPECT_CALL(*gl_
, GetError())
1545 .WillOnce(Return(GL_NO_ERROR
))
1546 .WillOnce(Return(GL_NO_ERROR
))
1547 .RetiresOnSaturation();
1548 SpecializedSetup
<cmds::GetSamplerParameterfv
, 0>(true);
1549 typedef cmds::GetSamplerParameterfv::Result Result
;
1550 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1552 GetSamplerParameterfv(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
,
1553 result
->GetData()));
1555 cmds::GetSamplerParameterfv cmd
;
1556 cmd
.Init(client_sampler_id_
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1557 shared_memory_offset_
);
1558 decoder_
->set_unsafe_es3_apis_enabled(true);
1559 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1561 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1562 result
->GetNumResults());
1563 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1564 decoder_
->set_unsafe_es3_apis_enabled(false);
1565 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1568 TEST_P(GLES2DecoderTest1
, GetSamplerParameterivValidArgs
) {
1569 EXPECT_CALL(*gl_
, GetError())
1570 .WillOnce(Return(GL_NO_ERROR
))
1571 .WillOnce(Return(GL_NO_ERROR
))
1572 .RetiresOnSaturation();
1573 SpecializedSetup
<cmds::GetSamplerParameteriv
, 0>(true);
1574 typedef cmds::GetSamplerParameteriv::Result Result
;
1575 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1577 GetSamplerParameteriv(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
,
1578 result
->GetData()));
1580 cmds::GetSamplerParameteriv cmd
;
1581 cmd
.Init(client_sampler_id_
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1582 shared_memory_offset_
);
1583 decoder_
->set_unsafe_es3_apis_enabled(true);
1584 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1586 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1587 result
->GetNumResults());
1588 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1589 decoder_
->set_unsafe_es3_apis_enabled(false);
1590 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1593 TEST_P(GLES2DecoderTest1
, GetShaderivValidArgs
) {
1594 EXPECT_CALL(*gl_
, GetError())
1595 .WillOnce(Return(GL_NO_ERROR
))
1596 .WillOnce(Return(GL_NO_ERROR
))
1597 .RetiresOnSaturation();
1598 SpecializedSetup
<cmds::GetShaderiv
, 0>(true);
1599 typedef cmds::GetShaderiv::Result Result
;
1600 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1602 GetShaderiv(kServiceShaderId
, GL_SHADER_TYPE
, result
->GetData()));
1604 cmds::GetShaderiv cmd
;
1605 cmd
.Init(client_shader_id_
, GL_SHADER_TYPE
, shared_memory_id_
,
1606 shared_memory_offset_
);
1607 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1608 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_SHADER_TYPE
),
1609 result
->GetNumResults());
1610 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1613 TEST_P(GLES2DecoderTest1
, GetShaderivInvalidArgs2_0
) {
1614 EXPECT_CALL(*gl_
, GetShaderiv(_
, _
, _
)).Times(0);
1615 SpecializedSetup
<cmds::GetShaderiv
, 0>(false);
1616 cmds::GetShaderiv::Result
* result
=
1617 static_cast<cmds::GetShaderiv::Result
*>(shared_memory_address_
);
1619 cmds::GetShaderiv cmd
;
1620 cmd
.Init(client_shader_id_
, GL_SHADER_TYPE
, kInvalidSharedMemoryId
, 0);
1621 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1622 EXPECT_EQ(0u, result
->size
);
1625 TEST_P(GLES2DecoderTest1
, GetShaderivInvalidArgs2_1
) {
1626 EXPECT_CALL(*gl_
, GetShaderiv(_
, _
, _
)).Times(0);
1627 SpecializedSetup
<cmds::GetShaderiv
, 0>(false);
1628 cmds::GetShaderiv::Result
* result
=
1629 static_cast<cmds::GetShaderiv::Result
*>(shared_memory_address_
);
1631 cmds::GetShaderiv cmd
;
1632 cmd
.Init(client_shader_id_
, GL_SHADER_TYPE
, shared_memory_id_
,
1633 kInvalidSharedMemoryOffset
);
1634 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1635 EXPECT_EQ(0u, result
->size
);
1637 // TODO(gman): GetShaderInfoLog
1638 // TODO(gman): GetShaderPrecisionFormat
1640 // TODO(gman): GetShaderSource
1641 // TODO(gman): GetString
1643 TEST_P(GLES2DecoderTest1
, GetTexParameterfvValidArgs
) {
1644 EXPECT_CALL(*gl_
, GetError())
1645 .WillOnce(Return(GL_NO_ERROR
))
1646 .WillOnce(Return(GL_NO_ERROR
))
1647 .RetiresOnSaturation();
1648 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(true);
1649 typedef cmds::GetTexParameterfv::Result Result
;
1650 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1651 EXPECT_CALL(*gl_
, GetTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
,
1652 result
->GetData()));
1654 cmds::GetTexParameterfv cmd
;
1655 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1656 shared_memory_offset_
);
1657 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1659 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1660 result
->GetNumResults());
1661 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1664 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs0_0
) {
1665 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1666 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1667 cmds::GetTexParameterfv::Result
* result
=
1668 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1670 cmds::GetTexParameterfv cmd
;
1671 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1672 shared_memory_offset_
);
1673 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1674 EXPECT_EQ(0u, result
->size
);
1675 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1678 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs1_0
) {
1679 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1680 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1681 cmds::GetTexParameterfv::Result
* result
=
1682 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1684 cmds::GetTexParameterfv cmd
;
1685 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, shared_memory_id_
,
1686 shared_memory_offset_
);
1687 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1688 EXPECT_EQ(0u, result
->size
);
1689 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1692 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs2_0
) {
1693 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1694 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1695 cmds::GetTexParameterfv::Result
* result
=
1696 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1698 cmds::GetTexParameterfv cmd
;
1699 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, kInvalidSharedMemoryId
, 0);
1700 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1701 EXPECT_EQ(0u, result
->size
);
1704 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs2_1
) {
1705 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1706 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1707 cmds::GetTexParameterfv::Result
* result
=
1708 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1710 cmds::GetTexParameterfv cmd
;
1711 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1712 kInvalidSharedMemoryOffset
);
1713 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1714 EXPECT_EQ(0u, result
->size
);
1717 TEST_P(GLES2DecoderTest1
, GetTexParameterivValidArgs
) {
1718 EXPECT_CALL(*gl_
, GetError())
1719 .WillOnce(Return(GL_NO_ERROR
))
1720 .WillOnce(Return(GL_NO_ERROR
))
1721 .RetiresOnSaturation();
1722 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(true);
1723 typedef cmds::GetTexParameteriv::Result Result
;
1724 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1725 EXPECT_CALL(*gl_
, GetTexParameteriv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
,
1726 result
->GetData()));
1728 cmds::GetTexParameteriv cmd
;
1729 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1730 shared_memory_offset_
);
1731 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1733 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1734 result
->GetNumResults());
1735 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1738 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs0_0
) {
1739 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1740 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1741 cmds::GetTexParameteriv::Result
* result
=
1742 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1744 cmds::GetTexParameteriv cmd
;
1745 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1746 shared_memory_offset_
);
1747 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1748 EXPECT_EQ(0u, result
->size
);
1749 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1752 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs1_0
) {
1753 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1754 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1755 cmds::GetTexParameteriv::Result
* result
=
1756 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1758 cmds::GetTexParameteriv cmd
;
1759 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, shared_memory_id_
,
1760 shared_memory_offset_
);
1761 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1762 EXPECT_EQ(0u, result
->size
);
1763 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1766 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs2_0
) {
1767 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1768 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1769 cmds::GetTexParameteriv::Result
* result
=
1770 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1772 cmds::GetTexParameteriv cmd
;
1773 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, kInvalidSharedMemoryId
, 0);
1774 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1775 EXPECT_EQ(0u, result
->size
);
1778 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs2_1
) {
1779 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1780 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1781 cmds::GetTexParameteriv::Result
* result
=
1782 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1784 cmds::GetTexParameteriv cmd
;
1785 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1786 kInvalidSharedMemoryOffset
);
1787 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1788 EXPECT_EQ(0u, result
->size
);
1790 // TODO(gman): GetUniformfv
1792 // TODO(gman): GetUniformiv
1794 // TODO(gman): GetUniformLocation
1796 TEST_P(GLES2DecoderTest1
, GetVertexAttribfvValidArgs
) {
1797 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(true);
1798 typedef cmds::GetVertexAttribfv::Result Result
;
1799 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1801 cmds::GetVertexAttribfv cmd
;
1802 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, shared_memory_id_
,
1803 shared_memory_offset_
);
1804 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1805 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1806 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
),
1807 result
->GetNumResults());
1808 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1811 TEST_P(GLES2DecoderTest1
, GetVertexAttribfvInvalidArgs2_0
) {
1812 EXPECT_CALL(*gl_
, GetVertexAttribfv(_
, _
, _
)).Times(0);
1813 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(false);
1814 cmds::GetVertexAttribfv::Result
* result
=
1815 static_cast<cmds::GetVertexAttribfv::Result
*>(shared_memory_address_
);
1817 cmds::GetVertexAttribfv cmd
;
1818 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, kInvalidSharedMemoryId
, 0);
1819 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1820 EXPECT_EQ(0u, result
->size
);
1823 TEST_P(GLES2DecoderTest1
, GetVertexAttribfvInvalidArgs2_1
) {
1824 EXPECT_CALL(*gl_
, GetVertexAttribfv(_
, _
, _
)).Times(0);
1825 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(false);
1826 cmds::GetVertexAttribfv::Result
* result
=
1827 static_cast<cmds::GetVertexAttribfv::Result
*>(shared_memory_address_
);
1829 cmds::GetVertexAttribfv cmd
;
1830 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, shared_memory_id_
,
1831 kInvalidSharedMemoryOffset
);
1832 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1833 EXPECT_EQ(0u, result
->size
);
1836 TEST_P(GLES2DecoderTest1
, GetVertexAttribivValidArgs
) {
1837 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(true);
1838 typedef cmds::GetVertexAttribiv::Result Result
;
1839 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1841 cmds::GetVertexAttribiv cmd
;
1842 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, shared_memory_id_
,
1843 shared_memory_offset_
);
1844 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1845 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1846 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
),
1847 result
->GetNumResults());
1848 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1851 TEST_P(GLES2DecoderTest1
, GetVertexAttribivInvalidArgs2_0
) {
1852 EXPECT_CALL(*gl_
, GetVertexAttribiv(_
, _
, _
)).Times(0);
1853 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(false);
1854 cmds::GetVertexAttribiv::Result
* result
=
1855 static_cast<cmds::GetVertexAttribiv::Result
*>(shared_memory_address_
);
1857 cmds::GetVertexAttribiv cmd
;
1858 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, kInvalidSharedMemoryId
, 0);
1859 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1860 EXPECT_EQ(0u, result
->size
);
1863 TEST_P(GLES2DecoderTest1
, GetVertexAttribivInvalidArgs2_1
) {
1864 EXPECT_CALL(*gl_
, GetVertexAttribiv(_
, _
, _
)).Times(0);
1865 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(false);
1866 cmds::GetVertexAttribiv::Result
* result
=
1867 static_cast<cmds::GetVertexAttribiv::Result
*>(shared_memory_address_
);
1869 cmds::GetVertexAttribiv cmd
;
1870 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, shared_memory_id_
,
1871 kInvalidSharedMemoryOffset
);
1872 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1873 EXPECT_EQ(0u, result
->size
);
1875 // TODO(gman): GetVertexAttribPointerv
1877 TEST_P(GLES2DecoderTest1
, HintValidArgs
) {
1878 EXPECT_CALL(*gl_
, Hint(GL_GENERATE_MIPMAP_HINT
, GL_FASTEST
));
1879 SpecializedSetup
<cmds::Hint
, 0>(true);
1881 cmd
.Init(GL_GENERATE_MIPMAP_HINT
, GL_FASTEST
);
1882 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1883 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1886 TEST_P(GLES2DecoderTest1
, HintInvalidArgs0_0
) {
1887 EXPECT_CALL(*gl_
, Hint(_
, _
)).Times(0);
1888 SpecializedSetup
<cmds::Hint
, 0>(false);
1890 cmd
.Init(GL_PERSPECTIVE_CORRECTION_HINT
, GL_FASTEST
);
1891 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1892 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1894 // TODO(gman): InvalidateFramebufferImmediate
1895 // TODO(gman): InvalidateSubFramebufferImmediate
1897 TEST_P(GLES2DecoderTest1
, IsBufferValidArgs
) {
1898 SpecializedSetup
<cmds::IsBuffer
, 0>(true);
1900 cmd
.Init(client_buffer_id_
, shared_memory_id_
, shared_memory_offset_
);
1901 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1902 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1905 TEST_P(GLES2DecoderTest1
, IsBufferInvalidArgsBadSharedMemoryId
) {
1906 SpecializedSetup
<cmds::IsBuffer
, 0>(false);
1908 cmd
.Init(client_buffer_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1909 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1910 cmd
.Init(client_buffer_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1911 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1914 TEST_P(GLES2DecoderTest1
, IsEnabledValidArgs
) {
1915 SpecializedSetup
<cmds::IsEnabled
, 0>(true);
1916 cmds::IsEnabled cmd
;
1917 cmd
.Init(GL_BLEND
, shared_memory_id_
, shared_memory_offset_
);
1918 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1919 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1922 TEST_P(GLES2DecoderTest1
, IsEnabledInvalidArgs0_0
) {
1923 EXPECT_CALL(*gl_
, IsEnabled(_
)).Times(0);
1924 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
1925 cmds::IsEnabled cmd
;
1926 cmd
.Init(GL_CLIP_PLANE0
, shared_memory_id_
, shared_memory_offset_
);
1927 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1928 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1931 TEST_P(GLES2DecoderTest1
, IsEnabledInvalidArgs0_1
) {
1932 EXPECT_CALL(*gl_
, IsEnabled(_
)).Times(0);
1933 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
1934 cmds::IsEnabled cmd
;
1935 cmd
.Init(GL_POINT_SPRITE
, shared_memory_id_
, shared_memory_offset_
);
1936 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1937 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1940 TEST_P(GLES2DecoderTest1
, IsEnabledInvalidArgsBadSharedMemoryId
) {
1941 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
1942 cmds::IsEnabled cmd
;
1943 cmd
.Init(GL_BLEND
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1944 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1945 cmd
.Init(GL_BLEND
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1946 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1948 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_