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
, BindBufferBaseValidArgs
) {
59 *gl_
, BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, kServiceBufferId
));
60 SpecializedSetup
<cmds::BindBufferBase
, 0>(true);
61 cmds::BindBufferBase cmd
;
62 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, client_buffer_id_
);
63 decoder_
->set_unsafe_es3_apis_enabled(true);
64 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
65 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
66 decoder_
->set_unsafe_es3_apis_enabled(false);
67 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
70 TEST_P(GLES2DecoderTest1
, BindBufferBaseValidArgsNewId
) {
72 BindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, kNewServiceId
));
73 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
74 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
75 SpecializedSetup
<cmds::BindBufferBase
, 0>(true);
76 cmds::BindBufferBase cmd
;
77 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, kNewClientId
);
78 decoder_
->set_unsafe_es3_apis_enabled(true);
79 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
80 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
81 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
82 decoder_
->set_unsafe_es3_apis_enabled(false);
83 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
86 TEST_P(GLES2DecoderTest1
, BindBufferRangeValidArgs
) {
87 EXPECT_CALL(*gl_
, BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER
, 2,
88 kServiceBufferId
, 4, 4));
89 SpecializedSetup
<cmds::BindBufferRange
, 0>(true);
90 cmds::BindBufferRange cmd
;
91 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, client_buffer_id_
, 4, 4);
92 decoder_
->set_unsafe_es3_apis_enabled(true);
93 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
94 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
95 decoder_
->set_unsafe_es3_apis_enabled(false);
96 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
99 TEST_P(GLES2DecoderTest1
, BindBufferRangeValidArgsNewId
) {
100 EXPECT_CALL(*gl_
, BindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER
, 2,
101 kNewServiceId
, 4, 4));
102 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
103 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
104 SpecializedSetup
<cmds::BindBufferRange
, 0>(true);
105 cmds::BindBufferRange cmd
;
106 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER
, 2, kNewClientId
, 4, 4);
107 decoder_
->set_unsafe_es3_apis_enabled(true);
108 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
109 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
110 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
111 decoder_
->set_unsafe_es3_apis_enabled(false);
112 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
115 TEST_P(GLES2DecoderTest1
, BindFramebufferValidArgs
) {
116 EXPECT_CALL(*gl_
, BindFramebufferEXT(GL_FRAMEBUFFER
, kServiceFramebufferId
));
117 SpecializedSetup
<cmds::BindFramebuffer
, 0>(true);
118 cmds::BindFramebuffer cmd
;
119 cmd
.Init(GL_FRAMEBUFFER
, client_framebuffer_id_
);
120 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
121 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
124 TEST_P(GLES2DecoderTest1
, BindFramebufferValidArgsNewId
) {
125 EXPECT_CALL(*gl_
, BindFramebufferEXT(GL_FRAMEBUFFER
, kNewServiceId
));
126 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
127 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
128 SpecializedSetup
<cmds::BindFramebuffer
, 0>(true);
129 cmds::BindFramebuffer cmd
;
130 cmd
.Init(GL_FRAMEBUFFER
, kNewClientId
);
131 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
132 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
133 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
136 TEST_P(GLES2DecoderTest1
, BindFramebufferInvalidArgs0_0
) {
137 EXPECT_CALL(*gl_
, BindFramebufferEXT(_
, _
)).Times(0);
138 SpecializedSetup
<cmds::BindFramebuffer
, 0>(false);
139 cmds::BindFramebuffer cmd
;
140 cmd
.Init(GL_RENDERBUFFER
, client_framebuffer_id_
);
141 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
142 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
145 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgs
) {
147 BindRenderbufferEXT(GL_RENDERBUFFER
, kServiceRenderbufferId
));
148 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
149 cmds::BindRenderbuffer cmd
;
150 cmd
.Init(GL_RENDERBUFFER
, client_renderbuffer_id_
);
151 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
152 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
155 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgsNewId
) {
156 EXPECT_CALL(*gl_
, BindRenderbufferEXT(GL_RENDERBUFFER
, kNewServiceId
));
157 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
158 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
159 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
160 cmds::BindRenderbuffer cmd
;
161 cmd
.Init(GL_RENDERBUFFER
, kNewClientId
);
162 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
163 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
164 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
167 TEST_P(GLES2DecoderTest1
, BindRenderbufferInvalidArgs0_0
) {
168 EXPECT_CALL(*gl_
, BindRenderbufferEXT(_
, _
)).Times(0);
169 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(false);
170 cmds::BindRenderbuffer cmd
;
171 cmd
.Init(GL_FRAMEBUFFER
, client_renderbuffer_id_
);
172 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
173 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
176 TEST_P(GLES2DecoderTest1
, BindSamplerValidArgs
) {
177 EXPECT_CALL(*gl_
, BindSampler(1, kServiceSamplerId
));
178 SpecializedSetup
<cmds::BindSampler
, 0>(true);
179 cmds::BindSampler cmd
;
180 cmd
.Init(1, client_sampler_id_
);
181 decoder_
->set_unsafe_es3_apis_enabled(true);
182 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
183 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
184 decoder_
->set_unsafe_es3_apis_enabled(false);
185 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
188 TEST_P(GLES2DecoderTest1
, BindTextureValidArgs
) {
189 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kServiceTextureId
));
190 SpecializedSetup
<cmds::BindTexture
, 0>(true);
191 cmds::BindTexture cmd
;
192 cmd
.Init(GL_TEXTURE_2D
, client_texture_id_
);
193 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
194 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
197 TEST_P(GLES2DecoderTest1
, BindTextureValidArgsNewId
) {
198 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kNewServiceId
));
199 EXPECT_CALL(*gl_
, GenTextures(1, _
))
200 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
201 SpecializedSetup
<cmds::BindTexture
, 0>(true);
202 cmds::BindTexture cmd
;
203 cmd
.Init(GL_TEXTURE_2D
, kNewClientId
);
204 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
205 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
206 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
209 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_0
) {
210 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
211 SpecializedSetup
<cmds::BindTexture
, 0>(false);
212 cmds::BindTexture cmd
;
213 cmd
.Init(GL_TEXTURE_1D
, client_texture_id_
);
214 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
215 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
218 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_1
) {
219 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
220 SpecializedSetup
<cmds::BindTexture
, 0>(false);
221 cmds::BindTexture cmd
;
222 cmd
.Init(GL_TEXTURE_3D
, client_texture_id_
);
223 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
224 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
227 TEST_P(GLES2DecoderTest1
, BindTransformFeedbackValidArgs
) {
228 EXPECT_CALL(*gl_
, BindTransformFeedback(GL_TRANSFORM_FEEDBACK
,
229 kServiceTransformFeedbackId
));
230 SpecializedSetup
<cmds::BindTransformFeedback
, 0>(true);
231 cmds::BindTransformFeedback cmd
;
232 cmd
.Init(GL_TRANSFORM_FEEDBACK
, client_transformfeedback_id_
);
233 decoder_
->set_unsafe_es3_apis_enabled(true);
234 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
235 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
236 decoder_
->set_unsafe_es3_apis_enabled(false);
237 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
240 TEST_P(GLES2DecoderTest1
, BlendColorValidArgs
) {
241 EXPECT_CALL(*gl_
, BlendColor(1, 2, 3, 4));
242 SpecializedSetup
<cmds::BlendColor
, 0>(true);
243 cmds::BlendColor cmd
;
244 cmd
.Init(1, 2, 3, 4);
245 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
246 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
249 TEST_P(GLES2DecoderTest1
, BlendEquationValidArgs
) {
250 EXPECT_CALL(*gl_
, BlendEquation(GL_FUNC_SUBTRACT
));
251 SpecializedSetup
<cmds::BlendEquation
, 0>(true);
252 cmds::BlendEquation cmd
;
253 cmd
.Init(GL_FUNC_SUBTRACT
);
254 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
255 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
258 TEST_P(GLES2DecoderTest1
, BlendEquationInvalidArgs0_0
) {
259 EXPECT_CALL(*gl_
, BlendEquation(_
)).Times(0);
260 SpecializedSetup
<cmds::BlendEquation
, 0>(false);
261 cmds::BlendEquation cmd
;
263 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
264 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
267 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateValidArgs
) {
268 EXPECT_CALL(*gl_
, BlendEquationSeparate(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
));
269 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(true);
270 cmds::BlendEquationSeparate cmd
;
271 cmd
.Init(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
);
272 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
273 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
276 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs0_0
) {
277 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
278 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
279 cmds::BlendEquationSeparate cmd
;
280 cmd
.Init(GL_NONE
, GL_FUNC_ADD
);
281 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
282 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
285 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs1_0
) {
286 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
287 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
288 cmds::BlendEquationSeparate cmd
;
289 cmd
.Init(GL_FUNC_SUBTRACT
, GL_NONE
);
290 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
291 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
294 TEST_P(GLES2DecoderTest1
, BlendFuncValidArgs
) {
295 EXPECT_CALL(*gl_
, BlendFunc(GL_ZERO
, GL_ZERO
));
296 SpecializedSetup
<cmds::BlendFunc
, 0>(true);
298 cmd
.Init(GL_ZERO
, GL_ZERO
);
299 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
300 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
303 TEST_P(GLES2DecoderTest1
, BlendFuncSeparateValidArgs
) {
304 EXPECT_CALL(*gl_
, BlendFuncSeparate(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
));
305 SpecializedSetup
<cmds::BlendFuncSeparate
, 0>(true);
306 cmds::BlendFuncSeparate cmd
;
307 cmd
.Init(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
);
308 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
309 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
311 // TODO(gman): BufferData
313 // TODO(gman): BufferSubData
315 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusValidArgs
) {
316 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
));
317 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(true);
318 cmds::CheckFramebufferStatus cmd
;
319 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
320 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
321 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
324 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgs0_0
) {
325 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(_
)).Times(0);
326 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
327 cmds::CheckFramebufferStatus cmd
;
328 cmd
.Init(GL_RENDERBUFFER
, shared_memory_id_
, shared_memory_offset_
);
329 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
330 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
333 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgsBadSharedMemoryId
) {
334 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
)).Times(0);
335 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
336 cmds::CheckFramebufferStatus cmd
;
337 cmd
.Init(GL_FRAMEBUFFER
, kInvalidSharedMemoryId
, shared_memory_offset_
);
338 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
339 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
340 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
343 TEST_P(GLES2DecoderTest1
, ClearValidArgs
) {
344 EXPECT_CALL(*gl_
, Clear(1));
345 SpecializedSetup
<cmds::Clear
, 0>(true);
348 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
349 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
352 TEST_P(GLES2DecoderTest1
, ClearBufferfiValidArgs
) {
353 EXPECT_CALL(*gl_
, ClearBufferfi(GL_COLOR
, 2, 3, 4));
354 SpecializedSetup
<cmds::ClearBufferfi
, 0>(true);
355 cmds::ClearBufferfi cmd
;
356 cmd
.Init(GL_COLOR
, 2, 3, 4);
357 decoder_
->set_unsafe_es3_apis_enabled(true);
358 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
359 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
360 decoder_
->set_unsafe_es3_apis_enabled(false);
361 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
364 TEST_P(GLES2DecoderTest1
, ClearBufferfvImmediateValidArgs
) {
365 cmds::ClearBufferfvImmediate
& cmd
=
366 *GetImmediateAs
<cmds::ClearBufferfvImmediate
>();
367 SpecializedSetup
<cmds::ClearBufferfvImmediate
, 0>(true);
371 cmd
.Init(GL_COLOR
, 2, &temp
[0]);
373 ClearBufferfv(GL_COLOR
, 2, reinterpret_cast<GLfloat
*>(
374 ImmediateDataAddress(&cmd
))));
375 decoder_
->set_unsafe_es3_apis_enabled(true);
376 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
377 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
378 decoder_
->set_unsafe_es3_apis_enabled(false);
379 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
382 TEST_P(GLES2DecoderTest1
, ClearBufferivImmediateValidArgs
) {
383 cmds::ClearBufferivImmediate
& cmd
=
384 *GetImmediateAs
<cmds::ClearBufferivImmediate
>();
385 SpecializedSetup
<cmds::ClearBufferivImmediate
, 0>(true);
389 cmd
.Init(GL_COLOR
, 2, &temp
[0]);
390 EXPECT_CALL(*gl_
, ClearBufferiv(
392 reinterpret_cast<GLint
*>(ImmediateDataAddress(&cmd
))));
393 decoder_
->set_unsafe_es3_apis_enabled(true);
394 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
395 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
396 decoder_
->set_unsafe_es3_apis_enabled(false);
397 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
400 TEST_P(GLES2DecoderTest1
, ClearBufferuivImmediateValidArgs
) {
401 cmds::ClearBufferuivImmediate
& cmd
=
402 *GetImmediateAs
<cmds::ClearBufferuivImmediate
>();
403 SpecializedSetup
<cmds::ClearBufferuivImmediate
, 0>(true);
407 cmd
.Init(GL_COLOR
, 2, &temp
[0]);
408 EXPECT_CALL(*gl_
, ClearBufferuiv(
410 reinterpret_cast<GLuint
*>(ImmediateDataAddress(&cmd
))));
411 decoder_
->set_unsafe_es3_apis_enabled(true);
412 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
413 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
414 decoder_
->set_unsafe_es3_apis_enabled(false);
415 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
418 TEST_P(GLES2DecoderTest1
, ClearColorValidArgs
) {
419 EXPECT_CALL(*gl_
, ClearColor(1, 2, 3, 4));
420 SpecializedSetup
<cmds::ClearColor
, 0>(true);
421 cmds::ClearColor cmd
;
422 cmd
.Init(1, 2, 3, 4);
423 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
424 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
427 TEST_P(GLES2DecoderTest1
, ClearDepthfValidArgs
) {
428 EXPECT_CALL(*gl_
, ClearDepth(0.5f
));
429 SpecializedSetup
<cmds::ClearDepthf
, 0>(true);
430 cmds::ClearDepthf cmd
;
432 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
433 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
436 TEST_P(GLES2DecoderTest1
, ClearStencilValidArgs
) {
437 EXPECT_CALL(*gl_
, ClearStencil(1));
438 SpecializedSetup
<cmds::ClearStencil
, 0>(true);
439 cmds::ClearStencil cmd
;
441 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
442 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
444 // TODO(gman): ClientWaitSync
446 TEST_P(GLES2DecoderTest1
, ColorMaskValidArgs
) {
447 SpecializedSetup
<cmds::ColorMask
, 0>(true);
449 cmd
.Init(true, true, true, true);
450 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
451 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
453 // TODO(gman): CompileShader
454 // TODO(gman): CompressedTexImage2DBucket
455 // TODO(gman): CompressedTexImage2D
457 // TODO(gman): CompressedTexSubImage2DBucket
458 // TODO(gman): CompressedTexSubImage2D
460 // TODO(gman): CompressedTexImage3DBucket
461 // TODO(gman): CompressedTexImage3D
463 // TODO(gman): CompressedTexSubImage3DBucket
464 // TODO(gman): CompressedTexSubImage3D
466 TEST_P(GLES2DecoderTest1
, CopyBufferSubDataValidArgs
) {
468 CopyBufferSubData(GL_ARRAY_BUFFER
, GL_ARRAY_BUFFER
, 3, 4, 5));
469 SpecializedSetup
<cmds::CopyBufferSubData
, 0>(true);
470 cmds::CopyBufferSubData cmd
;
471 cmd
.Init(GL_ARRAY_BUFFER
, GL_ARRAY_BUFFER
, 3, 4, 5);
472 decoder_
->set_unsafe_es3_apis_enabled(true);
473 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
474 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
475 decoder_
->set_unsafe_es3_apis_enabled(false);
476 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
478 // TODO(gman): CopyTexImage2D
480 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DValidArgs
) {
481 EXPECT_CALL(*gl_
, CopyTexSubImage2D(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8));
482 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(true);
483 cmds::CopyTexSubImage2D cmd
;
484 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8);
485 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
486 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
489 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs0_0
) {
490 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
491 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
492 cmds::CopyTexSubImage2D cmd
;
493 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, 2, 3, 4, 5, 6, 7, 8);
494 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
495 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
498 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs6_0
) {
499 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
500 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
501 cmds::CopyTexSubImage2D cmd
;
502 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, -1, 8);
503 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
504 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
507 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs7_0
) {
508 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
509 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
510 cmds::CopyTexSubImage2D cmd
;
511 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, -1);
512 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
513 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
516 TEST_P(GLES2DecoderTest1
, CopyTexSubImage3DValidArgs
) {
517 EXPECT_CALL(*gl_
, CopyTexSubImage3D(GL_TEXTURE_3D
, 2, 3, 4, 5, 6, 7, 8, 9));
518 SpecializedSetup
<cmds::CopyTexSubImage3D
, 0>(true);
519 cmds::CopyTexSubImage3D cmd
;
520 cmd
.Init(GL_TEXTURE_3D
, 2, 3, 4, 5, 6, 7, 8, 9);
521 decoder_
->set_unsafe_es3_apis_enabled(true);
522 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
523 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
524 decoder_
->set_unsafe_es3_apis_enabled(false);
525 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
528 TEST_P(GLES2DecoderTest1
, CreateProgramValidArgs
) {
529 EXPECT_CALL(*gl_
, CreateProgram()).WillOnce(Return(kNewServiceId
));
530 SpecializedSetup
<cmds::CreateProgram
, 0>(true);
531 cmds::CreateProgram cmd
;
532 cmd
.Init(kNewClientId
);
533 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
534 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
535 EXPECT_TRUE(GetProgram(kNewClientId
));
538 TEST_P(GLES2DecoderTest1
, CreateShaderValidArgs
) {
539 EXPECT_CALL(*gl_
, CreateShader(GL_VERTEX_SHADER
))
540 .WillOnce(Return(kNewServiceId
));
541 SpecializedSetup
<cmds::CreateShader
, 0>(true);
542 cmds::CreateShader cmd
;
543 cmd
.Init(GL_VERTEX_SHADER
, kNewClientId
);
544 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
545 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
546 EXPECT_TRUE(GetShader(kNewClientId
));
549 TEST_P(GLES2DecoderTest1
, CreateShaderInvalidArgs0_0
) {
550 EXPECT_CALL(*gl_
, CreateShader(_
)).Times(0);
551 SpecializedSetup
<cmds::CreateShader
, 0>(false);
552 cmds::CreateShader cmd
;
553 cmd
.Init(GL_GEOMETRY_SHADER
, kNewClientId
);
554 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
555 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
558 TEST_P(GLES2DecoderTest1
, CullFaceValidArgs
) {
559 EXPECT_CALL(*gl_
, CullFace(GL_FRONT
));
560 SpecializedSetup
<cmds::CullFace
, 0>(true);
563 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
564 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
567 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateValidArgs
) {
568 EXPECT_CALL(*gl_
, DeleteBuffersARB(1, Pointee(kServiceBufferId
))).Times(1);
569 cmds::DeleteBuffersImmediate
& cmd
=
570 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
571 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(true);
572 cmd
.Init(1, &client_buffer_id_
);
573 EXPECT_EQ(error::kNoError
,
574 ExecuteImmediateCmd(cmd
, sizeof(client_buffer_id_
)));
575 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
576 EXPECT_TRUE(GetBuffer(client_buffer_id_
) == NULL
);
579 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateInvalidArgs
) {
580 cmds::DeleteBuffersImmediate
& cmd
=
581 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
582 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(false);
583 GLuint temp
= kInvalidClientId
;
585 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
588 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateValidArgs
) {
589 EXPECT_CALL(*gl_
, DeleteFramebuffersEXT(1, Pointee(kServiceFramebufferId
)))
591 cmds::DeleteFramebuffersImmediate
& cmd
=
592 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
593 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(true);
594 cmd
.Init(1, &client_framebuffer_id_
);
595 EXPECT_EQ(error::kNoError
,
596 ExecuteImmediateCmd(cmd
, sizeof(client_framebuffer_id_
)));
597 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
598 EXPECT_TRUE(GetFramebuffer(client_framebuffer_id_
) == NULL
);
601 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateInvalidArgs
) {
602 cmds::DeleteFramebuffersImmediate
& cmd
=
603 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
604 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(false);
605 GLuint temp
= kInvalidClientId
;
607 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
610 TEST_P(GLES2DecoderTest1
, DeleteProgramValidArgs
) {
611 EXPECT_CALL(*gl_
, DeleteProgram(kServiceProgramId
));
612 SpecializedSetup
<cmds::DeleteProgram
, 0>(true);
613 cmds::DeleteProgram cmd
;
614 cmd
.Init(client_program_id_
);
615 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
616 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
619 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateValidArgs
) {
620 EXPECT_CALL(*gl_
, DeleteRenderbuffersEXT(1, Pointee(kServiceRenderbufferId
)))
622 cmds::DeleteRenderbuffersImmediate
& cmd
=
623 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
624 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(true);
625 cmd
.Init(1, &client_renderbuffer_id_
);
626 EXPECT_EQ(error::kNoError
,
627 ExecuteImmediateCmd(cmd
, sizeof(client_renderbuffer_id_
)));
628 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
629 EXPECT_TRUE(GetRenderbuffer(client_renderbuffer_id_
) == NULL
);
632 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateInvalidArgs
) {
633 cmds::DeleteRenderbuffersImmediate
& cmd
=
634 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
635 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(false);
636 GLuint temp
= kInvalidClientId
;
638 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
641 TEST_P(GLES2DecoderTest1
, DeleteSamplersImmediateValidArgs
) {
642 EXPECT_CALL(*gl_
, DeleteSamplers(1, Pointee(kServiceSamplerId
))).Times(1);
643 cmds::DeleteSamplersImmediate
& cmd
=
644 *GetImmediateAs
<cmds::DeleteSamplersImmediate
>();
645 SpecializedSetup
<cmds::DeleteSamplersImmediate
, 0>(true);
646 cmd
.Init(1, &client_sampler_id_
);
647 decoder_
->set_unsafe_es3_apis_enabled(true);
648 EXPECT_EQ(error::kNoError
,
649 ExecuteImmediateCmd(cmd
, sizeof(client_sampler_id_
)));
650 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
651 EXPECT_FALSE(GetSamplerServiceId(client_sampler_id_
, NULL
));
652 decoder_
->set_unsafe_es3_apis_enabled(false);
653 EXPECT_EQ(error::kUnknownCommand
,
654 ExecuteImmediateCmd(cmd
, sizeof(client_sampler_id_
)));
657 TEST_P(GLES2DecoderTest1
, DeleteSamplersImmediateInvalidArgs
) {
658 cmds::DeleteSamplersImmediate
& cmd
=
659 *GetImmediateAs
<cmds::DeleteSamplersImmediate
>();
660 SpecializedSetup
<cmds::DeleteSamplersImmediate
, 0>(false);
661 GLuint temp
= kInvalidClientId
;
663 decoder_
->set_unsafe_es3_apis_enabled(true);
664 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
665 decoder_
->set_unsafe_es3_apis_enabled(false);
666 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
669 TEST_P(GLES2DecoderTest1
, DeleteSyncValidArgs
) {
670 EXPECT_CALL(*gl_
, DeleteSync(reinterpret_cast<GLsync
>(kServiceSyncId
)));
671 SpecializedSetup
<cmds::DeleteSync
, 0>(true);
672 cmds::DeleteSync cmd
;
673 cmd
.Init(client_sync_id_
);
674 decoder_
->set_unsafe_es3_apis_enabled(true);
675 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
676 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
677 decoder_
->set_unsafe_es3_apis_enabled(false);
678 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
681 TEST_P(GLES2DecoderTest1
, DeleteShaderValidArgs
) {
682 EXPECT_CALL(*gl_
, DeleteShader(kServiceShaderId
));
683 SpecializedSetup
<cmds::DeleteShader
, 0>(true);
684 cmds::DeleteShader cmd
;
685 cmd
.Init(client_shader_id_
);
686 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
687 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
690 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateValidArgs
) {
691 EXPECT_CALL(*gl_
, DeleteTextures(1, Pointee(kServiceTextureId
))).Times(1);
692 cmds::DeleteTexturesImmediate
& cmd
=
693 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
694 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(true);
695 cmd
.Init(1, &client_texture_id_
);
696 EXPECT_EQ(error::kNoError
,
697 ExecuteImmediateCmd(cmd
, sizeof(client_texture_id_
)));
698 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
699 EXPECT_TRUE(GetTexture(client_texture_id_
) == NULL
);
702 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateInvalidArgs
) {
703 cmds::DeleteTexturesImmediate
& cmd
=
704 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
705 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(false);
706 GLuint temp
= kInvalidClientId
;
708 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
711 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateValidArgs
) {
713 DeleteTransformFeedbacks(1, Pointee(kServiceTransformFeedbackId
)))
715 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
716 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
717 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(true);
718 cmd
.Init(1, &client_transformfeedback_id_
);
719 decoder_
->set_unsafe_es3_apis_enabled(true);
720 EXPECT_EQ(error::kNoError
,
721 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
722 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
724 GetTransformFeedbackServiceId(client_transformfeedback_id_
, NULL
));
725 decoder_
->set_unsafe_es3_apis_enabled(false);
726 EXPECT_EQ(error::kUnknownCommand
,
727 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
730 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateInvalidArgs
) {
731 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
732 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
733 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(false);
734 GLuint temp
= kInvalidClientId
;
736 decoder_
->set_unsafe_es3_apis_enabled(true);
737 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
738 decoder_
->set_unsafe_es3_apis_enabled(false);
739 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
742 TEST_P(GLES2DecoderTest1
, DepthFuncValidArgs
) {
743 EXPECT_CALL(*gl_
, DepthFunc(GL_NEVER
));
744 SpecializedSetup
<cmds::DepthFunc
, 0>(true);
747 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
748 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
751 TEST_P(GLES2DecoderTest1
, DepthMaskValidArgs
) {
752 SpecializedSetup
<cmds::DepthMask
, 0>(true);
755 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
756 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
759 TEST_P(GLES2DecoderTest1
, DepthRangefValidArgs
) {
760 EXPECT_CALL(*gl_
, DepthRange(1, 2));
761 SpecializedSetup
<cmds::DepthRangef
, 0>(true);
762 cmds::DepthRangef cmd
;
764 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
765 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
768 TEST_P(GLES2DecoderTest1
, DetachShaderValidArgs
) {
769 EXPECT_CALL(*gl_
, DetachShader(kServiceProgramId
, kServiceShaderId
));
770 SpecializedSetup
<cmds::DetachShader
, 0>(true);
771 cmds::DetachShader cmd
;
772 cmd
.Init(client_program_id_
, client_shader_id_
);
773 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
774 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
777 TEST_P(GLES2DecoderTest1
, DisableValidArgs
) {
778 SetupExpectationsForEnableDisable(GL_BLEND
, false);
779 SpecializedSetup
<cmds::Disable
, 0>(true);
782 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
783 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
786 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_0
) {
787 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
788 SpecializedSetup
<cmds::Disable
, 0>(false);
790 cmd
.Init(GL_CLIP_PLANE0
);
791 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
792 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
795 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_1
) {
796 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
797 SpecializedSetup
<cmds::Disable
, 0>(false);
799 cmd
.Init(GL_POINT_SPRITE
);
800 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
801 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
804 TEST_P(GLES2DecoderTest1
, DisableVertexAttribArrayValidArgs
) {
805 EXPECT_CALL(*gl_
, DisableVertexAttribArray(1));
806 SpecializedSetup
<cmds::DisableVertexAttribArray
, 0>(true);
807 cmds::DisableVertexAttribArray cmd
;
809 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
810 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
812 // TODO(gman): DrawArrays
814 // TODO(gman): DrawElements
816 TEST_P(GLES2DecoderTest1
, EnableValidArgs
) {
817 SetupExpectationsForEnableDisable(GL_BLEND
, true);
818 SpecializedSetup
<cmds::Enable
, 0>(true);
821 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
822 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
825 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_0
) {
826 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
827 SpecializedSetup
<cmds::Enable
, 0>(false);
829 cmd
.Init(GL_CLIP_PLANE0
);
830 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
831 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
834 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_1
) {
835 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
836 SpecializedSetup
<cmds::Enable
, 0>(false);
838 cmd
.Init(GL_POINT_SPRITE
);
839 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
840 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
843 TEST_P(GLES2DecoderTest1
, EnableVertexAttribArrayValidArgs
) {
844 EXPECT_CALL(*gl_
, EnableVertexAttribArray(1));
845 SpecializedSetup
<cmds::EnableVertexAttribArray
, 0>(true);
846 cmds::EnableVertexAttribArray cmd
;
848 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
849 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
852 TEST_P(GLES2DecoderTest1
, FenceSyncValidArgs
) {
853 const GLsync kNewServiceIdGLuint
= reinterpret_cast<GLsync
>(kNewServiceId
);
854 EXPECT_CALL(*gl_
, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE
, 0))
855 .WillOnce(Return(kNewServiceIdGLuint
));
856 SpecializedSetup
<cmds::FenceSync
, 0>(true);
858 cmd
.Init(kNewClientId
);
859 decoder_
->set_unsafe_es3_apis_enabled(true);
860 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
861 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
862 GLsync service_id
= 0;
863 EXPECT_TRUE(GetSyncServiceId(kNewClientId
, &service_id
));
864 EXPECT_EQ(kNewServiceIdGLuint
, service_id
);
865 decoder_
->set_unsafe_es3_apis_enabled(false);
866 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
869 TEST_P(GLES2DecoderTest1
, FinishValidArgs
) {
870 EXPECT_CALL(*gl_
, Finish());
871 SpecializedSetup
<cmds::Finish
, 0>(true);
874 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
875 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
878 TEST_P(GLES2DecoderTest1
, FlushValidArgs
) {
879 EXPECT_CALL(*gl_
, Flush());
880 SpecializedSetup
<cmds::Flush
, 0>(true);
883 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
884 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
887 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferValidArgs
) {
888 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(
889 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
890 kServiceRenderbufferId
));
891 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(true);
892 cmds::FramebufferRenderbuffer cmd
;
893 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
894 client_renderbuffer_id_
);
895 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
896 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
899 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_0
) {
900 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
901 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
902 cmds::FramebufferRenderbuffer cmd
;
903 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
904 client_renderbuffer_id_
);
905 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
906 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
909 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs2_0
) {
910 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
911 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
912 cmds::FramebufferRenderbuffer cmd
;
913 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_FRAMEBUFFER
,
914 client_renderbuffer_id_
);
915 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
916 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
919 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DValidArgs
) {
921 FramebufferTexture2DEXT(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
922 GL_TEXTURE_2D
, kServiceTextureId
, 0));
923 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(true);
924 cmds::FramebufferTexture2D cmd
;
925 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
927 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
928 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
931 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_0
) {
932 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
933 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
934 cmds::FramebufferTexture2D cmd
;
935 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
937 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
938 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
941 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs2_0
) {
942 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
943 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
944 cmds::FramebufferTexture2D cmd
;
945 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_PROXY_TEXTURE_CUBE_MAP
,
947 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
948 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
951 TEST_P(GLES2DecoderTest1
, FramebufferTextureLayerValidArgs
) {
953 FramebufferTextureLayer(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
954 kServiceTextureId
, 4, 5));
955 SpecializedSetup
<cmds::FramebufferTextureLayer
, 0>(true);
956 cmds::FramebufferTextureLayer cmd
;
957 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, client_texture_id_
, 4, 5);
958 decoder_
->set_unsafe_es3_apis_enabled(true);
959 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
960 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
961 decoder_
->set_unsafe_es3_apis_enabled(false);
962 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
965 TEST_P(GLES2DecoderTest1
, FrontFaceValidArgs
) {
966 EXPECT_CALL(*gl_
, FrontFace(GL_CW
));
967 SpecializedSetup
<cmds::FrontFace
, 0>(true);
970 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
971 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
974 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateValidArgs
) {
975 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
976 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
977 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
978 GLuint temp
= kNewClientId
;
979 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(true);
981 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
982 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
983 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
986 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateInvalidArgs
) {
987 EXPECT_CALL(*gl_
, GenBuffersARB(_
, _
)).Times(0);
988 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
989 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(false);
990 cmd
->Init(1, &client_buffer_id_
);
991 EXPECT_EQ(error::kInvalidArguments
,
992 ExecuteImmediateCmd(*cmd
, sizeof(&client_buffer_id_
)));
995 TEST_P(GLES2DecoderTest1
, GenerateMipmapValidArgs
) {
996 EXPECT_CALL(*gl_
, GenerateMipmapEXT(GL_TEXTURE_2D
));
997 SpecializedSetup
<cmds::GenerateMipmap
, 0>(true);
998 cmds::GenerateMipmap cmd
;
999 cmd
.Init(GL_TEXTURE_2D
);
1000 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1001 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1004 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_0
) {
1005 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
1006 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
1007 cmds::GenerateMipmap cmd
;
1008 cmd
.Init(GL_TEXTURE_1D
);
1009 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1010 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1013 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_1
) {
1014 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
1015 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
1016 cmds::GenerateMipmap cmd
;
1017 cmd
.Init(GL_TEXTURE_3D
);
1018 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1019 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1022 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateValidArgs
) {
1023 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
1024 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1025 cmds::GenFramebuffersImmediate
* cmd
=
1026 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
1027 GLuint temp
= kNewClientId
;
1028 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(true);
1029 cmd
->Init(1, &temp
);
1030 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1031 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1032 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
1035 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateInvalidArgs
) {
1036 EXPECT_CALL(*gl_
, GenFramebuffersEXT(_
, _
)).Times(0);
1037 cmds::GenFramebuffersImmediate
* cmd
=
1038 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
1039 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(false);
1040 cmd
->Init(1, &client_framebuffer_id_
);
1041 EXPECT_EQ(error::kInvalidArguments
,
1042 ExecuteImmediateCmd(*cmd
, sizeof(&client_framebuffer_id_
)));
1045 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateValidArgs
) {
1046 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
1047 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1048 cmds::GenRenderbuffersImmediate
* cmd
=
1049 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
1050 GLuint temp
= kNewClientId
;
1051 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(true);
1052 cmd
->Init(1, &temp
);
1053 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1054 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1055 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
1058 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateInvalidArgs
) {
1059 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(_
, _
)).Times(0);
1060 cmds::GenRenderbuffersImmediate
* cmd
=
1061 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
1062 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(false);
1063 cmd
->Init(1, &client_renderbuffer_id_
);
1064 EXPECT_EQ(error::kInvalidArguments
,
1065 ExecuteImmediateCmd(*cmd
, sizeof(&client_renderbuffer_id_
)));
1068 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateValidArgs
) {
1069 EXPECT_CALL(*gl_
, GenSamplers(1, _
))
1070 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1071 cmds::GenSamplersImmediate
* cmd
=
1072 GetImmediateAs
<cmds::GenSamplersImmediate
>();
1073 GLuint temp
= kNewClientId
;
1074 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(true);
1075 decoder_
->set_unsafe_es3_apis_enabled(true);
1076 cmd
->Init(1, &temp
);
1077 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1078 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1080 EXPECT_TRUE(GetSamplerServiceId(kNewClientId
, &service_id
));
1081 EXPECT_EQ(kNewServiceId
, service_id
);
1082 decoder_
->set_unsafe_es3_apis_enabled(false);
1083 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1086 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateInvalidArgs
) {
1087 EXPECT_CALL(*gl_
, GenSamplers(_
, _
)).Times(0);
1088 cmds::GenSamplersImmediate
* cmd
=
1089 GetImmediateAs
<cmds::GenSamplersImmediate
>();
1090 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(false);
1091 cmd
->Init(1, &client_sampler_id_
);
1092 decoder_
->set_unsafe_es3_apis_enabled(true);
1093 EXPECT_EQ(error::kInvalidArguments
,
1094 ExecuteImmediateCmd(*cmd
, sizeof(&client_sampler_id_
)));
1095 decoder_
->set_unsafe_es3_apis_enabled(false);
1098 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateValidArgs
) {
1099 EXPECT_CALL(*gl_
, GenTextures(1, _
))
1100 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1101 cmds::GenTexturesImmediate
* cmd
=
1102 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1103 GLuint temp
= kNewClientId
;
1104 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(true);
1105 cmd
->Init(1, &temp
);
1106 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1107 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1108 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
1111 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateInvalidArgs
) {
1112 EXPECT_CALL(*gl_
, GenTextures(_
, _
)).Times(0);
1113 cmds::GenTexturesImmediate
* cmd
=
1114 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1115 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(false);
1116 cmd
->Init(1, &client_texture_id_
);
1117 EXPECT_EQ(error::kInvalidArguments
,
1118 ExecuteImmediateCmd(*cmd
, sizeof(&client_texture_id_
)));
1121 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateValidArgs
) {
1122 EXPECT_CALL(*gl_
, GenTransformFeedbacks(1, _
))
1123 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1124 cmds::GenTransformFeedbacksImmediate
* cmd
=
1125 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1126 GLuint temp
= kNewClientId
;
1127 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(true);
1128 decoder_
->set_unsafe_es3_apis_enabled(true);
1129 cmd
->Init(1, &temp
);
1130 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1131 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1133 EXPECT_TRUE(GetTransformFeedbackServiceId(kNewClientId
, &service_id
));
1134 EXPECT_EQ(kNewServiceId
, service_id
);
1135 decoder_
->set_unsafe_es3_apis_enabled(false);
1136 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1139 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateInvalidArgs
) {
1140 EXPECT_CALL(*gl_
, GenTransformFeedbacks(_
, _
)).Times(0);
1141 cmds::GenTransformFeedbacksImmediate
* cmd
=
1142 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1143 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(false);
1144 cmd
->Init(1, &client_transformfeedback_id_
);
1145 decoder_
->set_unsafe_es3_apis_enabled(true);
1146 EXPECT_EQ(error::kInvalidArguments
,
1147 ExecuteImmediateCmd(*cmd
, sizeof(&client_transformfeedback_id_
)));
1148 decoder_
->set_unsafe_es3_apis_enabled(false);
1150 // TODO(gman): GetActiveAttrib
1152 // TODO(gman): GetActiveUniform
1154 // TODO(gman): GetActiveUniformBlockiv
1156 // TODO(gman): GetActiveUniformBlockName
1158 // TODO(gman): GetActiveUniformsiv
1160 // TODO(gman): GetAttachedShaders
1162 // TODO(gman): GetAttribLocation
1164 TEST_P(GLES2DecoderTest1
, GetBooleanvValidArgs
) {
1165 EXPECT_CALL(*gl_
, GetError())
1166 .WillOnce(Return(GL_NO_ERROR
))
1167 .WillOnce(Return(GL_NO_ERROR
))
1168 .RetiresOnSaturation();
1169 SpecializedSetup
<cmds::GetBooleanv
, 0>(true);
1170 typedef cmds::GetBooleanv::Result Result
;
1171 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1172 EXPECT_CALL(*gl_
, GetBooleanv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1174 cmds::GetBooleanv cmd
;
1175 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1176 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1177 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1178 result
->GetNumResults());
1179 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1182 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs0_0
) {
1183 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1184 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1185 cmds::GetBooleanv::Result
* result
=
1186 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1188 cmds::GetBooleanv cmd
;
1189 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1190 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1191 EXPECT_EQ(0u, result
->size
);
1192 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1195 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_0
) {
1196 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1197 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1198 cmds::GetBooleanv::Result
* result
=
1199 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1201 cmds::GetBooleanv cmd
;
1202 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1203 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1204 EXPECT_EQ(0u, result
->size
);
1207 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_1
) {
1208 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1209 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1210 cmds::GetBooleanv::Result
* result
=
1211 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1213 cmds::GetBooleanv cmd
;
1214 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1215 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1216 EXPECT_EQ(0u, result
->size
);
1219 TEST_P(GLES2DecoderTest1
, GetBufferParameteri64vValidArgs
) {
1220 SpecializedSetup
<cmds::GetBufferParameteri64v
, 0>(true);
1221 typedef cmds::GetBufferParameteri64v::Result Result
;
1222 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1224 cmds::GetBufferParameteri64v cmd
;
1225 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1226 shared_memory_offset_
);
1227 decoder_
->set_unsafe_es3_apis_enabled(true);
1228 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1229 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1230 result
->GetNumResults());
1231 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1232 decoder_
->set_unsafe_es3_apis_enabled(false);
1233 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1236 TEST_P(GLES2DecoderTest1
, GetBufferParameterivValidArgs
) {
1237 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(true);
1238 typedef cmds::GetBufferParameteriv::Result Result
;
1239 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1241 cmds::GetBufferParameteriv cmd
;
1242 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1243 shared_memory_offset_
);
1244 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1245 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1246 result
->GetNumResults());
1247 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1250 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs0_0
) {
1251 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1252 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1253 cmds::GetBufferParameteriv::Result
* result
=
1254 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1256 cmds::GetBufferParameteriv cmd
;
1257 cmd
.Init(GL_RENDERBUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1258 shared_memory_offset_
);
1259 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1260 EXPECT_EQ(0u, result
->size
);
1261 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1264 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs1_0
) {
1265 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1266 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1267 cmds::GetBufferParameteriv::Result
* result
=
1268 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1270 cmds::GetBufferParameteriv cmd
;
1271 cmd
.Init(GL_ARRAY_BUFFER
, GL_PIXEL_PACK_BUFFER
, shared_memory_id_
,
1272 shared_memory_offset_
);
1273 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1274 EXPECT_EQ(0u, result
->size
);
1275 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1278 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_0
) {
1279 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1280 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1281 cmds::GetBufferParameteriv::Result
* result
=
1282 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1284 cmds::GetBufferParameteriv cmd
;
1285 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, kInvalidSharedMemoryId
, 0);
1286 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1287 EXPECT_EQ(0u, result
->size
);
1290 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_1
) {
1291 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1292 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1293 cmds::GetBufferParameteriv::Result
* result
=
1294 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1296 cmds::GetBufferParameteriv cmd
;
1297 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1298 kInvalidSharedMemoryOffset
);
1299 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1300 EXPECT_EQ(0u, result
->size
);
1303 TEST_P(GLES2DecoderTest1
, GetErrorValidArgs
) {
1304 EXPECT_CALL(*gl_
, GetError());
1305 SpecializedSetup
<cmds::GetError
, 0>(true);
1307 cmd
.Init(shared_memory_id_
, shared_memory_offset_
);
1308 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1309 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1312 TEST_P(GLES2DecoderTest1
, GetErrorInvalidArgsBadSharedMemoryId
) {
1313 EXPECT_CALL(*gl_
, GetError()).Times(0);
1314 SpecializedSetup
<cmds::GetError
, 0>(false);
1316 cmd
.Init(kInvalidSharedMemoryId
, shared_memory_offset_
);
1317 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1318 cmd
.Init(shared_memory_id_
, kInvalidSharedMemoryOffset
);
1319 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1322 TEST_P(GLES2DecoderTest1
, GetFloatvValidArgs
) {
1323 EXPECT_CALL(*gl_
, GetError())
1324 .WillOnce(Return(GL_NO_ERROR
))
1325 .WillOnce(Return(GL_NO_ERROR
))
1326 .RetiresOnSaturation();
1327 SpecializedSetup
<cmds::GetFloatv
, 0>(true);
1328 typedef cmds::GetFloatv::Result Result
;
1329 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1330 EXPECT_CALL(*gl_
, GetFloatv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1332 cmds::GetFloatv cmd
;
1333 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1334 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1335 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1336 result
->GetNumResults());
1337 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1340 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs0_0
) {
1341 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1342 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1343 cmds::GetFloatv::Result
* result
=
1344 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1346 cmds::GetFloatv cmd
;
1347 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1348 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1349 EXPECT_EQ(0u, result
->size
);
1350 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1353 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_0
) {
1354 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1355 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1356 cmds::GetFloatv::Result
* result
=
1357 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1359 cmds::GetFloatv cmd
;
1360 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1361 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1362 EXPECT_EQ(0u, result
->size
);
1365 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_1
) {
1366 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1367 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1368 cmds::GetFloatv::Result
* result
=
1369 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1371 cmds::GetFloatv cmd
;
1372 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1373 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1374 EXPECT_EQ(0u, result
->size
);
1376 // TODO(gman): GetFragDataLocation
1378 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivValidArgs
) {
1379 EXPECT_CALL(*gl_
, GetError())
1380 .WillOnce(Return(GL_NO_ERROR
))
1381 .WillOnce(Return(GL_NO_ERROR
))
1382 .RetiresOnSaturation();
1383 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(true);
1384 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
1385 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1387 GetFramebufferAttachmentParameterivEXT(
1388 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1389 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, result
->GetData()));
1391 cmds::GetFramebufferAttachmentParameteriv cmd
;
1392 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1393 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1394 shared_memory_offset_
);
1395 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1396 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1397 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
),
1398 result
->GetNumResults());
1399 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1402 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_0
) {
1403 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1405 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1406 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1407 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1408 shared_memory_address_
);
1410 cmds::GetFramebufferAttachmentParameteriv cmd
;
1411 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
,
1412 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1413 shared_memory_offset_
);
1414 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1415 EXPECT_EQ(0u, result
->size
);
1416 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1419 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_0
) {
1420 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1422 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1423 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1424 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1425 shared_memory_address_
);
1427 cmds::GetFramebufferAttachmentParameteriv cmd
;
1428 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1429 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, kInvalidSharedMemoryId
, 0);
1430 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1431 EXPECT_EQ(0u, result
->size
);
1434 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_1
) {
1435 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1437 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1438 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1439 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1440 shared_memory_address_
);
1442 cmds::GetFramebufferAttachmentParameteriv cmd
;
1443 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1444 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1445 kInvalidSharedMemoryOffset
);
1446 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1447 EXPECT_EQ(0u, result
->size
);
1450 TEST_P(GLES2DecoderTest1
, GetInteger64vValidArgs
) {
1451 EXPECT_CALL(*gl_
, GetError())
1452 .WillOnce(Return(GL_NO_ERROR
))
1453 .WillOnce(Return(GL_NO_ERROR
))
1454 .RetiresOnSaturation();
1455 SpecializedSetup
<cmds::GetInteger64v
, 0>(true);
1456 typedef cmds::GetInteger64v::Result Result
;
1457 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1458 EXPECT_CALL(*gl_
, GetInteger64v(GL_ACTIVE_TEXTURE
, result
->GetData()));
1460 cmds::GetInteger64v cmd
;
1461 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1462 decoder_
->set_unsafe_es3_apis_enabled(true);
1463 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1464 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1465 result
->GetNumResults());
1466 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1467 decoder_
->set_unsafe_es3_apis_enabled(false);
1468 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1471 TEST_P(GLES2DecoderTest1
, GetIntegeri_vValidArgs
) {
1472 EXPECT_CALL(*gl_
, GetError())
1473 .WillOnce(Return(GL_NO_ERROR
))
1474 .WillOnce(Return(GL_NO_ERROR
))
1475 .RetiresOnSaturation();
1476 SpecializedSetup
<cmds::GetIntegeri_v
, 0>(true);
1477 typedef cmds::GetIntegeri_v::Result Result
;
1478 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1479 EXPECT_CALL(*gl_
, GetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2,
1480 result
->GetData()));
1482 cmds::GetIntegeri_v cmd
;
1483 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2, shared_memory_id_
,
1484 shared_memory_offset_
);
1485 decoder_
->set_unsafe_es3_apis_enabled(true);
1486 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1487 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1488 GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
),
1489 result
->GetNumResults());
1490 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1491 decoder_
->set_unsafe_es3_apis_enabled(false);
1492 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1495 TEST_P(GLES2DecoderTest1
, GetInteger64i_vValidArgs
) {
1496 EXPECT_CALL(*gl_
, GetError())
1497 .WillOnce(Return(GL_NO_ERROR
))
1498 .WillOnce(Return(GL_NO_ERROR
))
1499 .RetiresOnSaturation();
1500 SpecializedSetup
<cmds::GetInteger64i_v
, 0>(true);
1501 typedef cmds::GetInteger64i_v::Result Result
;
1502 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1503 EXPECT_CALL(*gl_
, GetInteger64i_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2,
1504 result
->GetData()));
1506 cmds::GetInteger64i_v cmd
;
1507 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2, shared_memory_id_
,
1508 shared_memory_offset_
);
1509 decoder_
->set_unsafe_es3_apis_enabled(true);
1510 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1511 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1512 GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
),
1513 result
->GetNumResults());
1514 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1515 decoder_
->set_unsafe_es3_apis_enabled(false);
1516 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1519 TEST_P(GLES2DecoderTest1
, GetIntegervValidArgs
) {
1520 EXPECT_CALL(*gl_
, GetError())
1521 .WillOnce(Return(GL_NO_ERROR
))
1522 .WillOnce(Return(GL_NO_ERROR
))
1523 .RetiresOnSaturation();
1524 SpecializedSetup
<cmds::GetIntegerv
, 0>(true);
1525 typedef cmds::GetIntegerv::Result Result
;
1526 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1527 EXPECT_CALL(*gl_
, GetIntegerv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1529 cmds::GetIntegerv cmd
;
1530 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1531 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1532 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1533 result
->GetNumResults());
1534 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1537 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs0_0
) {
1538 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1539 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1540 cmds::GetIntegerv::Result
* result
=
1541 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1543 cmds::GetIntegerv cmd
;
1544 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1545 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1546 EXPECT_EQ(0u, result
->size
);
1547 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1550 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_0
) {
1551 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1552 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1553 cmds::GetIntegerv::Result
* result
=
1554 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1556 cmds::GetIntegerv cmd
;
1557 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1558 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1559 EXPECT_EQ(0u, result
->size
);
1562 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_1
) {
1563 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1564 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1565 cmds::GetIntegerv::Result
* result
=
1566 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1568 cmds::GetIntegerv cmd
;
1569 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1570 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1571 EXPECT_EQ(0u, result
->size
);
1573 // TODO(gman): GetInternalformativ
1575 TEST_P(GLES2DecoderTest1
, GetProgramivValidArgs
) {
1576 SpecializedSetup
<cmds::GetProgramiv
, 0>(true);
1577 typedef cmds::GetProgramiv::Result Result
;
1578 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1580 cmds::GetProgramiv cmd
;
1581 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1582 shared_memory_offset_
);
1583 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1584 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_DELETE_STATUS
),
1585 result
->GetNumResults());
1586 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1589 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs1_0
) {
1590 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1591 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1592 cmds::GetProgramiv::Result
* result
=
1593 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1595 cmds::GetProgramiv cmd
;
1596 cmd
.Init(client_program_id_
, GL_PROGRAM_BINARY_RETRIEVABLE_HINT
,
1597 shared_memory_id_
, shared_memory_offset_
);
1598 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1599 EXPECT_EQ(0u, result
->size
);
1600 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1603 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_0
) {
1604 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1605 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1606 cmds::GetProgramiv::Result
* result
=
1607 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1609 cmds::GetProgramiv cmd
;
1610 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, kInvalidSharedMemoryId
, 0);
1611 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1612 EXPECT_EQ(0u, result
->size
);
1615 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_1
) {
1616 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1617 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1618 cmds::GetProgramiv::Result
* result
=
1619 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1621 cmds::GetProgramiv cmd
;
1622 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1623 kInvalidSharedMemoryOffset
);
1624 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1625 EXPECT_EQ(0u, result
->size
);
1627 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_