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_DRAW_FRAMEBUFFER
, client_framebuffer_id_
);
141 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
142 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
145 TEST_P(GLES2DecoderTest1
, BindFramebufferInvalidArgs0_1
) {
146 EXPECT_CALL(*gl_
, BindFramebufferEXT(_
, _
)).Times(0);
147 SpecializedSetup
<cmds::BindFramebuffer
, 0>(false);
148 cmds::BindFramebuffer cmd
;
149 cmd
.Init(GL_READ_FRAMEBUFFER
, client_framebuffer_id_
);
150 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
151 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
154 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgs
) {
156 BindRenderbufferEXT(GL_RENDERBUFFER
, kServiceRenderbufferId
));
157 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
158 cmds::BindRenderbuffer cmd
;
159 cmd
.Init(GL_RENDERBUFFER
, client_renderbuffer_id_
);
160 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
161 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
164 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgsNewId
) {
165 EXPECT_CALL(*gl_
, BindRenderbufferEXT(GL_RENDERBUFFER
, kNewServiceId
));
166 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
167 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
168 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
169 cmds::BindRenderbuffer cmd
;
170 cmd
.Init(GL_RENDERBUFFER
, kNewClientId
);
171 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
172 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
173 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
176 TEST_P(GLES2DecoderTest1
, BindRenderbufferInvalidArgs0_0
) {
177 EXPECT_CALL(*gl_
, BindRenderbufferEXT(_
, _
)).Times(0);
178 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(false);
179 cmds::BindRenderbuffer cmd
;
180 cmd
.Init(GL_FRAMEBUFFER
, client_renderbuffer_id_
);
181 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
182 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
185 TEST_P(GLES2DecoderTest1
, BindSamplerValidArgs
) {
186 EXPECT_CALL(*gl_
, BindSampler(1, kServiceSamplerId
));
187 SpecializedSetup
<cmds::BindSampler
, 0>(true);
188 cmds::BindSampler cmd
;
189 cmd
.Init(1, client_sampler_id_
);
190 decoder_
->set_unsafe_es3_apis_enabled(true);
191 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
192 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
193 decoder_
->set_unsafe_es3_apis_enabled(false);
194 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
197 TEST_P(GLES2DecoderTest1
, BindTextureValidArgs
) {
198 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kServiceTextureId
));
199 SpecializedSetup
<cmds::BindTexture
, 0>(true);
200 cmds::BindTexture cmd
;
201 cmd
.Init(GL_TEXTURE_2D
, client_texture_id_
);
202 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
203 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
206 TEST_P(GLES2DecoderTest1
, BindTextureValidArgsNewId
) {
207 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kNewServiceId
));
208 EXPECT_CALL(*gl_
, GenTextures(1, _
))
209 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
210 SpecializedSetup
<cmds::BindTexture
, 0>(true);
211 cmds::BindTexture cmd
;
212 cmd
.Init(GL_TEXTURE_2D
, kNewClientId
);
213 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
214 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
215 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
218 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_0
) {
219 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
220 SpecializedSetup
<cmds::BindTexture
, 0>(false);
221 cmds::BindTexture cmd
;
222 cmd
.Init(GL_TEXTURE_1D
, client_texture_id_
);
223 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
224 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
227 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_1
) {
228 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
229 SpecializedSetup
<cmds::BindTexture
, 0>(false);
230 cmds::BindTexture cmd
;
231 cmd
.Init(GL_TEXTURE_3D
, client_texture_id_
);
232 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
233 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
236 TEST_P(GLES2DecoderTest1
, BindTransformFeedbackValidArgs
) {
237 EXPECT_CALL(*gl_
, BindTransformFeedback(GL_TRANSFORM_FEEDBACK
,
238 kServiceTransformFeedbackId
));
239 SpecializedSetup
<cmds::BindTransformFeedback
, 0>(true);
240 cmds::BindTransformFeedback cmd
;
241 cmd
.Init(GL_TRANSFORM_FEEDBACK
, client_transformfeedback_id_
);
242 decoder_
->set_unsafe_es3_apis_enabled(true);
243 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
244 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
245 decoder_
->set_unsafe_es3_apis_enabled(false);
246 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
249 TEST_P(GLES2DecoderTest1
, BlendColorValidArgs
) {
250 EXPECT_CALL(*gl_
, BlendColor(1, 2, 3, 4));
251 SpecializedSetup
<cmds::BlendColor
, 0>(true);
252 cmds::BlendColor cmd
;
253 cmd
.Init(1, 2, 3, 4);
254 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
255 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
258 TEST_P(GLES2DecoderTest1
, BlendEquationValidArgs
) {
259 EXPECT_CALL(*gl_
, BlendEquation(GL_FUNC_SUBTRACT
));
260 SpecializedSetup
<cmds::BlendEquation
, 0>(true);
261 cmds::BlendEquation cmd
;
262 cmd
.Init(GL_FUNC_SUBTRACT
);
263 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
264 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
267 TEST_P(GLES2DecoderTest1
, BlendEquationInvalidArgs0_0
) {
268 EXPECT_CALL(*gl_
, BlendEquation(_
)).Times(0);
269 SpecializedSetup
<cmds::BlendEquation
, 0>(false);
270 cmds::BlendEquation cmd
;
272 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
273 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
276 TEST_P(GLES2DecoderTest1
, BlendEquationInvalidArgs0_1
) {
277 EXPECT_CALL(*gl_
, BlendEquation(_
)).Times(0);
278 SpecializedSetup
<cmds::BlendEquation
, 0>(false);
279 cmds::BlendEquation cmd
;
281 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
282 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
285 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateValidArgs
) {
286 EXPECT_CALL(*gl_
, BlendEquationSeparate(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
));
287 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(true);
288 cmds::BlendEquationSeparate cmd
;
289 cmd
.Init(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
);
290 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
291 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
294 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs0_0
) {
295 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
296 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
297 cmds::BlendEquationSeparate cmd
;
298 cmd
.Init(GL_MIN
, GL_FUNC_ADD
);
299 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
300 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
303 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs0_1
) {
304 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
305 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
306 cmds::BlendEquationSeparate cmd
;
307 cmd
.Init(GL_MAX
, GL_FUNC_ADD
);
308 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
309 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
312 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs1_0
) {
313 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
314 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
315 cmds::BlendEquationSeparate cmd
;
316 cmd
.Init(GL_FUNC_SUBTRACT
, GL_MIN
);
317 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
318 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
321 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs1_1
) {
322 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
323 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
324 cmds::BlendEquationSeparate cmd
;
325 cmd
.Init(GL_FUNC_SUBTRACT
, GL_MAX
);
326 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
327 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
330 TEST_P(GLES2DecoderTest1
, BlendFuncValidArgs
) {
331 EXPECT_CALL(*gl_
, BlendFunc(GL_ZERO
, GL_ZERO
));
332 SpecializedSetup
<cmds::BlendFunc
, 0>(true);
334 cmd
.Init(GL_ZERO
, GL_ZERO
);
335 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
336 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
339 TEST_P(GLES2DecoderTest1
, BlendFuncSeparateValidArgs
) {
340 EXPECT_CALL(*gl_
, BlendFuncSeparate(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
));
341 SpecializedSetup
<cmds::BlendFuncSeparate
, 0>(true);
342 cmds::BlendFuncSeparate cmd
;
343 cmd
.Init(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
);
344 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
345 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
347 // TODO(gman): BufferData
349 // TODO(gman): BufferSubData
351 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusValidArgs
) {
352 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
));
353 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(true);
354 cmds::CheckFramebufferStatus cmd
;
355 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
356 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
357 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
360 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgs0_0
) {
361 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(_
)).Times(0);
362 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
363 cmds::CheckFramebufferStatus cmd
;
364 cmd
.Init(GL_DRAW_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
365 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
366 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
369 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgs0_1
) {
370 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(_
)).Times(0);
371 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
372 cmds::CheckFramebufferStatus cmd
;
373 cmd
.Init(GL_READ_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
374 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
375 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
378 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgsBadSharedMemoryId
) {
379 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
)).Times(0);
380 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
381 cmds::CheckFramebufferStatus cmd
;
382 cmd
.Init(GL_FRAMEBUFFER
, kInvalidSharedMemoryId
, shared_memory_offset_
);
383 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
384 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
385 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
388 TEST_P(GLES2DecoderTest1
, ClearValidArgs
) {
389 EXPECT_CALL(*gl_
, Clear(1));
390 SpecializedSetup
<cmds::Clear
, 0>(true);
393 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
394 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
397 TEST_P(GLES2DecoderTest1
, ClearBufferfiValidArgs
) {
398 EXPECT_CALL(*gl_
, ClearBufferfi(GL_COLOR
, 2, 3, 4));
399 SpecializedSetup
<cmds::ClearBufferfi
, 0>(true);
400 cmds::ClearBufferfi cmd
;
401 cmd
.Init(GL_COLOR
, 2, 3, 4);
402 decoder_
->set_unsafe_es3_apis_enabled(true);
403 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
404 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
405 decoder_
->set_unsafe_es3_apis_enabled(false);
406 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
409 TEST_P(GLES2DecoderTest1
, ClearBufferfvImmediateValidArgs
) {
410 cmds::ClearBufferfvImmediate
& cmd
=
411 *GetImmediateAs
<cmds::ClearBufferfvImmediate
>();
412 SpecializedSetup
<cmds::ClearBufferfvImmediate
, 0>(true);
416 cmd
.Init(GL_COLOR
, 2, &temp
[0]);
418 ClearBufferfv(GL_COLOR
, 2, reinterpret_cast<GLfloat
*>(
419 ImmediateDataAddress(&cmd
))));
420 decoder_
->set_unsafe_es3_apis_enabled(true);
421 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
422 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
423 decoder_
->set_unsafe_es3_apis_enabled(false);
424 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
427 TEST_P(GLES2DecoderTest1
, ClearBufferivImmediateValidArgs
) {
428 cmds::ClearBufferivImmediate
& cmd
=
429 *GetImmediateAs
<cmds::ClearBufferivImmediate
>();
430 SpecializedSetup
<cmds::ClearBufferivImmediate
, 0>(true);
434 cmd
.Init(GL_COLOR
, 2, &temp
[0]);
435 EXPECT_CALL(*gl_
, ClearBufferiv(
437 reinterpret_cast<GLint
*>(ImmediateDataAddress(&cmd
))));
438 decoder_
->set_unsafe_es3_apis_enabled(true);
439 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
440 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
441 decoder_
->set_unsafe_es3_apis_enabled(false);
442 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
445 TEST_P(GLES2DecoderTest1
, ClearBufferuivImmediateValidArgs
) {
446 cmds::ClearBufferuivImmediate
& cmd
=
447 *GetImmediateAs
<cmds::ClearBufferuivImmediate
>();
448 SpecializedSetup
<cmds::ClearBufferuivImmediate
, 0>(true);
452 cmd
.Init(GL_COLOR
, 2, &temp
[0]);
453 EXPECT_CALL(*gl_
, ClearBufferuiv(
455 reinterpret_cast<GLuint
*>(ImmediateDataAddress(&cmd
))));
456 decoder_
->set_unsafe_es3_apis_enabled(true);
457 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
458 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
459 decoder_
->set_unsafe_es3_apis_enabled(false);
460 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
463 TEST_P(GLES2DecoderTest1
, ClearColorValidArgs
) {
464 EXPECT_CALL(*gl_
, ClearColor(1, 2, 3, 4));
465 SpecializedSetup
<cmds::ClearColor
, 0>(true);
466 cmds::ClearColor cmd
;
467 cmd
.Init(1, 2, 3, 4);
468 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
469 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
472 TEST_P(GLES2DecoderTest1
, ClearDepthfValidArgs
) {
473 EXPECT_CALL(*gl_
, ClearDepth(0.5f
));
474 SpecializedSetup
<cmds::ClearDepthf
, 0>(true);
475 cmds::ClearDepthf cmd
;
477 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
478 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
481 TEST_P(GLES2DecoderTest1
, ClearStencilValidArgs
) {
482 EXPECT_CALL(*gl_
, ClearStencil(1));
483 SpecializedSetup
<cmds::ClearStencil
, 0>(true);
484 cmds::ClearStencil cmd
;
486 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
487 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
490 TEST_P(GLES2DecoderTest1
, ColorMaskValidArgs
) {
491 SpecializedSetup
<cmds::ColorMask
, 0>(true);
493 cmd
.Init(true, true, true, true);
494 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
495 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
497 // TODO(gman): CompileShader
498 // TODO(gman): CompressedTexImage2DBucket
499 // TODO(gman): CompressedTexImage2D
501 // TODO(gman): CompressedTexSubImage2DBucket
502 // TODO(gman): CompressedTexSubImage2D
504 TEST_P(GLES2DecoderTest1
, CopyBufferSubDataValidArgs
) {
506 CopyBufferSubData(GL_ARRAY_BUFFER
, GL_ARRAY_BUFFER
, 3, 4, 5));
507 SpecializedSetup
<cmds::CopyBufferSubData
, 0>(true);
508 cmds::CopyBufferSubData cmd
;
509 cmd
.Init(GL_ARRAY_BUFFER
, GL_ARRAY_BUFFER
, 3, 4, 5);
510 decoder_
->set_unsafe_es3_apis_enabled(true);
511 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
512 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
513 decoder_
->set_unsafe_es3_apis_enabled(false);
514 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
516 // TODO(gman): CopyTexImage2D
518 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DValidArgs
) {
519 EXPECT_CALL(*gl_
, CopyTexSubImage2D(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8));
520 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(true);
521 cmds::CopyTexSubImage2D cmd
;
522 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8);
523 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
524 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
527 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs0_0
) {
528 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
529 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
530 cmds::CopyTexSubImage2D cmd
;
531 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, 2, 3, 4, 5, 6, 7, 8);
532 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
533 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
536 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs6_0
) {
537 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
538 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
539 cmds::CopyTexSubImage2D cmd
;
540 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, -1, 8);
541 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
542 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
545 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs7_0
) {
546 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
547 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
548 cmds::CopyTexSubImage2D cmd
;
549 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, -1);
550 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
551 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
554 TEST_P(GLES2DecoderTest1
, CopyTexSubImage3DValidArgs
) {
555 EXPECT_CALL(*gl_
, CopyTexSubImage3D(GL_TEXTURE_3D
, 2, 3, 4, 5, 6, 7, 8, 9));
556 SpecializedSetup
<cmds::CopyTexSubImage3D
, 0>(true);
557 cmds::CopyTexSubImage3D cmd
;
558 cmd
.Init(GL_TEXTURE_3D
, 2, 3, 4, 5, 6, 7, 8, 9);
559 decoder_
->set_unsafe_es3_apis_enabled(true);
560 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
561 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
562 decoder_
->set_unsafe_es3_apis_enabled(false);
563 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
566 TEST_P(GLES2DecoderTest1
, CreateProgramValidArgs
) {
567 EXPECT_CALL(*gl_
, CreateProgram()).WillOnce(Return(kNewServiceId
));
568 SpecializedSetup
<cmds::CreateProgram
, 0>(true);
569 cmds::CreateProgram cmd
;
570 cmd
.Init(kNewClientId
);
571 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
572 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
573 EXPECT_TRUE(GetProgram(kNewClientId
));
576 TEST_P(GLES2DecoderTest1
, CreateShaderValidArgs
) {
577 EXPECT_CALL(*gl_
, CreateShader(GL_VERTEX_SHADER
))
578 .WillOnce(Return(kNewServiceId
));
579 SpecializedSetup
<cmds::CreateShader
, 0>(true);
580 cmds::CreateShader cmd
;
581 cmd
.Init(GL_VERTEX_SHADER
, kNewClientId
);
582 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
583 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
584 EXPECT_TRUE(GetShader(kNewClientId
));
587 TEST_P(GLES2DecoderTest1
, CreateShaderInvalidArgs0_0
) {
588 EXPECT_CALL(*gl_
, CreateShader(_
)).Times(0);
589 SpecializedSetup
<cmds::CreateShader
, 0>(false);
590 cmds::CreateShader cmd
;
591 cmd
.Init(GL_GEOMETRY_SHADER
, kNewClientId
);
592 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
593 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
596 TEST_P(GLES2DecoderTest1
, CullFaceValidArgs
) {
597 EXPECT_CALL(*gl_
, CullFace(GL_FRONT
));
598 SpecializedSetup
<cmds::CullFace
, 0>(true);
601 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
602 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
605 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateValidArgs
) {
606 EXPECT_CALL(*gl_
, DeleteBuffersARB(1, Pointee(kServiceBufferId
))).Times(1);
607 cmds::DeleteBuffersImmediate
& cmd
=
608 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
609 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(true);
610 cmd
.Init(1, &client_buffer_id_
);
611 EXPECT_EQ(error::kNoError
,
612 ExecuteImmediateCmd(cmd
, sizeof(client_buffer_id_
)));
613 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
614 EXPECT_TRUE(GetBuffer(client_buffer_id_
) == NULL
);
617 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateInvalidArgs
) {
618 cmds::DeleteBuffersImmediate
& cmd
=
619 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
620 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(false);
621 GLuint temp
= kInvalidClientId
;
623 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
626 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateValidArgs
) {
627 EXPECT_CALL(*gl_
, DeleteFramebuffersEXT(1, Pointee(kServiceFramebufferId
)))
629 cmds::DeleteFramebuffersImmediate
& cmd
=
630 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
631 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(true);
632 cmd
.Init(1, &client_framebuffer_id_
);
633 EXPECT_EQ(error::kNoError
,
634 ExecuteImmediateCmd(cmd
, sizeof(client_framebuffer_id_
)));
635 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
636 EXPECT_TRUE(GetFramebuffer(client_framebuffer_id_
) == NULL
);
639 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateInvalidArgs
) {
640 cmds::DeleteFramebuffersImmediate
& cmd
=
641 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
642 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(false);
643 GLuint temp
= kInvalidClientId
;
645 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
648 TEST_P(GLES2DecoderTest1
, DeleteProgramValidArgs
) {
649 EXPECT_CALL(*gl_
, DeleteProgram(kServiceProgramId
));
650 SpecializedSetup
<cmds::DeleteProgram
, 0>(true);
651 cmds::DeleteProgram cmd
;
652 cmd
.Init(client_program_id_
);
653 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
654 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
657 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateValidArgs
) {
658 EXPECT_CALL(*gl_
, DeleteRenderbuffersEXT(1, Pointee(kServiceRenderbufferId
)))
660 cmds::DeleteRenderbuffersImmediate
& cmd
=
661 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
662 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(true);
663 cmd
.Init(1, &client_renderbuffer_id_
);
664 EXPECT_EQ(error::kNoError
,
665 ExecuteImmediateCmd(cmd
, sizeof(client_renderbuffer_id_
)));
666 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
667 EXPECT_TRUE(GetRenderbuffer(client_renderbuffer_id_
) == NULL
);
670 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateInvalidArgs
) {
671 cmds::DeleteRenderbuffersImmediate
& cmd
=
672 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
673 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(false);
674 GLuint temp
= kInvalidClientId
;
676 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
679 TEST_P(GLES2DecoderTest1
, DeleteSamplersImmediateValidArgs
) {
680 EXPECT_CALL(*gl_
, DeleteSamplers(1, Pointee(kServiceSamplerId
))).Times(1);
681 cmds::DeleteSamplersImmediate
& cmd
=
682 *GetImmediateAs
<cmds::DeleteSamplersImmediate
>();
683 SpecializedSetup
<cmds::DeleteSamplersImmediate
, 0>(true);
684 cmd
.Init(1, &client_sampler_id_
);
685 decoder_
->set_unsafe_es3_apis_enabled(true);
686 EXPECT_EQ(error::kNoError
,
687 ExecuteImmediateCmd(cmd
, sizeof(client_sampler_id_
)));
688 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
689 EXPECT_FALSE(GetSamplerServiceId(client_sampler_id_
, NULL
));
690 decoder_
->set_unsafe_es3_apis_enabled(false);
691 EXPECT_EQ(error::kUnknownCommand
,
692 ExecuteImmediateCmd(cmd
, sizeof(client_sampler_id_
)));
695 TEST_P(GLES2DecoderTest1
, DeleteSamplersImmediateInvalidArgs
) {
696 cmds::DeleteSamplersImmediate
& cmd
=
697 *GetImmediateAs
<cmds::DeleteSamplersImmediate
>();
698 SpecializedSetup
<cmds::DeleteSamplersImmediate
, 0>(false);
699 GLuint temp
= kInvalidClientId
;
701 decoder_
->set_unsafe_es3_apis_enabled(true);
702 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
703 decoder_
->set_unsafe_es3_apis_enabled(false);
704 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
707 TEST_P(GLES2DecoderTest1
, DeleteSyncValidArgs
) {
708 EXPECT_CALL(*gl_
, DeleteSync(reinterpret_cast<GLsync
>(kServiceSyncId
)));
709 SpecializedSetup
<cmds::DeleteSync
, 0>(true);
710 cmds::DeleteSync cmd
;
711 cmd
.Init(client_sync_id_
);
712 decoder_
->set_unsafe_es3_apis_enabled(true);
713 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
714 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
715 decoder_
->set_unsafe_es3_apis_enabled(false);
716 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
719 TEST_P(GLES2DecoderTest1
, DeleteShaderValidArgs
) {
720 EXPECT_CALL(*gl_
, DeleteShader(kServiceShaderId
));
721 SpecializedSetup
<cmds::DeleteShader
, 0>(true);
722 cmds::DeleteShader cmd
;
723 cmd
.Init(client_shader_id_
);
724 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
725 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
728 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateValidArgs
) {
729 EXPECT_CALL(*gl_
, DeleteTextures(1, Pointee(kServiceTextureId
))).Times(1);
730 cmds::DeleteTexturesImmediate
& cmd
=
731 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
732 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(true);
733 cmd
.Init(1, &client_texture_id_
);
734 EXPECT_EQ(error::kNoError
,
735 ExecuteImmediateCmd(cmd
, sizeof(client_texture_id_
)));
736 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
737 EXPECT_TRUE(GetTexture(client_texture_id_
) == NULL
);
740 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateInvalidArgs
) {
741 cmds::DeleteTexturesImmediate
& cmd
=
742 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
743 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(false);
744 GLuint temp
= kInvalidClientId
;
746 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
749 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateValidArgs
) {
750 EXPECT_CALL(*gl_
, DeleteTransformFeedbacks(
751 1, Pointee(kServiceTransformFeedbackId
))).Times(1);
752 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
753 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
754 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(true);
755 cmd
.Init(1, &client_transformfeedback_id_
);
756 decoder_
->set_unsafe_es3_apis_enabled(true);
757 EXPECT_EQ(error::kNoError
,
758 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
759 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
761 GetTransformFeedbackServiceId(client_transformfeedback_id_
, NULL
));
762 decoder_
->set_unsafe_es3_apis_enabled(false);
763 EXPECT_EQ(error::kUnknownCommand
,
764 ExecuteImmediateCmd(cmd
, sizeof(client_transformfeedback_id_
)));
767 TEST_P(GLES2DecoderTest1
, DeleteTransformFeedbacksImmediateInvalidArgs
) {
768 cmds::DeleteTransformFeedbacksImmediate
& cmd
=
769 *GetImmediateAs
<cmds::DeleteTransformFeedbacksImmediate
>();
770 SpecializedSetup
<cmds::DeleteTransformFeedbacksImmediate
, 0>(false);
771 GLuint temp
= kInvalidClientId
;
773 decoder_
->set_unsafe_es3_apis_enabled(true);
774 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
775 decoder_
->set_unsafe_es3_apis_enabled(false);
776 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
779 TEST_P(GLES2DecoderTest1
, DepthFuncValidArgs
) {
780 EXPECT_CALL(*gl_
, DepthFunc(GL_NEVER
));
781 SpecializedSetup
<cmds::DepthFunc
, 0>(true);
784 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
785 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
788 TEST_P(GLES2DecoderTest1
, DepthMaskValidArgs
) {
789 SpecializedSetup
<cmds::DepthMask
, 0>(true);
792 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
793 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
796 TEST_P(GLES2DecoderTest1
, DepthRangefValidArgs
) {
797 EXPECT_CALL(*gl_
, DepthRange(1, 2));
798 SpecializedSetup
<cmds::DepthRangef
, 0>(true);
799 cmds::DepthRangef cmd
;
801 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
802 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
805 TEST_P(GLES2DecoderTest1
, DetachShaderValidArgs
) {
806 EXPECT_CALL(*gl_
, DetachShader(kServiceProgramId
, kServiceShaderId
));
807 SpecializedSetup
<cmds::DetachShader
, 0>(true);
808 cmds::DetachShader cmd
;
809 cmd
.Init(client_program_id_
, client_shader_id_
);
810 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
811 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
814 TEST_P(GLES2DecoderTest1
, DisableValidArgs
) {
815 SetupExpectationsForEnableDisable(GL_BLEND
, false);
816 SpecializedSetup
<cmds::Disable
, 0>(true);
819 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
820 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
823 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_0
) {
824 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
825 SpecializedSetup
<cmds::Disable
, 0>(false);
827 cmd
.Init(GL_CLIP_PLANE0
);
828 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
829 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
832 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_1
) {
833 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
834 SpecializedSetup
<cmds::Disable
, 0>(false);
836 cmd
.Init(GL_POINT_SPRITE
);
837 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
838 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
841 TEST_P(GLES2DecoderTest1
, DisableVertexAttribArrayValidArgs
) {
842 EXPECT_CALL(*gl_
, DisableVertexAttribArray(1));
843 SpecializedSetup
<cmds::DisableVertexAttribArray
, 0>(true);
844 cmds::DisableVertexAttribArray cmd
;
846 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
847 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
849 // TODO(gman): DrawArrays
851 // TODO(gman): DrawElements
853 TEST_P(GLES2DecoderTest1
, EnableValidArgs
) {
854 SetupExpectationsForEnableDisable(GL_BLEND
, true);
855 SpecializedSetup
<cmds::Enable
, 0>(true);
858 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
859 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
862 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_0
) {
863 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
864 SpecializedSetup
<cmds::Enable
, 0>(false);
866 cmd
.Init(GL_CLIP_PLANE0
);
867 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
868 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
871 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_1
) {
872 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
873 SpecializedSetup
<cmds::Enable
, 0>(false);
875 cmd
.Init(GL_POINT_SPRITE
);
876 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
877 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
880 TEST_P(GLES2DecoderTest1
, EnableVertexAttribArrayValidArgs
) {
881 EXPECT_CALL(*gl_
, EnableVertexAttribArray(1));
882 SpecializedSetup
<cmds::EnableVertexAttribArray
, 0>(true);
883 cmds::EnableVertexAttribArray cmd
;
885 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
886 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
889 TEST_P(GLES2DecoderTest1
, FenceSyncValidArgs
) {
890 const GLsync kNewServiceIdGLuint
= reinterpret_cast<GLsync
>(kNewServiceId
);
891 EXPECT_CALL(*gl_
, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE
, 0))
892 .WillOnce(Return(kNewServiceIdGLuint
));
893 SpecializedSetup
<cmds::FenceSync
, 0>(true);
895 cmd
.Init(kNewClientId
);
896 decoder_
->set_unsafe_es3_apis_enabled(true);
897 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
898 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
899 GLsync service_id
= 0;
900 EXPECT_TRUE(GetSyncServiceId(kNewClientId
, &service_id
));
901 EXPECT_EQ(kNewServiceIdGLuint
, service_id
);
902 decoder_
->set_unsafe_es3_apis_enabled(false);
903 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
906 TEST_P(GLES2DecoderTest1
, FinishValidArgs
) {
907 EXPECT_CALL(*gl_
, Finish());
908 SpecializedSetup
<cmds::Finish
, 0>(true);
911 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
912 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
915 TEST_P(GLES2DecoderTest1
, FlushValidArgs
) {
916 EXPECT_CALL(*gl_
, Flush());
917 SpecializedSetup
<cmds::Flush
, 0>(true);
920 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
921 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
924 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferValidArgs
) {
925 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(
926 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
927 kServiceRenderbufferId
));
928 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(true);
929 cmds::FramebufferRenderbuffer cmd
;
930 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
931 client_renderbuffer_id_
);
932 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
933 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
936 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_0
) {
937 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
938 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
939 cmds::FramebufferRenderbuffer cmd
;
940 cmd
.Init(GL_DRAW_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
941 client_renderbuffer_id_
);
942 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
943 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
946 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_1
) {
947 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
948 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
949 cmds::FramebufferRenderbuffer cmd
;
950 cmd
.Init(GL_READ_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_RENDERBUFFER
,
951 client_renderbuffer_id_
);
952 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
953 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
956 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs2_0
) {
957 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
958 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
959 cmds::FramebufferRenderbuffer cmd
;
960 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_FRAMEBUFFER
,
961 client_renderbuffer_id_
);
962 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
963 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
966 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DValidArgs
) {
968 FramebufferTexture2DEXT(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
969 GL_TEXTURE_2D
, kServiceTextureId
, 0));
970 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(true);
971 cmds::FramebufferTexture2D cmd
;
972 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
974 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
975 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
978 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_0
) {
979 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
980 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
981 cmds::FramebufferTexture2D cmd
;
982 cmd
.Init(GL_DRAW_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
984 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
985 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
988 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_1
) {
989 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
990 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
991 cmds::FramebufferTexture2D cmd
;
992 cmd
.Init(GL_READ_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
,
994 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
995 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
998 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs2_0
) {
999 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
1000 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
1001 cmds::FramebufferTexture2D cmd
;
1002 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_PROXY_TEXTURE_CUBE_MAP
,
1003 client_texture_id_
);
1004 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1005 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1008 TEST_P(GLES2DecoderTest1
, FramebufferTextureLayerValidArgs
) {
1010 FramebufferTextureLayer(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1011 kServiceTextureId
, 4, 5));
1012 SpecializedSetup
<cmds::FramebufferTextureLayer
, 0>(true);
1013 cmds::FramebufferTextureLayer cmd
;
1014 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, client_texture_id_
, 4, 5);
1015 decoder_
->set_unsafe_es3_apis_enabled(true);
1016 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1017 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1018 decoder_
->set_unsafe_es3_apis_enabled(false);
1019 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1022 TEST_P(GLES2DecoderTest1
, FrontFaceValidArgs
) {
1023 EXPECT_CALL(*gl_
, FrontFace(GL_CW
));
1024 SpecializedSetup
<cmds::FrontFace
, 0>(true);
1025 cmds::FrontFace cmd
;
1027 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1028 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1031 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateValidArgs
) {
1032 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
1033 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1034 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
1035 GLuint temp
= kNewClientId
;
1036 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(true);
1037 cmd
->Init(1, &temp
);
1038 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1039 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1040 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
1043 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateInvalidArgs
) {
1044 EXPECT_CALL(*gl_
, GenBuffersARB(_
, _
)).Times(0);
1045 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
1046 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(false);
1047 cmd
->Init(1, &client_buffer_id_
);
1048 EXPECT_EQ(error::kInvalidArguments
,
1049 ExecuteImmediateCmd(*cmd
, sizeof(&client_buffer_id_
)));
1052 TEST_P(GLES2DecoderTest1
, GenerateMipmapValidArgs
) {
1053 EXPECT_CALL(*gl_
, GenerateMipmapEXT(GL_TEXTURE_2D
));
1054 SpecializedSetup
<cmds::GenerateMipmap
, 0>(true);
1055 cmds::GenerateMipmap cmd
;
1056 cmd
.Init(GL_TEXTURE_2D
);
1057 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1058 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1061 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_0
) {
1062 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
1063 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
1064 cmds::GenerateMipmap cmd
;
1065 cmd
.Init(GL_TEXTURE_1D
);
1066 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1067 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1070 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_1
) {
1071 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
1072 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
1073 cmds::GenerateMipmap cmd
;
1074 cmd
.Init(GL_TEXTURE_3D
);
1075 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1076 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1079 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateValidArgs
) {
1080 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
1081 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1082 cmds::GenFramebuffersImmediate
* cmd
=
1083 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
1084 GLuint temp
= kNewClientId
;
1085 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(true);
1086 cmd
->Init(1, &temp
);
1087 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1088 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1089 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
1092 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateInvalidArgs
) {
1093 EXPECT_CALL(*gl_
, GenFramebuffersEXT(_
, _
)).Times(0);
1094 cmds::GenFramebuffersImmediate
* cmd
=
1095 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
1096 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(false);
1097 cmd
->Init(1, &client_framebuffer_id_
);
1098 EXPECT_EQ(error::kInvalidArguments
,
1099 ExecuteImmediateCmd(*cmd
, sizeof(&client_framebuffer_id_
)));
1102 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateValidArgs
) {
1103 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
1104 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1105 cmds::GenRenderbuffersImmediate
* cmd
=
1106 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
1107 GLuint temp
= kNewClientId
;
1108 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(true);
1109 cmd
->Init(1, &temp
);
1110 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1111 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1112 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
1115 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateInvalidArgs
) {
1116 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(_
, _
)).Times(0);
1117 cmds::GenRenderbuffersImmediate
* cmd
=
1118 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
1119 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(false);
1120 cmd
->Init(1, &client_renderbuffer_id_
);
1121 EXPECT_EQ(error::kInvalidArguments
,
1122 ExecuteImmediateCmd(*cmd
, sizeof(&client_renderbuffer_id_
)));
1125 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateValidArgs
) {
1126 EXPECT_CALL(*gl_
, GenSamplers(1, _
))
1127 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1128 cmds::GenSamplersImmediate
* cmd
=
1129 GetImmediateAs
<cmds::GenSamplersImmediate
>();
1130 GLuint temp
= kNewClientId
;
1131 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(true);
1132 decoder_
->set_unsafe_es3_apis_enabled(true);
1133 cmd
->Init(1, &temp
);
1134 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1135 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1137 EXPECT_TRUE(GetSamplerServiceId(kNewClientId
, &service_id
));
1138 EXPECT_EQ(kNewServiceId
, service_id
);
1139 decoder_
->set_unsafe_es3_apis_enabled(false);
1140 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1143 TEST_P(GLES2DecoderTest1
, GenSamplersImmediateInvalidArgs
) {
1144 EXPECT_CALL(*gl_
, GenSamplers(_
, _
)).Times(0);
1145 cmds::GenSamplersImmediate
* cmd
=
1146 GetImmediateAs
<cmds::GenSamplersImmediate
>();
1147 SpecializedSetup
<cmds::GenSamplersImmediate
, 0>(false);
1148 cmd
->Init(1, &client_sampler_id_
);
1149 decoder_
->set_unsafe_es3_apis_enabled(true);
1150 EXPECT_EQ(error::kInvalidArguments
,
1151 ExecuteImmediateCmd(*cmd
, sizeof(&client_sampler_id_
)));
1152 decoder_
->set_unsafe_es3_apis_enabled(false);
1155 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateValidArgs
) {
1156 EXPECT_CALL(*gl_
, GenTextures(1, _
))
1157 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1158 cmds::GenTexturesImmediate
* cmd
=
1159 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1160 GLuint temp
= kNewClientId
;
1161 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(true);
1162 cmd
->Init(1, &temp
);
1163 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1164 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1165 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
1168 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateInvalidArgs
) {
1169 EXPECT_CALL(*gl_
, GenTextures(_
, _
)).Times(0);
1170 cmds::GenTexturesImmediate
* cmd
=
1171 GetImmediateAs
<cmds::GenTexturesImmediate
>();
1172 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(false);
1173 cmd
->Init(1, &client_texture_id_
);
1174 EXPECT_EQ(error::kInvalidArguments
,
1175 ExecuteImmediateCmd(*cmd
, sizeof(&client_texture_id_
)));
1178 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateValidArgs
) {
1179 EXPECT_CALL(*gl_
, GenTransformFeedbacks(1, _
))
1180 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
1181 cmds::GenTransformFeedbacksImmediate
* cmd
=
1182 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1183 GLuint temp
= kNewClientId
;
1184 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(true);
1185 decoder_
->set_unsafe_es3_apis_enabled(true);
1186 cmd
->Init(1, &temp
);
1187 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1188 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1190 EXPECT_TRUE(GetTransformFeedbackServiceId(kNewClientId
, &service_id
));
1191 EXPECT_EQ(kNewServiceId
, service_id
);
1192 decoder_
->set_unsafe_es3_apis_enabled(false);
1193 EXPECT_EQ(error::kUnknownCommand
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
1196 TEST_P(GLES2DecoderTest1
, GenTransformFeedbacksImmediateInvalidArgs
) {
1197 EXPECT_CALL(*gl_
, GenTransformFeedbacks(_
, _
)).Times(0);
1198 cmds::GenTransformFeedbacksImmediate
* cmd
=
1199 GetImmediateAs
<cmds::GenTransformFeedbacksImmediate
>();
1200 SpecializedSetup
<cmds::GenTransformFeedbacksImmediate
, 0>(false);
1201 cmd
->Init(1, &client_transformfeedback_id_
);
1202 decoder_
->set_unsafe_es3_apis_enabled(true);
1203 EXPECT_EQ(error::kInvalidArguments
,
1204 ExecuteImmediateCmd(*cmd
, sizeof(&client_transformfeedback_id_
)));
1205 decoder_
->set_unsafe_es3_apis_enabled(false);
1207 // TODO(gman): GetActiveAttrib
1209 // TODO(gman): GetActiveUniform
1211 // TODO(gman): GetAttachedShaders
1213 // TODO(gman): GetAttribLocation
1215 TEST_P(GLES2DecoderTest1
, GetBooleanvValidArgs
) {
1216 EXPECT_CALL(*gl_
, GetError())
1217 .WillOnce(Return(GL_NO_ERROR
))
1218 .WillOnce(Return(GL_NO_ERROR
))
1219 .RetiresOnSaturation();
1220 SpecializedSetup
<cmds::GetBooleanv
, 0>(true);
1221 typedef cmds::GetBooleanv::Result Result
;
1222 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1223 EXPECT_CALL(*gl_
, GetBooleanv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1225 cmds::GetBooleanv cmd
;
1226 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1227 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1228 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1229 result
->GetNumResults());
1230 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1233 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs0_0
) {
1234 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1235 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1236 cmds::GetBooleanv::Result
* result
=
1237 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1239 cmds::GetBooleanv cmd
;
1240 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, 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
, GetBooleanvInvalidArgs1_0
) {
1247 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1248 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1249 cmds::GetBooleanv::Result
* result
=
1250 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1252 cmds::GetBooleanv cmd
;
1253 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1254 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1255 EXPECT_EQ(0u, result
->size
);
1258 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_1
) {
1259 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
1260 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
1261 cmds::GetBooleanv::Result
* result
=
1262 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
1264 cmds::GetBooleanv cmd
;
1265 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1266 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1267 EXPECT_EQ(0u, result
->size
);
1270 TEST_P(GLES2DecoderTest1
, GetBufferParameterivValidArgs
) {
1271 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(true);
1272 typedef cmds::GetBufferParameteriv::Result Result
;
1273 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1275 cmds::GetBufferParameteriv cmd
;
1276 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1277 shared_memory_offset_
);
1278 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1279 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
1280 result
->GetNumResults());
1281 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1284 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs0_0
) {
1285 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1286 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1287 cmds::GetBufferParameteriv::Result
* result
=
1288 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1290 cmds::GetBufferParameteriv cmd
;
1291 cmd
.Init(GL_RENDERBUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1292 shared_memory_offset_
);
1293 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1294 EXPECT_EQ(0u, result
->size
);
1295 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1298 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs1_0
) {
1299 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1300 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1301 cmds::GetBufferParameteriv::Result
* result
=
1302 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1304 cmds::GetBufferParameteriv cmd
;
1305 cmd
.Init(GL_ARRAY_BUFFER
, GL_PIXEL_PACK_BUFFER
, shared_memory_id_
,
1306 shared_memory_offset_
);
1307 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1308 EXPECT_EQ(0u, result
->size
);
1309 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1312 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_0
) {
1313 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1314 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1315 cmds::GetBufferParameteriv::Result
* result
=
1316 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1318 cmds::GetBufferParameteriv cmd
;
1319 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, kInvalidSharedMemoryId
, 0);
1320 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1321 EXPECT_EQ(0u, result
->size
);
1324 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_1
) {
1325 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1326 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1327 cmds::GetBufferParameteriv::Result
* result
=
1328 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1330 cmds::GetBufferParameteriv cmd
;
1331 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, shared_memory_id_
,
1332 kInvalidSharedMemoryOffset
);
1333 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1334 EXPECT_EQ(0u, result
->size
);
1337 TEST_P(GLES2DecoderTest1
, GetErrorValidArgs
) {
1338 EXPECT_CALL(*gl_
, GetError());
1339 SpecializedSetup
<cmds::GetError
, 0>(true);
1341 cmd
.Init(shared_memory_id_
, shared_memory_offset_
);
1342 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1343 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1346 TEST_P(GLES2DecoderTest1
, GetErrorInvalidArgsBadSharedMemoryId
) {
1347 EXPECT_CALL(*gl_
, GetError()).Times(0);
1348 SpecializedSetup
<cmds::GetError
, 0>(false);
1350 cmd
.Init(kInvalidSharedMemoryId
, shared_memory_offset_
);
1351 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1352 cmd
.Init(shared_memory_id_
, kInvalidSharedMemoryOffset
);
1353 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1356 TEST_P(GLES2DecoderTest1
, GetFloatvValidArgs
) {
1357 EXPECT_CALL(*gl_
, GetError())
1358 .WillOnce(Return(GL_NO_ERROR
))
1359 .WillOnce(Return(GL_NO_ERROR
))
1360 .RetiresOnSaturation();
1361 SpecializedSetup
<cmds::GetFloatv
, 0>(true);
1362 typedef cmds::GetFloatv::Result Result
;
1363 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1364 EXPECT_CALL(*gl_
, GetFloatv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1366 cmds::GetFloatv cmd
;
1367 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1368 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1369 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1370 result
->GetNumResults());
1371 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1374 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs0_0
) {
1375 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1376 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1377 cmds::GetFloatv::Result
* result
=
1378 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1380 cmds::GetFloatv cmd
;
1381 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1382 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1383 EXPECT_EQ(0u, result
->size
);
1384 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1387 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_0
) {
1388 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1389 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1390 cmds::GetFloatv::Result
* result
=
1391 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1393 cmds::GetFloatv cmd
;
1394 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1395 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1396 EXPECT_EQ(0u, result
->size
);
1399 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_1
) {
1400 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1401 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1402 cmds::GetFloatv::Result
* result
=
1403 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1405 cmds::GetFloatv cmd
;
1406 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1407 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1408 EXPECT_EQ(0u, result
->size
);
1410 // TODO(gman): GetFragDataLocation
1412 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivValidArgs
) {
1413 EXPECT_CALL(*gl_
, GetError())
1414 .WillOnce(Return(GL_NO_ERROR
))
1415 .WillOnce(Return(GL_NO_ERROR
))
1416 .RetiresOnSaturation();
1417 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(true);
1418 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
1419 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1421 GetFramebufferAttachmentParameterivEXT(
1422 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1423 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, result
->GetData()));
1425 cmds::GetFramebufferAttachmentParameteriv cmd
;
1426 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1427 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1428 shared_memory_offset_
);
1429 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1430 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1431 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
),
1432 result
->GetNumResults());
1433 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1436 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_0
) {
1437 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1439 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1440 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1441 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1442 shared_memory_address_
);
1444 cmds::GetFramebufferAttachmentParameteriv cmd
;
1445 cmd
.Init(GL_DRAW_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1446 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1447 shared_memory_offset_
);
1448 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1449 EXPECT_EQ(0u, result
->size
);
1450 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1453 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_1
) {
1454 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1456 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1457 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1458 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1459 shared_memory_address_
);
1461 cmds::GetFramebufferAttachmentParameteriv cmd
;
1462 cmd
.Init(GL_READ_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1463 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1464 shared_memory_offset_
);
1465 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1466 EXPECT_EQ(0u, result
->size
);
1467 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1470 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_0
) {
1471 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1473 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1474 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1475 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1476 shared_memory_address_
);
1478 cmds::GetFramebufferAttachmentParameteriv cmd
;
1479 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1480 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, kInvalidSharedMemoryId
, 0);
1481 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1482 EXPECT_EQ(0u, result
->size
);
1485 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_1
) {
1486 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1488 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1489 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1490 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1491 shared_memory_address_
);
1493 cmds::GetFramebufferAttachmentParameteriv cmd
;
1494 cmd
.Init(GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
,
1495 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
, shared_memory_id_
,
1496 kInvalidSharedMemoryOffset
);
1497 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1498 EXPECT_EQ(0u, result
->size
);
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
);
1556 TEST_P(GLES2DecoderTest1
, GetInternalformativValidArgs
) {
1557 EXPECT_CALL(*gl_
, GetError())
1558 .WillOnce(Return(GL_NO_ERROR
))
1559 .WillOnce(Return(GL_NO_ERROR
))
1560 .RetiresOnSaturation();
1561 SpecializedSetup
<cmds::GetInternalformativ
, 0>(true);
1562 typedef cmds::GetInternalformativ::Result Result
;
1563 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1564 EXPECT_CALL(*gl_
, GetInternalformativ(GL_RENDERBUFFER
, GL_RGBA4
,
1565 GL_RENDERBUFFER_RED_SIZE
, 4,
1566 result
->GetData()));
1568 cmds::GetInternalformativ cmd
;
1569 cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, GL_RENDERBUFFER_RED_SIZE
, 4,
1570 shared_memory_id_
, shared_memory_offset_
);
1571 decoder_
->set_unsafe_es3_apis_enabled(true);
1572 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1573 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1574 GL_RENDERBUFFER_RED_SIZE
),
1575 result
->GetNumResults());
1576 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1577 decoder_
->set_unsafe_es3_apis_enabled(false);
1578 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1581 TEST_P(GLES2DecoderTest1
, GetProgramivValidArgs
) {
1582 SpecializedSetup
<cmds::GetProgramiv
, 0>(true);
1583 typedef cmds::GetProgramiv::Result Result
;
1584 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1586 cmds::GetProgramiv cmd
;
1587 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1588 shared_memory_offset_
);
1589 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1590 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_DELETE_STATUS
),
1591 result
->GetNumResults());
1592 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1595 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_0
) {
1596 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1597 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1598 cmds::GetProgramiv::Result
* result
=
1599 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1601 cmds::GetProgramiv cmd
;
1602 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, kInvalidSharedMemoryId
, 0);
1603 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1604 EXPECT_EQ(0u, result
->size
);
1607 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_1
) {
1608 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1609 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1610 cmds::GetProgramiv::Result
* result
=
1611 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1613 cmds::GetProgramiv cmd
;
1614 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, shared_memory_id_
,
1615 kInvalidSharedMemoryOffset
);
1616 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1617 EXPECT_EQ(0u, result
->size
);
1620 TEST_P(GLES2DecoderTest1
, GetProgramInfoLogValidArgs
) {
1621 const char* kInfo
= "hello";
1622 const uint32_t kBucketId
= 123;
1623 SpecializedSetup
<cmds::GetProgramInfoLog
, 0>(true);
1625 cmds::GetProgramInfoLog cmd
;
1626 cmd
.Init(client_program_id_
, kBucketId
);
1627 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1628 CommonDecoder::Bucket
* bucket
= decoder_
->GetBucket(kBucketId
);
1629 ASSERT_TRUE(bucket
!= NULL
);
1630 EXPECT_EQ(strlen(kInfo
) + 1, bucket
->size());
1632 memcmp(bucket
->GetData(0, bucket
->size()), kInfo
, bucket
->size()));
1633 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1636 TEST_P(GLES2DecoderTest1
, GetProgramInfoLogInvalidArgs
) {
1637 const uint32_t kBucketId
= 123;
1638 cmds::GetProgramInfoLog cmd
;
1639 cmd
.Init(kInvalidClientId
, kBucketId
);
1640 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1641 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1644 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivValidArgs
) {
1645 EXPECT_CALL(*gl_
, GetError())
1646 .WillOnce(Return(GL_NO_ERROR
))
1647 .WillOnce(Return(GL_NO_ERROR
))
1648 .RetiresOnSaturation();
1649 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(true);
1650 typedef cmds::GetRenderbufferParameteriv::Result Result
;
1651 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1653 *gl_
, GetRenderbufferParameterivEXT(
1654 GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, result
->GetData()));
1656 cmds::GetRenderbufferParameteriv cmd
;
1657 cmd
.Init(GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, shared_memory_id_
,
1658 shared_memory_offset_
);
1659 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1660 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1661 GL_RENDERBUFFER_RED_SIZE
),
1662 result
->GetNumResults());
1663 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1666 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs0_0
) {
1667 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1668 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1669 cmds::GetRenderbufferParameteriv::Result
* result
=
1670 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1671 shared_memory_address_
);
1673 cmds::GetRenderbufferParameteriv cmd
;
1674 cmd
.Init(GL_FRAMEBUFFER
, GL_RENDERBUFFER_RED_SIZE
, shared_memory_id_
,
1675 shared_memory_offset_
);
1676 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1677 EXPECT_EQ(0u, result
->size
);
1678 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1681 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs2_0
) {
1682 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1683 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1684 cmds::GetRenderbufferParameteriv::Result
* result
=
1685 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1686 shared_memory_address_
);
1688 cmds::GetRenderbufferParameteriv cmd
;
1689 cmd
.Init(GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, kInvalidSharedMemoryId
,
1691 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1692 EXPECT_EQ(0u, result
->size
);
1695 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs2_1
) {
1696 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1697 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1698 cmds::GetRenderbufferParameteriv::Result
* result
=
1699 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1700 shared_memory_address_
);
1702 cmds::GetRenderbufferParameteriv cmd
;
1703 cmd
.Init(GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, shared_memory_id_
,
1704 kInvalidSharedMemoryOffset
);
1705 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1706 EXPECT_EQ(0u, result
->size
);
1709 TEST_P(GLES2DecoderTest1
, GetSamplerParameterfvValidArgs
) {
1710 EXPECT_CALL(*gl_
, GetError())
1711 .WillOnce(Return(GL_NO_ERROR
))
1712 .WillOnce(Return(GL_NO_ERROR
))
1713 .RetiresOnSaturation();
1714 SpecializedSetup
<cmds::GetSamplerParameterfv
, 0>(true);
1715 typedef cmds::GetSamplerParameterfv::Result Result
;
1716 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1718 GetSamplerParameterfv(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
,
1719 result
->GetData()));
1721 cmds::GetSamplerParameterfv cmd
;
1722 cmd
.Init(client_sampler_id_
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1723 shared_memory_offset_
);
1724 decoder_
->set_unsafe_es3_apis_enabled(true);
1725 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1727 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1728 result
->GetNumResults());
1729 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1730 decoder_
->set_unsafe_es3_apis_enabled(false);
1731 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1734 TEST_P(GLES2DecoderTest1
, GetSamplerParameterivValidArgs
) {
1735 EXPECT_CALL(*gl_
, GetError())
1736 .WillOnce(Return(GL_NO_ERROR
))
1737 .WillOnce(Return(GL_NO_ERROR
))
1738 .RetiresOnSaturation();
1739 SpecializedSetup
<cmds::GetSamplerParameteriv
, 0>(true);
1740 typedef cmds::GetSamplerParameteriv::Result Result
;
1741 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1743 GetSamplerParameteriv(kServiceSamplerId
, GL_TEXTURE_MAG_FILTER
,
1744 result
->GetData()));
1746 cmds::GetSamplerParameteriv cmd
;
1747 cmd
.Init(client_sampler_id_
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1748 shared_memory_offset_
);
1749 decoder_
->set_unsafe_es3_apis_enabled(true);
1750 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1752 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1753 result
->GetNumResults());
1754 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1755 decoder_
->set_unsafe_es3_apis_enabled(false);
1756 EXPECT_EQ(error::kUnknownCommand
, ExecuteCmd(cmd
));
1759 TEST_P(GLES2DecoderTest1
, GetShaderivValidArgs
) {
1760 EXPECT_CALL(*gl_
, GetError())
1761 .WillOnce(Return(GL_NO_ERROR
))
1762 .WillOnce(Return(GL_NO_ERROR
))
1763 .RetiresOnSaturation();
1764 SpecializedSetup
<cmds::GetShaderiv
, 0>(true);
1765 typedef cmds::GetShaderiv::Result Result
;
1766 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1768 GetShaderiv(kServiceShaderId
, GL_SHADER_TYPE
, result
->GetData()));
1770 cmds::GetShaderiv cmd
;
1771 cmd
.Init(client_shader_id_
, GL_SHADER_TYPE
, shared_memory_id_
,
1772 shared_memory_offset_
);
1773 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1774 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_SHADER_TYPE
),
1775 result
->GetNumResults());
1776 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1779 TEST_P(GLES2DecoderTest1
, GetShaderivInvalidArgs2_0
) {
1780 EXPECT_CALL(*gl_
, GetShaderiv(_
, _
, _
)).Times(0);
1781 SpecializedSetup
<cmds::GetShaderiv
, 0>(false);
1782 cmds::GetShaderiv::Result
* result
=
1783 static_cast<cmds::GetShaderiv::Result
*>(shared_memory_address_
);
1785 cmds::GetShaderiv cmd
;
1786 cmd
.Init(client_shader_id_
, GL_SHADER_TYPE
, kInvalidSharedMemoryId
, 0);
1787 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1788 EXPECT_EQ(0u, result
->size
);
1791 TEST_P(GLES2DecoderTest1
, GetShaderivInvalidArgs2_1
) {
1792 EXPECT_CALL(*gl_
, GetShaderiv(_
, _
, _
)).Times(0);
1793 SpecializedSetup
<cmds::GetShaderiv
, 0>(false);
1794 cmds::GetShaderiv::Result
* result
=
1795 static_cast<cmds::GetShaderiv::Result
*>(shared_memory_address_
);
1797 cmds::GetShaderiv cmd
;
1798 cmd
.Init(client_shader_id_
, GL_SHADER_TYPE
, shared_memory_id_
,
1799 kInvalidSharedMemoryOffset
);
1800 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1801 EXPECT_EQ(0u, result
->size
);
1803 // TODO(gman): GetShaderInfoLog
1804 // TODO(gman): GetShaderPrecisionFormat
1806 // TODO(gman): GetShaderSource
1807 // TODO(gman): GetString
1809 TEST_P(GLES2DecoderTest1
, GetTexParameterfvValidArgs
) {
1810 EXPECT_CALL(*gl_
, GetError())
1811 .WillOnce(Return(GL_NO_ERROR
))
1812 .WillOnce(Return(GL_NO_ERROR
))
1813 .RetiresOnSaturation();
1814 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(true);
1815 typedef cmds::GetTexParameterfv::Result Result
;
1816 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1817 EXPECT_CALL(*gl_
, GetTexParameterfv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
,
1818 result
->GetData()));
1820 cmds::GetTexParameterfv cmd
;
1821 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1822 shared_memory_offset_
);
1823 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1825 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1826 result
->GetNumResults());
1827 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1830 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs0_0
) {
1831 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1832 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1833 cmds::GetTexParameterfv::Result
* result
=
1834 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1836 cmds::GetTexParameterfv cmd
;
1837 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1838 shared_memory_offset_
);
1839 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1840 EXPECT_EQ(0u, result
->size
);
1841 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1844 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs1_0
) {
1845 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1846 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1847 cmds::GetTexParameterfv::Result
* result
=
1848 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1850 cmds::GetTexParameterfv cmd
;
1851 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, shared_memory_id_
,
1852 shared_memory_offset_
);
1853 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1854 EXPECT_EQ(0u, result
->size
);
1855 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1858 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs2_0
) {
1859 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1860 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1861 cmds::GetTexParameterfv::Result
* result
=
1862 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1864 cmds::GetTexParameterfv cmd
;
1865 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, kInvalidSharedMemoryId
, 0);
1866 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1867 EXPECT_EQ(0u, result
->size
);
1870 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs2_1
) {
1871 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1872 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1873 cmds::GetTexParameterfv::Result
* result
=
1874 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1876 cmds::GetTexParameterfv cmd
;
1877 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1878 kInvalidSharedMemoryOffset
);
1879 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1880 EXPECT_EQ(0u, result
->size
);
1883 TEST_P(GLES2DecoderTest1
, GetTexParameterivValidArgs
) {
1884 EXPECT_CALL(*gl_
, GetError())
1885 .WillOnce(Return(GL_NO_ERROR
))
1886 .WillOnce(Return(GL_NO_ERROR
))
1887 .RetiresOnSaturation();
1888 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(true);
1889 typedef cmds::GetTexParameteriv::Result Result
;
1890 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1891 EXPECT_CALL(*gl_
, GetTexParameteriv(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
,
1892 result
->GetData()));
1894 cmds::GetTexParameteriv cmd
;
1895 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1896 shared_memory_offset_
);
1897 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1899 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1900 result
->GetNumResults());
1901 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1904 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs0_0
) {
1905 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1906 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1907 cmds::GetTexParameteriv::Result
* result
=
1908 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1910 cmds::GetTexParameteriv cmd
;
1911 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1912 shared_memory_offset_
);
1913 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1914 EXPECT_EQ(0u, result
->size
);
1915 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1918 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs1_0
) {
1919 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1920 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1921 cmds::GetTexParameteriv::Result
* result
=
1922 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1924 cmds::GetTexParameteriv cmd
;
1925 cmd
.Init(GL_TEXTURE_2D
, GL_GENERATE_MIPMAP
, shared_memory_id_
,
1926 shared_memory_offset_
);
1927 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1928 EXPECT_EQ(0u, result
->size
);
1929 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1932 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs2_0
) {
1933 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1934 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1935 cmds::GetTexParameteriv::Result
* result
=
1936 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1938 cmds::GetTexParameteriv cmd
;
1939 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, kInvalidSharedMemoryId
, 0);
1940 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1941 EXPECT_EQ(0u, result
->size
);
1944 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs2_1
) {
1945 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1946 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1947 cmds::GetTexParameteriv::Result
* result
=
1948 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1950 cmds::GetTexParameteriv cmd
;
1951 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, shared_memory_id_
,
1952 kInvalidSharedMemoryOffset
);
1953 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1954 EXPECT_EQ(0u, result
->size
);
1956 // TODO(gman): GetUniformfv
1958 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_