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
) {
712 EXPECT_CALL(*gl_
, DeleteTransformFeedbacks(
713 1, Pointee(kServiceTransformFeedbackId
))).Times(1);
714 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
715 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
716 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(true);
717 cmd
.Init(1, &client_transformfeedback_id_
);
718 decoder_
->set_unsafe_es3_apis_enabled(true);
719 EXPECT_EQ(error::kNoError
,
720 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
721 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
723 GetTransformFeedbackServiceId(client_transformfeedback_id_
, NULL
));
724 decoder_
->set_unsafe_es3_apis_enabled(false);
725 EXPECT_EQ(error::kUnknownCommand
,
726 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
729 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateInvalidArgs
) {
730 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
731 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
732 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(false);
733 GLuint temp
= kInvalidClientId
;
735 decoder_
->set_unsafe_es3_apis_enabled(true);
736 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
737 decoder_
->set_unsafe_es3_apis_enabled(false);
738 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
741 TEST_P(GLES2DecoderTest1
, DepthFuncValidArgs
) {
742 EXPECT_CALL(*gl_
, DepthFunc(GL_NEVER
));
743 SpecializedSetup
<cmds::DepthFunc
, 0>(true);
746 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
747 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
750 TEST_P(GLES2DecoderTest1
, DepthMaskValidArgs
) {
751 SpecializedSetup
<cmds::DepthMask
, 0>(true);
754 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
755 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
758 TEST_P(GLES2DecoderTest1
, DepthRangefValidArgs
) {
759 EXPECT_CALL(*gl_
, DepthRange(1, 2));
760 SpecializedSetup
<cmds::DepthRangef
, 0>(true);
761 cmds::DepthRangef cmd
;
763 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
764 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
767 TEST_P(GLES2DecoderTest1
, DetachShaderValidArgs
) {
768 EXPECT_CALL(*gl_
, DetachShader(kServiceProgramId
, kServiceShaderId
));
769 SpecializedSetup
<cmds::DetachShader
, 0>(true);
770 cmds::DetachShader cmd
;
771 cmd
.Init(client_program_id_
, client_shader_id_
);
772 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
773 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
776 TEST_P(GLES2DecoderTest1
, DisableValidArgs
) {
777 SetupExpectationsForEnableDisable(GL_BLEND
, false);
778 SpecializedSetup
<cmds::Disable
, 0>(true);
781 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
782 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
785 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_0
) {
786 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
787 SpecializedSetup
<cmds::Disable
, 0>(false);
789 cmd
.Init(GL_CLIP_PLANE0
);
790 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
791 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
794 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_1
) {
795 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
796 SpecializedSetup
<cmds::Disable
, 0>(false);
798 cmd
.Init(GL_POINT_SPRITE
);
799 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
800 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
803 TEST_P(GLES2DecoderTest1
, DisableVertexAttribArrayValidArgs
) {
804 EXPECT_CALL(*gl_
, DisableVertexAttribArray(1));
805 SpecializedSetup
<cmds::DisableVertexAttribArray
, 0>(true);
806 cmds::DisableVertexAttribArray cmd
;
808 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
809 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
811 // TODO(gman): DrawArrays
813 // TODO(gman): DrawElements
815 TEST_P(GLES2DecoderTest1
, EnableValidArgs
) {
816 SetupExpectationsForEnableDisable(GL_BLEND
, true);
817 SpecializedSetup
<cmds::Enable
, 0>(true);
820 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
821 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
824 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_0
) {
825 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
826 SpecializedSetup
<cmds::Enable
, 0>(false);
828 cmd
.Init(GL_CLIP_PLANE0
);
829 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
830 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
833 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_1
) {
834 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
835 SpecializedSetup
<cmds::Enable
, 0>(false);
837 cmd
.Init(GL_POINT_SPRITE
);
838 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
839 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
842 TEST_P(GLES2DecoderTest1
, EnableVertexAttribArrayValidArgs
) {
843 EXPECT_CALL(*gl_
, EnableVertexAttribArray(1));
844 SpecializedSetup
<cmds::EnableVertexAttribArray
, 0>(true);
845 cmds::EnableVertexAttribArray cmd
;
847 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
848 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
851 TEST_P(GLES2DecoderTest1
, FenceSyncValidArgs
) {
852 const GLsync kNewServiceIdGLuint
= reinterpret_cast<GLsync
>(kNewServiceId
);
853 EXPECT_CALL(*gl_
, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE
, 0))
854 .WillOnce(Return(kNewServiceIdGLuint
));
855 SpecializedSetup
<cmds::FenceSync
, 0>(true);
857 cmd
.Init(kNewClientId
);
858 decoder_
->set_unsafe_es3_apis_enabled(true);
859 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
860 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
861 GLsync service_id
= 0;
862 EXPECT_TRUE(GetSyncServiceId(kNewClientId
, &service_id
));
863 EXPECT_EQ(kNewServiceIdGLuint
, service_id
);
864 decoder_
->set_unsafe_es3_apis_enabled(false);
865 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
868 TEST_P(GLES2DecoderTest1
, FinishValidArgs
) {
869 EXPECT_CALL(*gl_
, Finish());
870 SpecializedSetup
<cmds::Finish
, 0>(true);
873 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
874 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
877 TEST_P(GLES2DecoderTest1
, FlushValidArgs
) {
878 EXPECT_CALL(*gl_
, Flush());
879 SpecializedSetup
<cmds::Flush
, 0>(true);
882 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
883 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
886 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferValidArgs
) {
887 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(
888 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
889 kServiceRenderbufferId
));
890 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(true);
891 cmds::FramebufferRenderbuffer cmd
;
892 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
893 client_renderbuffer_id_
);
894 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
895 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
898 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_0
) {
899 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
900 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
901 cmds::FramebufferRenderbuffer cmd
;
902 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
903 client_renderbuffer_id_
);
904 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
905 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
908 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs2_0
) {
909 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
910 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
911 cmds::FramebufferRenderbuffer cmd
;
912 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_FRAMEBUFFER
,
913 client_renderbuffer_id_
);
914 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
915 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
918 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DValidArgs
) {
920 FramebufferTexture2DEXT(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
921 GL_TEXTURE_2D
, kServiceTextureId
, 0));
922 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(true);
923 cmds::FramebufferTexture2D cmd
;
924 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
926 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
927 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
930 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_0
) {
931 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
932 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
933 cmds::FramebufferTexture2D cmd
;
934 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
936 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
937 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
940 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs2_0
) {
941 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
942 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
943 cmds::FramebufferTexture2D cmd
;
944 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_PROXY_TEXTURE_CUBE_MAP
,
946 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
947 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
950 TEST_P(GLES2DecoderTest1
, FramebufferTextureLayerValidArgs
) {
952 FramebufferTextureLayer(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
953 kServiceTextureId
, 4, 5));
954 SpecializedSetup
<cmds::FramebufferTextureLayer
, 0>(true);
955 cmds::FramebufferTextureLayer cmd
;
956 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, client_texture_id_
, 4, 5);
957 decoder_
->set_unsafe_es3_apis_enabled(true);
958 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
959 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
960 decoder_
->set_unsafe_es3_apis_enabled(false);
961 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
964 TEST_P(GLES2DecoderTest1
, FrontFaceValidArgs
) {
965 EXPECT_CALL(*gl_
, FrontFace(GL_CW
));
966 SpecializedSetup
<cmds::FrontFace
, 0>(true);
969 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
970 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
973 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateValidArgs
) {
974 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
975 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
976 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
977 GLuint temp
= kNewClientId
;
978 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(true);
980 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
981 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
982 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
985 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateInvalidArgs
) {
986 EXPECT_CALL(*gl_
, GenBuffersARB(_
, _
)).Times(0);
987 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
988 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(false);
989 cmd
->Init(1, &client_buffer_id_
);
990 EXPECT_EQ(error::kInvalidArguments
,
991 ExecuteImmediateCmd(*cmd
, sizeof(&client_buffer_id_
)));
994 TEST_P(GLES2DecoderTest1
, GenerateMipmapValidArgs
) {
995 EXPECT_CALL(*gl_
, GenerateMipmapEXT(GL_TEXTURE_2D
));
996 SpecializedSetup
<cmds::GenerateMipmap
, 0>(true);
997 cmds::GenerateMipmap cmd
;
998 cmd
.Init(GL_TEXTURE_2D
);
999 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1000 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1003 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_0
) {
1004 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
1005 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
1006 cmds::GenerateMipmap cmd
;
1007 cmd
.Init(GL_TEXTURE_1D
);
1008 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1009 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1012 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_1
) {
1013 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
1014 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
1015 cmds::GenerateMipmap cmd
;
1016 cmd
.Init(GL_TEXTURE_3D
);
1017 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1018 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1021 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateValidArgs
) {
1022 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
1023 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1024 cmds::GenFramebuffersImmediate
* cmd
=
1025 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
1026 GLuint temp
= kNewClientId
;
1027 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(true);
1028 cmd
->Init(1, &temp
);
1029 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1030 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1031 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
1034 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateInvalidArgs
) {
1035 EXPECT_CALL(*gl_
, GenFramebuffersEXT(_
, _
)).Times(0);
1036 cmds::GenFramebuffersImmediate
* cmd
=
1037 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
1038 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(false);
1039 cmd
->Init(1, &client_framebuffer_id_
);
1040 EXPECT_EQ(error::kInvalidArguments
,
1041 ExecuteImmediateCmd(*cmd
, sizeof(&client_framebuffer_id_
)));
1044 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateValidArgs
) {
1045 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
1046 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1047 cmds::GenRenderbuffersImmediate
* cmd
=
1048 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
1049 GLuint temp
= kNewClientId
;
1050 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(true);
1051 cmd
->Init(1, &temp
);
1052 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1053 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1054 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
1057 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateInvalidArgs
) {
1058 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(_
, _
)).Times(0);
1059 cmds::GenRenderbuffersImmediate
* cmd
=
1060 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
1061 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(false);
1062 cmd
->Init(1, &client_renderbuffer_id_
);
1063 EXPECT_EQ(error::kInvalidArguments
,
1064 ExecuteImmediateCmd(*cmd
, sizeof(&client_renderbuffer_id_
)));
1067 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateValidArgs
) {
1068 EXPECT_CALL(*gl_
, GenSamplers(1, _
))
1069 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1070 cmds::GenSamplersImmediate
* cmd
=
1071 GetImmediateAs
<cmds::GenSamplersImmediate
>();
1072 GLuint temp
= kNewClientId
;
1073 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(true);
1074 decoder_
->set_unsafe_es3_apis_enabled(true);
1075 cmd
->Init(1, &temp
);
1076 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1077 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1079 EXPECT_TRUE(GetSamplerServiceId(kNewClientId
, &service_id
));
1080 EXPECT_EQ(kNewServiceId
, service_id
);
1081 decoder_
->set_unsafe_es3_apis_enabled(false);
1082 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1085 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateInvalidArgs
) {
1086 EXPECT_CALL(*gl_
, GenSamplers(_
, _
)).Times(0);
1087 cmds::GenSamplersImmediate
* cmd
=
1088 GetImmediateAs
<cmds::GenSamplersImmediate
>();
1089 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(false);
1090 cmd
->Init(1, &client_sampler_id_
);
1091 decoder_
->set_unsafe_es3_apis_enabled(true);
1092 EXPECT_EQ(error::kInvalidArguments
,
1093 ExecuteImmediateCmd(*cmd
, sizeof(&client_sampler_id_
)));
1094 decoder_
->set_unsafe_es3_apis_enabled(false);
1097 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateValidArgs
) {
1098 EXPECT_CALL(*gl_
, GenTextures(1, _
))
1099 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1100 cmds::GenTexturesImmediate
* cmd
=
1101 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1102 GLuint temp
= kNewClientId
;
1103 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(true);
1104 cmd
->Init(1, &temp
);
1105 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1106 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1107 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
1110 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateInvalidArgs
) {
1111 EXPECT_CALL(*gl_
, GenTextures(_
, _
)).Times(0);
1112 cmds::GenTexturesImmediate
* cmd
=
1113 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1114 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(false);
1115 cmd
->Init(1, &client_texture_id_
);
1116 EXPECT_EQ(error::kInvalidArguments
,
1117 ExecuteImmediateCmd(*cmd
, sizeof(&client_texture_id_
)));
1120 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateValidArgs
) {
1121 EXPECT_CALL(*gl_
, GenTransformFeedbacks(1, _
))
1122 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1123 cmds::GenTransformFeedbacksImmediate
* cmd
=
1124 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1125 GLuint temp
= kNewClientId
;
1126 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(true);
1127 decoder_
->set_unsafe_es3_apis_enabled(true);
1128 cmd
->Init(1, &temp
);
1129 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1130 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1132 EXPECT_TRUE(GetTransformFeedbackServiceId(kNewClientId
, &service_id
));
1133 EXPECT_EQ(kNewServiceId
, service_id
);
1134 decoder_
->set_unsafe_es3_apis_enabled(false);
1135 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1138 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateInvalidArgs
) {
1139 EXPECT_CALL(*gl_
, GenTransformFeedbacks(_
, _
)).Times(0);
1140 cmds::GenTransformFeedbacksImmediate
* cmd
=
1141 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1142 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(false);
1143 cmd
->Init(1, &client_transformfeedback_id_
);
1144 decoder_
->set_unsafe_es3_apis_enabled(true);
1145 EXPECT_EQ(error::kInvalidArguments
,
1146 ExecuteImmediateCmd(*cmd
, sizeof(&client_transformfeedback_id_
)));
1147 decoder_
->set_unsafe_es3_apis_enabled(false);
1149 // TODO(gman): GetActiveAttrib
1151 // TODO(gman): GetActiveUniform
1153 // TODO(gman): GetActiveUniformBlockiv
1155 // TODO(gman): GetActiveUniformBlockName
1157 // TODO(gman): GetActiveUniformsiv
1159 // TODO(gman): GetAttachedShaders
1161 // TODO(gman): GetAttribLocation
1163 TEST_P(GLES2DecoderTest1
, GetBooleanvValidArgs
) {
1164 EXPECT_CALL(*gl_
, GetError())
1165 .WillOnce(Return(GL_NO_ERROR
))
1166 .WillOnce(Return(GL_NO_ERROR
))
1167 .RetiresOnSaturation();
1168 SpecializedSetup
<cmds::GetBooleanv
, 0>(true);
1169 typedef cmds::GetBooleanv::Result Result
;
1170 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1171 EXPECT_CALL(*gl_
, GetBooleanv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1173 cmds::GetBooleanv cmd
;
1174 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1175 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1176 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1177 result
->GetNumResults());
1178 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1181 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs0_0
) {
1182 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1183 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1184 cmds::GetBooleanv::Result
* result
=
1185 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1187 cmds::GetBooleanv cmd
;
1188 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1189 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1190 EXPECT_EQ(0u, result
->size
);
1191 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1194 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_0
) {
1195 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1196 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1197 cmds::GetBooleanv::Result
* result
=
1198 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1200 cmds::GetBooleanv cmd
;
1201 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1202 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1203 EXPECT_EQ(0u, result
->size
);
1206 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_1
) {
1207 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1208 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1209 cmds::GetBooleanv::Result
* result
=
1210 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1212 cmds::GetBooleanv cmd
;
1213 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1214 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1215 EXPECT_EQ(0u, result
->size
);
1218 TEST_P(GLES2DecoderTest1
, GetBufferParameterivValidArgs
) {
1219 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(true);
1220 typedef cmds::GetBufferParameteriv::Result Result
;
1221 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1223 cmds::GetBufferParameteriv cmd
;
1224 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1225 shared_memory_offset_
);
1226 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1227 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1228 result
->GetNumResults());
1229 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1232 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs0_0
) {
1233 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1234 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1235 cmds::GetBufferParameteriv::Result
* result
=
1236 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1238 cmds::GetBufferParameteriv cmd
;
1239 cmd
.Init(GL_RENDERBUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1240 shared_memory_offset_
);
1241 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1242 EXPECT_EQ(0u, result
->size
);
1243 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1246 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs1_0
) {
1247 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1248 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1249 cmds::GetBufferParameteriv::Result
* result
=
1250 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1252 cmds::GetBufferParameteriv cmd
;
1253 cmd
.Init(GL_ARRAY_BUFFER
, GL_PIXEL_PACK_BUFFER
, shared_memory_id_
,
1254 shared_memory_offset_
);
1255 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1256 EXPECT_EQ(0u, result
->size
);
1257 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1260 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_0
) {
1261 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1262 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1263 cmds::GetBufferParameteriv::Result
* result
=
1264 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1266 cmds::GetBufferParameteriv cmd
;
1267 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, kInvalidSharedMemoryId
, 0);
1268 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1269 EXPECT_EQ(0u, result
->size
);
1272 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_1
) {
1273 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1274 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1275 cmds::GetBufferParameteriv::Result
* result
=
1276 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1278 cmds::GetBufferParameteriv cmd
;
1279 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1280 kInvalidSharedMemoryOffset
);
1281 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1282 EXPECT_EQ(0u, result
->size
);
1285 TEST_P(GLES2DecoderTest1
, GetErrorValidArgs
) {
1286 EXPECT_CALL(*gl_
, GetError());
1287 SpecializedSetup
<cmds::GetError
, 0>(true);
1289 cmd
.Init(shared_memory_id_
, shared_memory_offset_
);
1290 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1291 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1294 TEST_P(GLES2DecoderTest1
, GetErrorInvalidArgsBadSharedMemoryId
) {
1295 EXPECT_CALL(*gl_
, GetError()).Times(0);
1296 SpecializedSetup
<cmds::GetError
, 0>(false);
1298 cmd
.Init(kInvalidSharedMemoryId
, shared_memory_offset_
);
1299 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1300 cmd
.Init(shared_memory_id_
, kInvalidSharedMemoryOffset
);
1301 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1304 TEST_P(GLES2DecoderTest1
, GetFloatvValidArgs
) {
1305 EXPECT_CALL(*gl_
, GetError())
1306 .WillOnce(Return(GL_NO_ERROR
))
1307 .WillOnce(Return(GL_NO_ERROR
))
1308 .RetiresOnSaturation();
1309 SpecializedSetup
<cmds::GetFloatv
, 0>(true);
1310 typedef cmds::GetFloatv::Result Result
;
1311 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1312 EXPECT_CALL(*gl_
, GetFloatv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1314 cmds::GetFloatv cmd
;
1315 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1316 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1317 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1318 result
->GetNumResults());
1319 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1322 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs0_0
) {
1323 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1324 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1325 cmds::GetFloatv::Result
* result
=
1326 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1328 cmds::GetFloatv cmd
;
1329 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1330 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1331 EXPECT_EQ(0u, result
->size
);
1332 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1335 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_0
) {
1336 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1337 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1338 cmds::GetFloatv::Result
* result
=
1339 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1341 cmds::GetFloatv cmd
;
1342 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1343 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1344 EXPECT_EQ(0u, result
->size
);
1347 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_1
) {
1348 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1349 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1350 cmds::GetFloatv::Result
* result
=
1351 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1353 cmds::GetFloatv cmd
;
1354 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1355 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1356 EXPECT_EQ(0u, result
->size
);
1358 // TODO(gman): GetFragDataLocation
1360 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivValidArgs
) {
1361 EXPECT_CALL(*gl_
, GetError())
1362 .WillOnce(Return(GL_NO_ERROR
))
1363 .WillOnce(Return(GL_NO_ERROR
))
1364 .RetiresOnSaturation();
1365 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(true);
1366 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
1367 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1369 GetFramebufferAttachmentParameterivEXT(
1370 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1371 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, result
->GetData()));
1373 cmds::GetFramebufferAttachmentParameteriv cmd
;
1374 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1375 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1376 shared_memory_offset_
);
1377 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1378 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1379 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
),
1380 result
->GetNumResults());
1381 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1384 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_0
) {
1385 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1387 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1388 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1389 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1390 shared_memory_address_
);
1392 cmds::GetFramebufferAttachmentParameteriv cmd
;
1393 cmd
.Init(GL_RENDERBUFFER
, GL_COLOR_ATTACHMENT0
,
1394 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1395 shared_memory_offset_
);
1396 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1397 EXPECT_EQ(0u, result
->size
);
1398 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1401 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_0
) {
1402 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1404 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1405 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1406 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1407 shared_memory_address_
);
1409 cmds::GetFramebufferAttachmentParameteriv cmd
;
1410 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1411 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, kInvalidSharedMemoryId
, 0);
1412 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1413 EXPECT_EQ(0u, result
->size
);
1416 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_1
) {
1417 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1419 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1420 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1421 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1422 shared_memory_address_
);
1424 cmds::GetFramebufferAttachmentParameteriv cmd
;
1425 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1426 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1427 kInvalidSharedMemoryOffset
);
1428 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1429 EXPECT_EQ(0u, result
->size
);
1432 TEST_P(GLES2DecoderTest1
, GetInteger64vValidArgs
) {
1433 EXPECT_CALL(*gl_
, GetError())
1434 .WillOnce(Return(GL_NO_ERROR
))
1435 .WillOnce(Return(GL_NO_ERROR
))
1436 .RetiresOnSaturation();
1437 SpecializedSetup
<cmds::GetInteger64v
, 0>(true);
1438 typedef cmds::GetInteger64v::Result Result
;
1439 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1440 EXPECT_CALL(*gl_
, GetInteger64v(GL_ACTIVE_TEXTURE
, result
->GetData()));
1442 cmds::GetInteger64v cmd
;
1443 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1444 decoder_
->set_unsafe_es3_apis_enabled(true);
1445 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1446 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1447 result
->GetNumResults());
1448 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1449 decoder_
->set_unsafe_es3_apis_enabled(false);
1450 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1453 TEST_P(GLES2DecoderTest1
, GetIntegeri_vValidArgs
) {
1454 EXPECT_CALL(*gl_
, GetError())
1455 .WillOnce(Return(GL_NO_ERROR
))
1456 .WillOnce(Return(GL_NO_ERROR
))
1457 .RetiresOnSaturation();
1458 SpecializedSetup
<cmds::GetIntegeri_v
, 0>(true);
1459 typedef cmds::GetIntegeri_v::Result Result
;
1460 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1461 EXPECT_CALL(*gl_
, GetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2,
1462 result
->GetData()));
1464 cmds::GetIntegeri_v cmd
;
1465 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2, shared_memory_id_
,
1466 shared_memory_offset_
);
1467 decoder_
->set_unsafe_es3_apis_enabled(true);
1468 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1469 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1470 GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
),
1471 result
->GetNumResults());
1472 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1473 decoder_
->set_unsafe_es3_apis_enabled(false);
1474 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1477 TEST_P(GLES2DecoderTest1
, GetInteger64i_vValidArgs
) {
1478 EXPECT_CALL(*gl_
, GetError())
1479 .WillOnce(Return(GL_NO_ERROR
))
1480 .WillOnce(Return(GL_NO_ERROR
))
1481 .RetiresOnSaturation();
1482 SpecializedSetup
<cmds::GetInteger64i_v
, 0>(true);
1483 typedef cmds::GetInteger64i_v::Result Result
;
1484 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1485 EXPECT_CALL(*gl_
, GetInteger64i_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2,
1486 result
->GetData()));
1488 cmds::GetInteger64i_v cmd
;
1489 cmd
.Init(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
, 2, shared_memory_id_
,
1490 shared_memory_offset_
);
1491 decoder_
->set_unsafe_es3_apis_enabled(true);
1492 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1493 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1494 GL_TRANSFORM_FEEDBACK_BUFFER_BINDING
),
1495 result
->GetNumResults());
1496 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1497 decoder_
->set_unsafe_es3_apis_enabled(false);
1498 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1501 TEST_P(GLES2DecoderTest1
, GetIntegervValidArgs
) {
1502 EXPECT_CALL(*gl_
, GetError())
1503 .WillOnce(Return(GL_NO_ERROR
))
1504 .WillOnce(Return(GL_NO_ERROR
))
1505 .RetiresOnSaturation();
1506 SpecializedSetup
<cmds::GetIntegerv
, 0>(true);
1507 typedef cmds::GetIntegerv::Result Result
;
1508 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1509 EXPECT_CALL(*gl_
, GetIntegerv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1511 cmds::GetIntegerv cmd
;
1512 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1513 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1514 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1515 result
->GetNumResults());
1516 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1519 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs0_0
) {
1520 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1521 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1522 cmds::GetIntegerv::Result
* result
=
1523 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1525 cmds::GetIntegerv cmd
;
1526 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1527 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1528 EXPECT_EQ(0u, result
->size
);
1529 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1532 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_0
) {
1533 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1534 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1535 cmds::GetIntegerv::Result
* result
=
1536 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1538 cmds::GetIntegerv cmd
;
1539 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1540 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1541 EXPECT_EQ(0u, result
->size
);
1544 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_1
) {
1545 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1546 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1547 cmds::GetIntegerv::Result
* result
=
1548 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1550 cmds::GetIntegerv cmd
;
1551 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1552 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1553 EXPECT_EQ(0u, result
->size
);
1555 // TODO(gman): GetInternalformativ
1557 TEST_P(GLES2DecoderTest1
, GetProgramivValidArgs
) {
1558 SpecializedSetup
<cmds::GetProgramiv
, 0>(true);
1559 typedef cmds::GetProgramiv::Result Result
;
1560 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1562 cmds::GetProgramiv cmd
;
1563 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1564 shared_memory_offset_
);
1565 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1566 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_DELETE_STATUS
),
1567 result
->GetNumResults());
1568 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1571 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs1_0
) {
1572 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1573 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1574 cmds::GetProgramiv::Result
* result
=
1575 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1577 cmds::GetProgramiv cmd
;
1578 cmd
.Init(client_program_id_
, GL_PROGRAM_BINARY_RETRIEVABLE_HINT
,
1579 shared_memory_id_
, shared_memory_offset_
);
1580 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1581 EXPECT_EQ(0u, result
->size
);
1582 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1585 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_0
) {
1586 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1587 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1588 cmds::GetProgramiv::Result
* result
=
1589 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1591 cmds::GetProgramiv cmd
;
1592 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, kInvalidSharedMemoryId
, 0);
1593 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1594 EXPECT_EQ(0u, result
->size
);
1597 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_1
) {
1598 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1599 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1600 cmds::GetProgramiv::Result
* result
=
1601 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1603 cmds::GetProgramiv cmd
;
1604 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1605 kInvalidSharedMemoryOffset
);
1606 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1607 EXPECT_EQ(0u, result
->size
);
1610 TEST_P(GLES2DecoderTest1
, GetProgramInfoLogValidArgs
) {
1611 const char* kInfo
= "hello";
1612 const uint32_t kBucketId
= 123;
1613 SpecializedSetup
<cmds::GetProgramInfoLog
, 0>(true);
1615 cmds::GetProgramInfoLog cmd
;
1616 cmd
.Init(client_program_id_
, kBucketId
);
1617 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1618 CommonDecoder::Bucket
* bucket
= decoder_
->GetBucket(kBucketId
);
1619 ASSERT_TRUE(bucket
!= NULL
);
1620 EXPECT_EQ(strlen(kInfo
) + 1, bucket
->size());
1622 memcmp(bucket
->GetData(0, bucket
->size()), kInfo
, bucket
->size()));
1623 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1626 TEST_P(GLES2DecoderTest1
, GetProgramInfoLogInvalidArgs
) {
1627 const uint32_t kBucketId
= 123;
1628 cmds::GetProgramInfoLog cmd
;
1629 cmd
.Init(kInvalidClientId
, kBucketId
);
1630 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1631 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1633 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_