1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is auto-generated from
6 // gpu/command_buffer/build_gles2_cmd_buffer.py
7 // It's formatted by clang-format using chromium coding style:
8 // clang-format -i -style=chromium filename
11 // It is included by gles2_cmd_decoder_unittest_1.cc
12 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_
13 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_
15 // TODO(gman): ActiveTexture
17 TEST_P(GLES2DecoderTest1
, AttachShaderValidArgs
) {
18 EXPECT_CALL(*gl_
, AttachShader(kServiceProgramId
, kServiceShaderId
));
19 SpecializedSetup
<cmds::AttachShader
, 0>(true);
20 cmds::AttachShader cmd
;
21 cmd
.Init(client_program_id_
, client_shader_id_
);
22 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
23 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
25 // TODO(gman): BindAttribLocationBucket
27 TEST_P(GLES2DecoderTest1
, BindBufferValidArgs
) {
28 EXPECT_CALL(*gl_
, BindBuffer(GL_ARRAY_BUFFER
, kServiceBufferId
));
29 SpecializedSetup
<cmds::BindBuffer
, 0>(true);
31 cmd
.Init(GL_ARRAY_BUFFER
, client_buffer_id_
);
32 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
33 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
36 TEST_P(GLES2DecoderTest1
, BindBufferValidArgsNewId
) {
37 EXPECT_CALL(*gl_
, BindBuffer(GL_ARRAY_BUFFER
, kNewServiceId
));
38 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
39 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
40 SpecializedSetup
<cmds::BindBuffer
, 0>(true);
42 cmd
.Init(GL_ARRAY_BUFFER
, kNewClientId
);
43 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
44 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
45 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
48 TEST_P(GLES2DecoderTest1
, BindBufferInvalidArgs0_0
) {
49 EXPECT_CALL(*gl_
, BindBuffer(_
, _
)).Times(0);
50 SpecializedSetup
<cmds::BindBuffer
, 0>(false);
52 cmd
.Init(GL_RENDERBUFFER
, client_buffer_id_
);
53 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
54 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
57 TEST_P(GLES2DecoderTest1
, BindFramebufferValidArgs
) {
58 EXPECT_CALL(*gl_
, BindFramebufferEXT(GL_FRAMEBUFFER
, kServiceFramebufferId
));
59 SpecializedSetup
<cmds::BindFramebuffer
, 0>(true);
60 cmds::BindFramebuffer cmd
;
61 cmd
.Init(GL_FRAMEBUFFER
, client_framebuffer_id_
);
62 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
63 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
66 TEST_P(GLES2DecoderTest1
, BindFramebufferValidArgsNewId
) {
67 EXPECT_CALL(*gl_
, BindFramebufferEXT(GL_FRAMEBUFFER
, kNewServiceId
));
68 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
69 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
70 SpecializedSetup
<cmds::BindFramebuffer
, 0>(true);
71 cmds::BindFramebuffer cmd
;
72 cmd
.Init(GL_FRAMEBUFFER
, kNewClientId
);
73 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
74 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
75 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
78 TEST_P(GLES2DecoderTest1
, BindFramebufferInvalidArgs0_0
) {
79 EXPECT_CALL(*gl_
, BindFramebufferEXT(_
, _
)).Times(0);
80 SpecializedSetup
<cmds::BindFramebuffer
, 0>(false);
81 cmds::BindFramebuffer cmd
;
82 cmd
.Init(GL_DRAW_FRAMEBUFFER
, client_framebuffer_id_
);
83 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
84 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
87 TEST_P(GLES2DecoderTest1
, BindFramebufferInvalidArgs0_1
) {
88 EXPECT_CALL(*gl_
, BindFramebufferEXT(_
, _
)).Times(0);
89 SpecializedSetup
<cmds::BindFramebuffer
, 0>(false);
90 cmds::BindFramebuffer cmd
;
91 cmd
.Init(GL_READ_FRAMEBUFFER
, client_framebuffer_id_
);
92 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
93 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
96 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgs
) {
98 BindRenderbufferEXT(GL_RENDERBUFFER
, kServiceRenderbufferId
));
99 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
100 cmds::BindRenderbuffer cmd
;
101 cmd
.Init(GL_RENDERBUFFER
, client_renderbuffer_id_
);
102 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
103 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
106 TEST_P(GLES2DecoderTest1
, BindRenderbufferValidArgsNewId
) {
107 EXPECT_CALL(*gl_
, BindRenderbufferEXT(GL_RENDERBUFFER
, kNewServiceId
));
108 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
109 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
110 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(true);
111 cmds::BindRenderbuffer cmd
;
112 cmd
.Init(GL_RENDERBUFFER
, kNewClientId
);
113 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
114 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
115 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
118 TEST_P(GLES2DecoderTest1
, BindRenderbufferInvalidArgs0_0
) {
119 EXPECT_CALL(*gl_
, BindRenderbufferEXT(_
, _
)).Times(0);
120 SpecializedSetup
<cmds::BindRenderbuffer
, 0>(false);
121 cmds::BindRenderbuffer cmd
;
122 cmd
.Init(GL_FRAMEBUFFER
, client_renderbuffer_id_
);
123 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
124 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
127 TEST_P(GLES2DecoderTest1
, BindTextureValidArgs
) {
128 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kServiceTextureId
));
129 SpecializedSetup
<cmds::BindTexture
, 0>(true);
130 cmds::BindTexture cmd
;
131 cmd
.Init(GL_TEXTURE_2D
, client_texture_id_
);
132 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
133 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
136 TEST_P(GLES2DecoderTest1
, BindTextureValidArgsNewId
) {
137 EXPECT_CALL(*gl_
, BindTexture(GL_TEXTURE_2D
, kNewServiceId
));
138 EXPECT_CALL(*gl_
, GenTextures(1, _
))
139 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
140 SpecializedSetup
<cmds::BindTexture
, 0>(true);
141 cmds::BindTexture cmd
;
142 cmd
.Init(GL_TEXTURE_2D
, kNewClientId
);
143 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
144 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
145 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
148 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_0
) {
149 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
150 SpecializedSetup
<cmds::BindTexture
, 0>(false);
151 cmds::BindTexture cmd
;
152 cmd
.Init(GL_TEXTURE_1D
, client_texture_id_
);
153 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
154 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
157 TEST_P(GLES2DecoderTest1
, BindTextureInvalidArgs0_1
) {
158 EXPECT_CALL(*gl_
, BindTexture(_
, _
)).Times(0);
159 SpecializedSetup
<cmds::BindTexture
, 0>(false);
160 cmds::BindTexture cmd
;
161 cmd
.Init(GL_TEXTURE_3D
, client_texture_id_
);
162 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
163 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
166 TEST_P(GLES2DecoderTest1
, BlendColorValidArgs
) {
167 EXPECT_CALL(*gl_
, BlendColor(1, 2, 3, 4));
168 SpecializedSetup
<cmds::BlendColor
, 0>(true);
169 cmds::BlendColor cmd
;
170 cmd
.Init(1, 2, 3, 4);
171 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
172 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
175 TEST_P(GLES2DecoderTest1
, BlendEquationValidArgs
) {
176 EXPECT_CALL(*gl_
, BlendEquation(GL_FUNC_SUBTRACT
));
177 SpecializedSetup
<cmds::BlendEquation
, 0>(true);
178 cmds::BlendEquation cmd
;
179 cmd
.Init(GL_FUNC_SUBTRACT
);
180 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
181 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
184 TEST_P(GLES2DecoderTest1
, BlendEquationInvalidArgs0_0
) {
185 EXPECT_CALL(*gl_
, BlendEquation(_
)).Times(0);
186 SpecializedSetup
<cmds::BlendEquation
, 0>(false);
187 cmds::BlendEquation cmd
;
189 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
190 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
193 TEST_P(GLES2DecoderTest1
, BlendEquationInvalidArgs0_1
) {
194 EXPECT_CALL(*gl_
, BlendEquation(_
)).Times(0);
195 SpecializedSetup
<cmds::BlendEquation
, 0>(false);
196 cmds::BlendEquation cmd
;
198 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
199 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
202 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateValidArgs
) {
203 EXPECT_CALL(*gl_
, BlendEquationSeparate(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
));
204 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(true);
205 cmds::BlendEquationSeparate cmd
;
206 cmd
.Init(GL_FUNC_SUBTRACT
, GL_FUNC_ADD
);
207 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
208 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
211 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs0_0
) {
212 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
213 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
214 cmds::BlendEquationSeparate cmd
;
215 cmd
.Init(GL_MIN
, GL_FUNC_ADD
);
216 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
217 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
220 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs0_1
) {
221 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
222 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
223 cmds::BlendEquationSeparate cmd
;
224 cmd
.Init(GL_MAX
, GL_FUNC_ADD
);
225 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
226 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
229 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs1_0
) {
230 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
231 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
232 cmds::BlendEquationSeparate cmd
;
233 cmd
.Init(GL_FUNC_SUBTRACT
, GL_MIN
);
234 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
235 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
238 TEST_P(GLES2DecoderTest1
, BlendEquationSeparateInvalidArgs1_1
) {
239 EXPECT_CALL(*gl_
, BlendEquationSeparate(_
, _
)).Times(0);
240 SpecializedSetup
<cmds::BlendEquationSeparate
, 0>(false);
241 cmds::BlendEquationSeparate cmd
;
242 cmd
.Init(GL_FUNC_SUBTRACT
, GL_MAX
);
243 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
244 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
247 TEST_P(GLES2DecoderTest1
, BlendFuncValidArgs
) {
248 EXPECT_CALL(*gl_
, BlendFunc(GL_ZERO
, GL_ZERO
));
249 SpecializedSetup
<cmds::BlendFunc
, 0>(true);
251 cmd
.Init(GL_ZERO
, GL_ZERO
);
252 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
253 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
256 TEST_P(GLES2DecoderTest1
, BlendFuncSeparateValidArgs
) {
257 EXPECT_CALL(*gl_
, BlendFuncSeparate(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
));
258 SpecializedSetup
<cmds::BlendFuncSeparate
, 0>(true);
259 cmds::BlendFuncSeparate cmd
;
260 cmd
.Init(GL_ZERO
, GL_ZERO
, GL_ZERO
, GL_ZERO
);
261 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
262 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
264 // TODO(gman): BufferData
266 // TODO(gman): BufferSubData
268 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusValidArgs
) {
269 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
));
270 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(true);
271 cmds::CheckFramebufferStatus cmd
;
272 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
273 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
274 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
277 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgs0_0
) {
278 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(_
)).Times(0);
279 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
280 cmds::CheckFramebufferStatus cmd
;
281 cmd
.Init(GL_DRAW_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
282 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
283 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
286 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgs0_1
) {
287 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(_
)).Times(0);
288 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
289 cmds::CheckFramebufferStatus cmd
;
290 cmd
.Init(GL_READ_FRAMEBUFFER
, shared_memory_id_
, shared_memory_offset_
);
291 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
292 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
295 TEST_P(GLES2DecoderTest1
, CheckFramebufferStatusInvalidArgsBadSharedMemoryId
) {
296 EXPECT_CALL(*gl_
, CheckFramebufferStatusEXT(GL_FRAMEBUFFER
)).Times(0);
297 SpecializedSetup
<cmds::CheckFramebufferStatus
, 0>(false);
298 cmds::CheckFramebufferStatus cmd
;
299 cmd
.Init(GL_FRAMEBUFFER
, kInvalidSharedMemoryId
, shared_memory_offset_
);
300 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
301 cmd
.Init(GL_FRAMEBUFFER
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
302 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
305 TEST_P(GLES2DecoderTest1
, ClearValidArgs
) {
306 EXPECT_CALL(*gl_
, Clear(1));
307 SpecializedSetup
<cmds::Clear
, 0>(true);
310 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
311 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
314 TEST_P(GLES2DecoderTest1
, ClearColorValidArgs
) {
315 EXPECT_CALL(*gl_
, ClearColor(1, 2, 3, 4));
316 SpecializedSetup
<cmds::ClearColor
, 0>(true);
317 cmds::ClearColor cmd
;
318 cmd
.Init(1, 2, 3, 4);
319 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
320 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
323 TEST_P(GLES2DecoderTest1
, ClearDepthfValidArgs
) {
324 EXPECT_CALL(*gl_
, ClearDepth(0.5f
));
325 SpecializedSetup
<cmds::ClearDepthf
, 0>(true);
326 cmds::ClearDepthf cmd
;
328 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
329 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
332 TEST_P(GLES2DecoderTest1
, ClearStencilValidArgs
) {
333 EXPECT_CALL(*gl_
, ClearStencil(1));
334 SpecializedSetup
<cmds::ClearStencil
, 0>(true);
335 cmds::ClearStencil cmd
;
337 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
338 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
341 TEST_P(GLES2DecoderTest1
, ColorMaskValidArgs
) {
342 SpecializedSetup
<cmds::ColorMask
, 0>(true);
344 cmd
.Init(true, true, true, true);
345 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
346 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
348 // TODO(gman): CompileShader
349 // TODO(gman): CompressedTexImage2DBucket
350 // TODO(gman): CompressedTexImage2D
352 // TODO(gman): CompressedTexSubImage2DBucket
353 // TODO(gman): CompressedTexSubImage2D
355 // TODO(gman): CopyTexImage2D
357 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DValidArgs
) {
358 EXPECT_CALL(*gl_
, CopyTexSubImage2D(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8));
359 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(true);
360 cmds::CopyTexSubImage2D cmd
;
361 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, 8);
362 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
363 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
366 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs0_0
) {
367 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
368 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
369 cmds::CopyTexSubImage2D cmd
;
370 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
, 2, 3, 4, 5, 6, 7, 8);
371 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
372 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
375 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs6_0
) {
376 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
377 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
378 cmds::CopyTexSubImage2D cmd
;
379 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, -1, 8);
380 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
381 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
384 TEST_P(GLES2DecoderTest1
, CopyTexSubImage2DInvalidArgs7_0
) {
385 EXPECT_CALL(*gl_
, CopyTexSubImage2D(_
, _
, _
, _
, _
, _
, _
, _
)).Times(0);
386 SpecializedSetup
<cmds::CopyTexSubImage2D
, 0>(false);
387 cmds::CopyTexSubImage2D cmd
;
388 cmd
.Init(GL_TEXTURE_2D
, 2, 3, 4, 5, 6, 7, -1);
389 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
390 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
393 TEST_P(GLES2DecoderTest1
, CreateProgramValidArgs
) {
394 EXPECT_CALL(*gl_
, CreateProgram()).WillOnce(Return(kNewServiceId
));
395 SpecializedSetup
<cmds::CreateProgram
, 0>(true);
396 cmds::CreateProgram cmd
;
397 cmd
.Init(kNewClientId
);
398 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
399 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
400 EXPECT_TRUE(GetProgram(kNewClientId
) != NULL
);
403 TEST_P(GLES2DecoderTest1
, CreateShaderValidArgs
) {
404 EXPECT_CALL(*gl_
, CreateShader(GL_VERTEX_SHADER
))
405 .WillOnce(Return(kNewServiceId
));
406 SpecializedSetup
<cmds::CreateShader
, 0>(true);
407 cmds::CreateShader cmd
;
408 cmd
.Init(GL_VERTEX_SHADER
, kNewClientId
);
409 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
410 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
411 EXPECT_TRUE(GetShader(kNewClientId
) != NULL
);
414 TEST_P(GLES2DecoderTest1
, CreateShaderInvalidArgs0_0
) {
415 EXPECT_CALL(*gl_
, CreateShader(_
)).Times(0);
416 SpecializedSetup
<cmds::CreateShader
, 0>(false);
417 cmds::CreateShader cmd
;
418 cmd
.Init(GL_GEOMETRY_SHADER
, kNewClientId
);
419 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
420 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
423 TEST_P(GLES2DecoderTest1
, CullFaceValidArgs
) {
424 EXPECT_CALL(*gl_
, CullFace(GL_FRONT
));
425 SpecializedSetup
<cmds::CullFace
, 0>(true);
428 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
429 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
432 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateValidArgs
) {
433 EXPECT_CALL(*gl_
, DeleteBuffersARB(1, Pointee(kServiceBufferId
))).Times(1);
434 cmds::DeleteBuffersImmediate
& cmd
=
435 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
436 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(true);
437 cmd
.Init(1, &client_buffer_id_
);
438 EXPECT_EQ(error::kNoError
,
439 ExecuteImmediateCmd(cmd
, sizeof(client_buffer_id_
)));
440 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
441 EXPECT_TRUE(GetBuffer(client_buffer_id_
) == NULL
);
444 TEST_P(GLES2DecoderTest1
, DeleteBuffersImmediateInvalidArgs
) {
445 cmds::DeleteBuffersImmediate
& cmd
=
446 *GetImmediateAs
<cmds::DeleteBuffersImmediate
>();
447 SpecializedSetup
<cmds::DeleteBuffersImmediate
, 0>(false);
448 GLuint temp
= kInvalidClientId
;
450 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
453 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateValidArgs
) {
454 EXPECT_CALL(*gl_
, DeleteFramebuffersEXT(1, Pointee(kServiceFramebufferId
)))
456 cmds::DeleteFramebuffersImmediate
& cmd
=
457 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
458 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(true);
459 cmd
.Init(1, &client_framebuffer_id_
);
460 EXPECT_EQ(error::kNoError
,
461 ExecuteImmediateCmd(cmd
, sizeof(client_framebuffer_id_
)));
462 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
463 EXPECT_TRUE(GetFramebuffer(client_framebuffer_id_
) == NULL
);
466 TEST_P(GLES2DecoderTest1
, DeleteFramebuffersImmediateInvalidArgs
) {
467 cmds::DeleteFramebuffersImmediate
& cmd
=
468 *GetImmediateAs
<cmds::DeleteFramebuffersImmediate
>();
469 SpecializedSetup
<cmds::DeleteFramebuffersImmediate
, 0>(false);
470 GLuint temp
= kInvalidClientId
;
472 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
475 TEST_P(GLES2DecoderTest1
, DeleteProgramValidArgs
) {
476 EXPECT_CALL(*gl_
, DeleteProgram(kServiceProgramId
));
477 SpecializedSetup
<cmds::DeleteProgram
, 0>(true);
478 cmds::DeleteProgram cmd
;
479 cmd
.Init(client_program_id_
);
480 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
481 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
484 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateValidArgs
) {
485 EXPECT_CALL(*gl_
, DeleteRenderbuffersEXT(1, Pointee(kServiceRenderbufferId
)))
487 cmds::DeleteRenderbuffersImmediate
& cmd
=
488 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
489 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(true);
490 cmd
.Init(1, &client_renderbuffer_id_
);
491 EXPECT_EQ(error::kNoError
,
492 ExecuteImmediateCmd(cmd
, sizeof(client_renderbuffer_id_
)));
493 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
494 EXPECT_TRUE(GetRenderbuffer(client_renderbuffer_id_
) == NULL
);
497 TEST_P(GLES2DecoderTest1
, DeleteRenderbuffersImmediateInvalidArgs
) {
498 cmds::DeleteRenderbuffersImmediate
& cmd
=
499 *GetImmediateAs
<cmds::DeleteRenderbuffersImmediate
>();
500 SpecializedSetup
<cmds::DeleteRenderbuffersImmediate
, 0>(false);
501 GLuint temp
= kInvalidClientId
;
503 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
506 TEST_P(GLES2DecoderTest1
, DeleteShaderValidArgs
) {
507 EXPECT_CALL(*gl_
, DeleteShader(kServiceShaderId
));
508 SpecializedSetup
<cmds::DeleteShader
, 0>(true);
509 cmds::DeleteShader cmd
;
510 cmd
.Init(client_shader_id_
);
511 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
512 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
515 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateValidArgs
) {
516 EXPECT_CALL(*gl_
, DeleteTextures(1, Pointee(kServiceTextureId
))).Times(1);
517 cmds::DeleteTexturesImmediate
& cmd
=
518 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
519 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(true);
520 cmd
.Init(1, &client_texture_id_
);
521 EXPECT_EQ(error::kNoError
,
522 ExecuteImmediateCmd(cmd
, sizeof(client_texture_id_
)));
523 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
524 EXPECT_TRUE(GetTexture(client_texture_id_
) == NULL
);
527 TEST_P(GLES2DecoderTest1
, DeleteTexturesImmediateInvalidArgs
) {
528 cmds::DeleteTexturesImmediate
& cmd
=
529 *GetImmediateAs
<cmds::DeleteTexturesImmediate
>();
530 SpecializedSetup
<cmds::DeleteTexturesImmediate
, 0>(false);
531 GLuint temp
= kInvalidClientId
;
533 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(cmd
, sizeof(temp
)));
536 TEST_P(GLES2DecoderTest1
, DepthFuncValidArgs
) {
537 EXPECT_CALL(*gl_
, DepthFunc(GL_NEVER
));
538 SpecializedSetup
<cmds::DepthFunc
, 0>(true);
541 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
542 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
545 TEST_P(GLES2DecoderTest1
, DepthMaskValidArgs
) {
546 SpecializedSetup
<cmds::DepthMask
, 0>(true);
549 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
550 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
553 TEST_P(GLES2DecoderTest1
, DepthRangefValidArgs
) {
554 EXPECT_CALL(*gl_
, DepthRange(1, 2));
555 SpecializedSetup
<cmds::DepthRangef
, 0>(true);
556 cmds::DepthRangef cmd
;
558 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
559 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
562 TEST_P(GLES2DecoderTest1
, DetachShaderValidArgs
) {
563 EXPECT_CALL(*gl_
, DetachShader(kServiceProgramId
, kServiceShaderId
));
564 SpecializedSetup
<cmds::DetachShader
, 0>(true);
565 cmds::DetachShader cmd
;
566 cmd
.Init(client_program_id_
, client_shader_id_
);
567 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
568 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
571 TEST_P(GLES2DecoderTest1
, DisableValidArgs
) {
572 SetupExpectationsForEnableDisable(GL_BLEND
, false);
573 SpecializedSetup
<cmds::Disable
, 0>(true);
576 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
577 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
580 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_0
) {
581 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
582 SpecializedSetup
<cmds::Disable
, 0>(false);
584 cmd
.Init(GL_CLIP_PLANE0
);
585 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
586 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
589 TEST_P(GLES2DecoderTest1
, DisableInvalidArgs0_1
) {
590 EXPECT_CALL(*gl_
, Disable(_
)).Times(0);
591 SpecializedSetup
<cmds::Disable
, 0>(false);
593 cmd
.Init(GL_POINT_SPRITE
);
594 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
595 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
598 TEST_P(GLES2DecoderTest1
, DisableVertexAttribArrayValidArgs
) {
599 EXPECT_CALL(*gl_
, DisableVertexAttribArray(1));
600 SpecializedSetup
<cmds::DisableVertexAttribArray
, 0>(true);
601 cmds::DisableVertexAttribArray cmd
;
603 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
604 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
606 // TODO(gman): DrawArrays
608 // TODO(gman): DrawElements
610 TEST_P(GLES2DecoderTest1
, EnableValidArgs
) {
611 SetupExpectationsForEnableDisable(GL_BLEND
, true);
612 SpecializedSetup
<cmds::Enable
, 0>(true);
615 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
616 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
619 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_0
) {
620 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
621 SpecializedSetup
<cmds::Enable
, 0>(false);
623 cmd
.Init(GL_CLIP_PLANE0
);
624 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
625 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
628 TEST_P(GLES2DecoderTest1
, EnableInvalidArgs0_1
) {
629 EXPECT_CALL(*gl_
, Enable(_
)).Times(0);
630 SpecializedSetup
<cmds::Enable
, 0>(false);
632 cmd
.Init(GL_POINT_SPRITE
);
633 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
634 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
637 TEST_P(GLES2DecoderTest1
, EnableVertexAttribArrayValidArgs
) {
638 EXPECT_CALL(*gl_
, EnableVertexAttribArray(1));
639 SpecializedSetup
<cmds::EnableVertexAttribArray
, 0>(true);
640 cmds::EnableVertexAttribArray cmd
;
642 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
643 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
646 TEST_P(GLES2DecoderTest1
, FinishValidArgs
) {
647 EXPECT_CALL(*gl_
, Finish());
648 SpecializedSetup
<cmds::Finish
, 0>(true);
651 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
652 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
655 TEST_P(GLES2DecoderTest1
, FlushValidArgs
) {
656 EXPECT_CALL(*gl_
, Flush());
657 SpecializedSetup
<cmds::Flush
, 0>(true);
660 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
661 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
664 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferValidArgs
) {
666 FramebufferRenderbufferEXT(GL_FRAMEBUFFER
,
667 GL_COLOR_ATTACHMENT0
,
669 kServiceRenderbufferId
));
670 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(true);
671 cmds::FramebufferRenderbuffer cmd
;
672 cmd
.Init(GL_FRAMEBUFFER
,
673 GL_COLOR_ATTACHMENT0
,
675 client_renderbuffer_id_
);
676 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
677 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
680 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_0
) {
681 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
682 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
683 cmds::FramebufferRenderbuffer cmd
;
684 cmd
.Init(GL_DRAW_FRAMEBUFFER
,
685 GL_COLOR_ATTACHMENT0
,
687 client_renderbuffer_id_
);
688 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
689 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
692 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs0_1
) {
693 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
694 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
695 cmds::FramebufferRenderbuffer cmd
;
696 cmd
.Init(GL_READ_FRAMEBUFFER
,
697 GL_COLOR_ATTACHMENT0
,
699 client_renderbuffer_id_
);
700 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
701 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
704 TEST_P(GLES2DecoderTest1
, FramebufferRenderbufferInvalidArgs2_0
) {
705 EXPECT_CALL(*gl_
, FramebufferRenderbufferEXT(_
, _
, _
, _
)).Times(0);
706 SpecializedSetup
<cmds::FramebufferRenderbuffer
, 0>(false);
707 cmds::FramebufferRenderbuffer cmd
;
708 cmd
.Init(GL_FRAMEBUFFER
,
709 GL_COLOR_ATTACHMENT0
,
711 client_renderbuffer_id_
);
712 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
713 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
716 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DValidArgs
) {
718 FramebufferTexture2DEXT(GL_FRAMEBUFFER
,
719 GL_COLOR_ATTACHMENT0
,
723 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(true);
724 cmds::FramebufferTexture2D cmd
;
726 GL_FRAMEBUFFER
, GL_COLOR_ATTACHMENT0
, GL_TEXTURE_2D
, client_texture_id_
);
727 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
728 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
731 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_0
) {
732 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
733 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
734 cmds::FramebufferTexture2D cmd
;
735 cmd
.Init(GL_DRAW_FRAMEBUFFER
,
736 GL_COLOR_ATTACHMENT0
,
739 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
740 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
743 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs0_1
) {
744 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
745 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
746 cmds::FramebufferTexture2D cmd
;
747 cmd
.Init(GL_READ_FRAMEBUFFER
,
748 GL_COLOR_ATTACHMENT0
,
751 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
752 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
755 TEST_P(GLES2DecoderTest1
, FramebufferTexture2DInvalidArgs2_0
) {
756 EXPECT_CALL(*gl_
, FramebufferTexture2DEXT(_
, _
, _
, _
, _
)).Times(0);
757 SpecializedSetup
<cmds::FramebufferTexture2D
, 0>(false);
758 cmds::FramebufferTexture2D cmd
;
759 cmd
.Init(GL_FRAMEBUFFER
,
760 GL_COLOR_ATTACHMENT0
,
761 GL_PROXY_TEXTURE_CUBE_MAP
,
763 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
764 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
767 TEST_P(GLES2DecoderTest1
, FrontFaceValidArgs
) {
768 EXPECT_CALL(*gl_
, FrontFace(GL_CW
));
769 SpecializedSetup
<cmds::FrontFace
, 0>(true);
772 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
773 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
776 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateValidArgs
) {
777 EXPECT_CALL(*gl_
, GenBuffersARB(1, _
))
778 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
779 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
780 GLuint temp
= kNewClientId
;
781 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(true);
783 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
784 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
785 EXPECT_TRUE(GetBuffer(kNewClientId
) != NULL
);
788 TEST_P(GLES2DecoderTest1
, GenBuffersImmediateInvalidArgs
) {
789 EXPECT_CALL(*gl_
, GenBuffersARB(_
, _
)).Times(0);
790 cmds::GenBuffersImmediate
* cmd
= GetImmediateAs
<cmds::GenBuffersImmediate
>();
791 SpecializedSetup
<cmds::GenBuffersImmediate
, 0>(false);
792 cmd
->Init(1, &client_buffer_id_
);
793 EXPECT_EQ(error::kInvalidArguments
,
794 ExecuteImmediateCmd(*cmd
, sizeof(&client_buffer_id_
)));
797 TEST_P(GLES2DecoderTest1
, GenerateMipmapValidArgs
) {
798 EXPECT_CALL(*gl_
, GenerateMipmapEXT(GL_TEXTURE_2D
));
799 SpecializedSetup
<cmds::GenerateMipmap
, 0>(true);
800 cmds::GenerateMipmap cmd
;
801 cmd
.Init(GL_TEXTURE_2D
);
802 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
803 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
806 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_0
) {
807 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
808 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
809 cmds::GenerateMipmap cmd
;
810 cmd
.Init(GL_TEXTURE_1D
);
811 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
812 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
815 TEST_P(GLES2DecoderTest1
, GenerateMipmapInvalidArgs0_1
) {
816 EXPECT_CALL(*gl_
, GenerateMipmapEXT(_
)).Times(0);
817 SpecializedSetup
<cmds::GenerateMipmap
, 0>(false);
818 cmds::GenerateMipmap cmd
;
819 cmd
.Init(GL_TEXTURE_3D
);
820 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
821 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
824 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateValidArgs
) {
825 EXPECT_CALL(*gl_
, GenFramebuffersEXT(1, _
))
826 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
827 cmds::GenFramebuffersImmediate
* cmd
=
828 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
829 GLuint temp
= kNewClientId
;
830 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(true);
832 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
833 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
834 EXPECT_TRUE(GetFramebuffer(kNewClientId
) != NULL
);
837 TEST_P(GLES2DecoderTest1
, GenFramebuffersImmediateInvalidArgs
) {
838 EXPECT_CALL(*gl_
, GenFramebuffersEXT(_
, _
)).Times(0);
839 cmds::GenFramebuffersImmediate
* cmd
=
840 GetImmediateAs
<cmds::GenFramebuffersImmediate
>();
841 SpecializedSetup
<cmds::GenFramebuffersImmediate
, 0>(false);
842 cmd
->Init(1, &client_framebuffer_id_
);
843 EXPECT_EQ(error::kInvalidArguments
,
844 ExecuteImmediateCmd(*cmd
, sizeof(&client_framebuffer_id_
)));
847 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateValidArgs
) {
848 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(1, _
))
849 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
850 cmds::GenRenderbuffersImmediate
* cmd
=
851 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
852 GLuint temp
= kNewClientId
;
853 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(true);
855 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
856 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
857 EXPECT_TRUE(GetRenderbuffer(kNewClientId
) != NULL
);
860 TEST_P(GLES2DecoderTest1
, GenRenderbuffersImmediateInvalidArgs
) {
861 EXPECT_CALL(*gl_
, GenRenderbuffersEXT(_
, _
)).Times(0);
862 cmds::GenRenderbuffersImmediate
* cmd
=
863 GetImmediateAs
<cmds::GenRenderbuffersImmediate
>();
864 SpecializedSetup
<cmds::GenRenderbuffersImmediate
, 0>(false);
865 cmd
->Init(1, &client_renderbuffer_id_
);
866 EXPECT_EQ(error::kInvalidArguments
,
867 ExecuteImmediateCmd(*cmd
, sizeof(&client_renderbuffer_id_
)));
870 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateValidArgs
) {
871 EXPECT_CALL(*gl_
, GenTextures(1, _
))
872 .WillOnce(SetArgumentPointee
<1>(kNewServiceId
));
873 cmds::GenTexturesImmediate
* cmd
=
874 GetImmediateAs
<cmds::GenTexturesImmediate
>();
875 GLuint temp
= kNewClientId
;
876 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(true);
878 EXPECT_EQ(error::kNoError
, ExecuteImmediateCmd(*cmd
, sizeof(temp
)));
879 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
880 EXPECT_TRUE(GetTexture(kNewClientId
) != NULL
);
883 TEST_P(GLES2DecoderTest1
, GenTexturesImmediateInvalidArgs
) {
884 EXPECT_CALL(*gl_
, GenTextures(_
, _
)).Times(0);
885 cmds::GenTexturesImmediate
* cmd
=
886 GetImmediateAs
<cmds::GenTexturesImmediate
>();
887 SpecializedSetup
<cmds::GenTexturesImmediate
, 0>(false);
888 cmd
->Init(1, &client_texture_id_
);
889 EXPECT_EQ(error::kInvalidArguments
,
890 ExecuteImmediateCmd(*cmd
, sizeof(&client_texture_id_
)));
892 // TODO(gman): GetActiveAttrib
894 // TODO(gman): GetActiveUniform
896 // TODO(gman): GetAttachedShaders
898 // TODO(gman): GetAttribLocation
900 TEST_P(GLES2DecoderTest1
, GetBooleanvValidArgs
) {
901 EXPECT_CALL(*gl_
, GetError())
902 .WillOnce(Return(GL_NO_ERROR
))
903 .WillOnce(Return(GL_NO_ERROR
))
904 .RetiresOnSaturation();
905 SpecializedSetup
<cmds::GetBooleanv
, 0>(true);
906 typedef cmds::GetBooleanv::Result Result
;
907 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
908 EXPECT_CALL(*gl_
, GetBooleanv(GL_ACTIVE_TEXTURE
, result
->GetData()));
910 cmds::GetBooleanv cmd
;
911 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
912 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
913 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
914 result
->GetNumResults());
915 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
918 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs0_0
) {
919 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
920 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
921 cmds::GetBooleanv::Result
* result
=
922 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
924 cmds::GetBooleanv cmd
;
925 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
926 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
927 EXPECT_EQ(0u, result
->size
);
928 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
931 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_0
) {
932 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
933 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
934 cmds::GetBooleanv::Result
* result
=
935 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
937 cmds::GetBooleanv cmd
;
938 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
939 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
940 EXPECT_EQ(0u, result
->size
);
943 TEST_P(GLES2DecoderTest1
, GetBooleanvInvalidArgs1_1
) {
944 EXPECT_CALL(*gl_
, GetBooleanv(_
, _
)).Times(0);
945 SpecializedSetup
<cmds::GetBooleanv
, 0>(false);
946 cmds::GetBooleanv::Result
* result
=
947 static_cast<cmds::GetBooleanv::Result
*>(shared_memory_address_
);
949 cmds::GetBooleanv cmd
;
950 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
951 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
952 EXPECT_EQ(0u, result
->size
);
955 TEST_P(GLES2DecoderTest1
, GetBufferParameterivValidArgs
) {
956 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(true);
957 typedef cmds::GetBufferParameteriv::Result Result
;
958 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
960 cmds::GetBufferParameteriv cmd
;
961 cmd
.Init(GL_ARRAY_BUFFER
,
964 shared_memory_offset_
);
965 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
966 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE
),
967 result
->GetNumResults());
968 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
971 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs0_0
) {
972 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
973 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
974 cmds::GetBufferParameteriv::Result
* result
=
975 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
977 cmds::GetBufferParameteriv cmd
;
978 cmd
.Init(GL_RENDERBUFFER
,
981 shared_memory_offset_
);
982 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
983 EXPECT_EQ(0u, result
->size
);
984 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
987 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs1_0
) {
988 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
989 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
990 cmds::GetBufferParameteriv::Result
* result
=
991 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
993 cmds::GetBufferParameteriv cmd
;
994 cmd
.Init(GL_ARRAY_BUFFER
,
995 GL_PIXEL_PACK_BUFFER
,
997 shared_memory_offset_
);
998 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
999 EXPECT_EQ(0u, result
->size
);
1000 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1003 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_0
) {
1004 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1005 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1006 cmds::GetBufferParameteriv::Result
* result
=
1007 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1009 cmds::GetBufferParameteriv cmd
;
1010 cmd
.Init(GL_ARRAY_BUFFER
, GL_BUFFER_SIZE
, kInvalidSharedMemoryId
, 0);
1011 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1012 EXPECT_EQ(0u, result
->size
);
1015 TEST_P(GLES2DecoderTest1
, GetBufferParameterivInvalidArgs2_1
) {
1016 EXPECT_CALL(*gl_
, GetBufferParameteriv(_
, _
, _
)).Times(0);
1017 SpecializedSetup
<cmds::GetBufferParameteriv
, 0>(false);
1018 cmds::GetBufferParameteriv::Result
* result
=
1019 static_cast<cmds::GetBufferParameteriv::Result
*>(shared_memory_address_
);
1021 cmds::GetBufferParameteriv cmd
;
1022 cmd
.Init(GL_ARRAY_BUFFER
,
1025 kInvalidSharedMemoryOffset
);
1026 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1027 EXPECT_EQ(0u, result
->size
);
1030 TEST_P(GLES2DecoderTest1
, GetErrorValidArgs
) {
1031 EXPECT_CALL(*gl_
, GetError());
1032 SpecializedSetup
<cmds::GetError
, 0>(true);
1034 cmd
.Init(shared_memory_id_
, shared_memory_offset_
);
1035 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1036 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1039 TEST_P(GLES2DecoderTest1
, GetErrorInvalidArgsBadSharedMemoryId
) {
1040 EXPECT_CALL(*gl_
, GetError()).Times(0);
1041 SpecializedSetup
<cmds::GetError
, 0>(false);
1043 cmd
.Init(kInvalidSharedMemoryId
, shared_memory_offset_
);
1044 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1045 cmd
.Init(shared_memory_id_
, kInvalidSharedMemoryOffset
);
1046 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1049 TEST_P(GLES2DecoderTest1
, GetFloatvValidArgs
) {
1050 EXPECT_CALL(*gl_
, GetError())
1051 .WillOnce(Return(GL_NO_ERROR
))
1052 .WillOnce(Return(GL_NO_ERROR
))
1053 .RetiresOnSaturation();
1054 SpecializedSetup
<cmds::GetFloatv
, 0>(true);
1055 typedef cmds::GetFloatv::Result Result
;
1056 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1057 EXPECT_CALL(*gl_
, GetFloatv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1059 cmds::GetFloatv cmd
;
1060 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1061 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1062 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1063 result
->GetNumResults());
1064 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1067 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs0_0
) {
1068 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1069 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1070 cmds::GetFloatv::Result
* result
=
1071 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1073 cmds::GetFloatv cmd
;
1074 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1075 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1076 EXPECT_EQ(0u, result
->size
);
1077 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1080 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_0
) {
1081 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1082 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1083 cmds::GetFloatv::Result
* result
=
1084 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1086 cmds::GetFloatv cmd
;
1087 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1088 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1089 EXPECT_EQ(0u, result
->size
);
1092 TEST_P(GLES2DecoderTest1
, GetFloatvInvalidArgs1_1
) {
1093 EXPECT_CALL(*gl_
, GetFloatv(_
, _
)).Times(0);
1094 SpecializedSetup
<cmds::GetFloatv
, 0>(false);
1095 cmds::GetFloatv::Result
* result
=
1096 static_cast<cmds::GetFloatv::Result
*>(shared_memory_address_
);
1098 cmds::GetFloatv cmd
;
1099 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1100 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1101 EXPECT_EQ(0u, result
->size
);
1104 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivValidArgs
) {
1105 EXPECT_CALL(*gl_
, GetError())
1106 .WillOnce(Return(GL_NO_ERROR
))
1107 .WillOnce(Return(GL_NO_ERROR
))
1108 .RetiresOnSaturation();
1109 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(true);
1110 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result
;
1111 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1113 GetFramebufferAttachmentParameterivEXT(
1115 GL_COLOR_ATTACHMENT0
,
1116 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
,
1117 result
->GetData()));
1119 cmds::GetFramebufferAttachmentParameteriv cmd
;
1120 cmd
.Init(GL_FRAMEBUFFER
,
1121 GL_COLOR_ATTACHMENT0
,
1122 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
,
1124 shared_memory_offset_
);
1125 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1126 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1127 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
),
1128 result
->GetNumResults());
1129 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1132 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_0
) {
1133 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1135 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1136 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1137 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1138 shared_memory_address_
);
1140 cmds::GetFramebufferAttachmentParameteriv cmd
;
1141 cmd
.Init(GL_DRAW_FRAMEBUFFER
,
1142 GL_COLOR_ATTACHMENT0
,
1143 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
,
1145 shared_memory_offset_
);
1146 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1147 EXPECT_EQ(0u, result
->size
);
1148 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1151 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs0_1
) {
1152 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1154 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1155 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1156 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1157 shared_memory_address_
);
1159 cmds::GetFramebufferAttachmentParameteriv cmd
;
1160 cmd
.Init(GL_READ_FRAMEBUFFER
,
1161 GL_COLOR_ATTACHMENT0
,
1162 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
,
1164 shared_memory_offset_
);
1165 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1166 EXPECT_EQ(0u, result
->size
);
1167 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1170 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_0
) {
1171 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1173 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1174 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1175 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1176 shared_memory_address_
);
1178 cmds::GetFramebufferAttachmentParameteriv cmd
;
1179 cmd
.Init(GL_FRAMEBUFFER
,
1180 GL_COLOR_ATTACHMENT0
,
1181 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
,
1182 kInvalidSharedMemoryId
,
1184 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1185 EXPECT_EQ(0u, result
->size
);
1188 TEST_P(GLES2DecoderTest1
, GetFramebufferAttachmentParameterivInvalidArgs3_1
) {
1189 EXPECT_CALL(*gl_
, GetFramebufferAttachmentParameterivEXT(_
, _
, _
, _
))
1191 SpecializedSetup
<cmds::GetFramebufferAttachmentParameteriv
, 0>(false);
1192 cmds::GetFramebufferAttachmentParameteriv::Result
* result
=
1193 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result
*>(
1194 shared_memory_address_
);
1196 cmds::GetFramebufferAttachmentParameteriv cmd
;
1197 cmd
.Init(GL_FRAMEBUFFER
,
1198 GL_COLOR_ATTACHMENT0
,
1199 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
,
1201 kInvalidSharedMemoryOffset
);
1202 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1203 EXPECT_EQ(0u, result
->size
);
1206 TEST_P(GLES2DecoderTest1
, GetIntegervValidArgs
) {
1207 EXPECT_CALL(*gl_
, GetError())
1208 .WillOnce(Return(GL_NO_ERROR
))
1209 .WillOnce(Return(GL_NO_ERROR
))
1210 .RetiresOnSaturation();
1211 SpecializedSetup
<cmds::GetIntegerv
, 0>(true);
1212 typedef cmds::GetIntegerv::Result Result
;
1213 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1214 EXPECT_CALL(*gl_
, GetIntegerv(GL_ACTIVE_TEXTURE
, result
->GetData()));
1216 cmds::GetIntegerv cmd
;
1217 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, shared_memory_offset_
);
1218 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1219 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE
),
1220 result
->GetNumResults());
1221 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1224 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs0_0
) {
1225 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1226 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1227 cmds::GetIntegerv::Result
* result
=
1228 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1230 cmds::GetIntegerv cmd
;
1231 cmd
.Init(GL_FOG_HINT
, shared_memory_id_
, shared_memory_offset_
);
1232 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1233 EXPECT_EQ(0u, result
->size
);
1234 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1237 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_0
) {
1238 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1239 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1240 cmds::GetIntegerv::Result
* result
=
1241 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1243 cmds::GetIntegerv cmd
;
1244 cmd
.Init(GL_ACTIVE_TEXTURE
, kInvalidSharedMemoryId
, 0);
1245 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1246 EXPECT_EQ(0u, result
->size
);
1249 TEST_P(GLES2DecoderTest1
, GetIntegervInvalidArgs1_1
) {
1250 EXPECT_CALL(*gl_
, GetIntegerv(_
, _
)).Times(0);
1251 SpecializedSetup
<cmds::GetIntegerv
, 0>(false);
1252 cmds::GetIntegerv::Result
* result
=
1253 static_cast<cmds::GetIntegerv::Result
*>(shared_memory_address_
);
1255 cmds::GetIntegerv cmd
;
1256 cmd
.Init(GL_ACTIVE_TEXTURE
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1257 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1258 EXPECT_EQ(0u, result
->size
);
1261 TEST_P(GLES2DecoderTest1
, GetProgramivValidArgs
) {
1262 SpecializedSetup
<cmds::GetProgramiv
, 0>(true);
1263 typedef cmds::GetProgramiv::Result Result
;
1264 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1266 cmds::GetProgramiv cmd
;
1267 cmd
.Init(client_program_id_
,
1270 shared_memory_offset_
);
1271 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1272 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_DELETE_STATUS
),
1273 result
->GetNumResults());
1274 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1277 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_0
) {
1278 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1279 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1280 cmds::GetProgramiv::Result
* result
=
1281 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1283 cmds::GetProgramiv cmd
;
1284 cmd
.Init(client_program_id_
, GL_DELETE_STATUS
, kInvalidSharedMemoryId
, 0);
1285 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1286 EXPECT_EQ(0u, result
->size
);
1289 TEST_P(GLES2DecoderTest1
, GetProgramivInvalidArgs2_1
) {
1290 EXPECT_CALL(*gl_
, GetProgramiv(_
, _
, _
)).Times(0);
1291 SpecializedSetup
<cmds::GetProgramiv
, 0>(false);
1292 cmds::GetProgramiv::Result
* result
=
1293 static_cast<cmds::GetProgramiv::Result
*>(shared_memory_address_
);
1295 cmds::GetProgramiv cmd
;
1296 cmd
.Init(client_program_id_
,
1299 kInvalidSharedMemoryOffset
);
1300 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1301 EXPECT_EQ(0u, result
->size
);
1304 TEST_P(GLES2DecoderTest1
, GetProgramInfoLogValidArgs
) {
1305 const char* kInfo
= "hello";
1306 const uint32_t kBucketId
= 123;
1307 SpecializedSetup
<cmds::GetProgramInfoLog
, 0>(true);
1309 cmds::GetProgramInfoLog cmd
;
1310 cmd
.Init(client_program_id_
, kBucketId
);
1311 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1312 CommonDecoder::Bucket
* bucket
= decoder_
->GetBucket(kBucketId
);
1313 ASSERT_TRUE(bucket
!= NULL
);
1314 EXPECT_EQ(strlen(kInfo
) + 1, bucket
->size());
1316 memcmp(bucket
->GetData(0, bucket
->size()), kInfo
, bucket
->size()));
1317 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1320 TEST_P(GLES2DecoderTest1
, GetProgramInfoLogInvalidArgs
) {
1321 const uint32_t kBucketId
= 123;
1322 cmds::GetProgramInfoLog cmd
;
1323 cmd
.Init(kInvalidClientId
, kBucketId
);
1324 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1325 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1328 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivValidArgs
) {
1329 EXPECT_CALL(*gl_
, GetError())
1330 .WillOnce(Return(GL_NO_ERROR
))
1331 .WillOnce(Return(GL_NO_ERROR
))
1332 .RetiresOnSaturation();
1333 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(true);
1334 typedef cmds::GetRenderbufferParameteriv::Result Result
;
1335 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1338 GetRenderbufferParameterivEXT(
1339 GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, result
->GetData()));
1341 cmds::GetRenderbufferParameteriv cmd
;
1342 cmd
.Init(GL_RENDERBUFFER
,
1343 GL_RENDERBUFFER_RED_SIZE
,
1345 shared_memory_offset_
);
1346 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1347 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1348 GL_RENDERBUFFER_RED_SIZE
),
1349 result
->GetNumResults());
1350 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1353 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs0_0
) {
1354 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1355 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1356 cmds::GetRenderbufferParameteriv::Result
* result
=
1357 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1358 shared_memory_address_
);
1360 cmds::GetRenderbufferParameteriv cmd
;
1361 cmd
.Init(GL_FRAMEBUFFER
,
1362 GL_RENDERBUFFER_RED_SIZE
,
1364 shared_memory_offset_
);
1365 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1366 EXPECT_EQ(0u, result
->size
);
1367 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1370 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs2_0
) {
1371 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1372 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1373 cmds::GetRenderbufferParameteriv::Result
* result
=
1374 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1375 shared_memory_address_
);
1377 cmds::GetRenderbufferParameteriv cmd
;
1379 GL_RENDERBUFFER
, GL_RENDERBUFFER_RED_SIZE
, kInvalidSharedMemoryId
, 0);
1380 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1381 EXPECT_EQ(0u, result
->size
);
1384 TEST_P(GLES2DecoderTest1
, GetRenderbufferParameterivInvalidArgs2_1
) {
1385 EXPECT_CALL(*gl_
, GetRenderbufferParameterivEXT(_
, _
, _
)).Times(0);
1386 SpecializedSetup
<cmds::GetRenderbufferParameteriv
, 0>(false);
1387 cmds::GetRenderbufferParameteriv::Result
* result
=
1388 static_cast<cmds::GetRenderbufferParameteriv::Result
*>(
1389 shared_memory_address_
);
1391 cmds::GetRenderbufferParameteriv cmd
;
1392 cmd
.Init(GL_RENDERBUFFER
,
1393 GL_RENDERBUFFER_RED_SIZE
,
1395 kInvalidSharedMemoryOffset
);
1396 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1397 EXPECT_EQ(0u, result
->size
);
1400 TEST_P(GLES2DecoderTest1
, GetShaderivValidArgs
) {
1401 EXPECT_CALL(*gl_
, GetError())
1402 .WillOnce(Return(GL_NO_ERROR
))
1403 .WillOnce(Return(GL_NO_ERROR
))
1404 .RetiresOnSaturation();
1405 SpecializedSetup
<cmds::GetShaderiv
, 0>(true);
1406 typedef cmds::GetShaderiv::Result Result
;
1407 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1409 GetShaderiv(kServiceShaderId
, GL_SHADER_TYPE
, result
->GetData()));
1411 cmds::GetShaderiv cmd
;
1412 cmd
.Init(client_shader_id_
,
1415 shared_memory_offset_
);
1416 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1417 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_SHADER_TYPE
),
1418 result
->GetNumResults());
1419 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1422 TEST_P(GLES2DecoderTest1
, GetShaderivInvalidArgs2_0
) {
1423 EXPECT_CALL(*gl_
, GetShaderiv(_
, _
, _
)).Times(0);
1424 SpecializedSetup
<cmds::GetShaderiv
, 0>(false);
1425 cmds::GetShaderiv::Result
* result
=
1426 static_cast<cmds::GetShaderiv::Result
*>(shared_memory_address_
);
1428 cmds::GetShaderiv cmd
;
1429 cmd
.Init(client_shader_id_
, GL_SHADER_TYPE
, kInvalidSharedMemoryId
, 0);
1430 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1431 EXPECT_EQ(0u, result
->size
);
1434 TEST_P(GLES2DecoderTest1
, GetShaderivInvalidArgs2_1
) {
1435 EXPECT_CALL(*gl_
, GetShaderiv(_
, _
, _
)).Times(0);
1436 SpecializedSetup
<cmds::GetShaderiv
, 0>(false);
1437 cmds::GetShaderiv::Result
* result
=
1438 static_cast<cmds::GetShaderiv::Result
*>(shared_memory_address_
);
1440 cmds::GetShaderiv cmd
;
1441 cmd
.Init(client_shader_id_
,
1444 kInvalidSharedMemoryOffset
);
1445 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1446 EXPECT_EQ(0u, result
->size
);
1448 // TODO(gman): GetShaderInfoLog
1449 // TODO(gman): GetShaderPrecisionFormat
1451 // TODO(gman): GetShaderSource
1452 // TODO(gman): GetString
1454 TEST_P(GLES2DecoderTest1
, GetTexParameterfvValidArgs
) {
1455 EXPECT_CALL(*gl_
, GetError())
1456 .WillOnce(Return(GL_NO_ERROR
))
1457 .WillOnce(Return(GL_NO_ERROR
))
1458 .RetiresOnSaturation();
1459 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(true);
1460 typedef cmds::GetTexParameterfv::Result Result
;
1461 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1464 GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, result
->GetData()));
1466 cmds::GetTexParameterfv cmd
;
1467 cmd
.Init(GL_TEXTURE_2D
,
1468 GL_TEXTURE_MAG_FILTER
,
1470 shared_memory_offset_
);
1471 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1473 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1474 result
->GetNumResults());
1475 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1478 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs0_0
) {
1479 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1480 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1481 cmds::GetTexParameterfv::Result
* result
=
1482 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1484 cmds::GetTexParameterfv cmd
;
1485 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
,
1486 GL_TEXTURE_MAG_FILTER
,
1488 shared_memory_offset_
);
1489 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1490 EXPECT_EQ(0u, result
->size
);
1491 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1494 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs1_0
) {
1495 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1496 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1497 cmds::GetTexParameterfv::Result
* result
=
1498 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1500 cmds::GetTexParameterfv cmd
;
1501 cmd
.Init(GL_TEXTURE_2D
,
1504 shared_memory_offset_
);
1505 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1506 EXPECT_EQ(0u, result
->size
);
1507 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1510 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs2_0
) {
1511 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1512 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1513 cmds::GetTexParameterfv::Result
* result
=
1514 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1516 cmds::GetTexParameterfv cmd
;
1517 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, kInvalidSharedMemoryId
, 0);
1518 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1519 EXPECT_EQ(0u, result
->size
);
1522 TEST_P(GLES2DecoderTest1
, GetTexParameterfvInvalidArgs2_1
) {
1523 EXPECT_CALL(*gl_
, GetTexParameterfv(_
, _
, _
)).Times(0);
1524 SpecializedSetup
<cmds::GetTexParameterfv
, 0>(false);
1525 cmds::GetTexParameterfv::Result
* result
=
1526 static_cast<cmds::GetTexParameterfv::Result
*>(shared_memory_address_
);
1528 cmds::GetTexParameterfv cmd
;
1529 cmd
.Init(GL_TEXTURE_2D
,
1530 GL_TEXTURE_MAG_FILTER
,
1532 kInvalidSharedMemoryOffset
);
1533 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1534 EXPECT_EQ(0u, result
->size
);
1537 TEST_P(GLES2DecoderTest1
, GetTexParameterivValidArgs
) {
1538 EXPECT_CALL(*gl_
, GetError())
1539 .WillOnce(Return(GL_NO_ERROR
))
1540 .WillOnce(Return(GL_NO_ERROR
))
1541 .RetiresOnSaturation();
1542 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(true);
1543 typedef cmds::GetTexParameteriv::Result Result
;
1544 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1547 GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, result
->GetData()));
1549 cmds::GetTexParameteriv cmd
;
1550 cmd
.Init(GL_TEXTURE_2D
,
1551 GL_TEXTURE_MAG_FILTER
,
1553 shared_memory_offset_
);
1554 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1556 decoder_
->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER
),
1557 result
->GetNumResults());
1558 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1561 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs0_0
) {
1562 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1563 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1564 cmds::GetTexParameteriv::Result
* result
=
1565 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1567 cmds::GetTexParameteriv cmd
;
1568 cmd
.Init(GL_PROXY_TEXTURE_CUBE_MAP
,
1569 GL_TEXTURE_MAG_FILTER
,
1571 shared_memory_offset_
);
1572 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1573 EXPECT_EQ(0u, result
->size
);
1574 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1577 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs1_0
) {
1578 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1579 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1580 cmds::GetTexParameteriv::Result
* result
=
1581 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1583 cmds::GetTexParameteriv cmd
;
1584 cmd
.Init(GL_TEXTURE_2D
,
1587 shared_memory_offset_
);
1588 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1589 EXPECT_EQ(0u, result
->size
);
1590 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1593 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs2_0
) {
1594 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1595 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1596 cmds::GetTexParameteriv::Result
* result
=
1597 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1599 cmds::GetTexParameteriv cmd
;
1600 cmd
.Init(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, kInvalidSharedMemoryId
, 0);
1601 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1602 EXPECT_EQ(0u, result
->size
);
1605 TEST_P(GLES2DecoderTest1
, GetTexParameterivInvalidArgs2_1
) {
1606 EXPECT_CALL(*gl_
, GetTexParameteriv(_
, _
, _
)).Times(0);
1607 SpecializedSetup
<cmds::GetTexParameteriv
, 0>(false);
1608 cmds::GetTexParameteriv::Result
* result
=
1609 static_cast<cmds::GetTexParameteriv::Result
*>(shared_memory_address_
);
1611 cmds::GetTexParameteriv cmd
;
1612 cmd
.Init(GL_TEXTURE_2D
,
1613 GL_TEXTURE_MAG_FILTER
,
1615 kInvalidSharedMemoryOffset
);
1616 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1617 EXPECT_EQ(0u, result
->size
);
1619 // TODO(gman): GetUniformfv
1621 // TODO(gman): GetUniformiv
1623 // TODO(gman): GetUniformLocation
1625 TEST_P(GLES2DecoderTest1
, GetVertexAttribfvValidArgs
) {
1626 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(true);
1627 typedef cmds::GetVertexAttribfv::Result Result
;
1628 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1630 cmds::GetVertexAttribfv cmd
;
1632 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
,
1634 shared_memory_offset_
);
1635 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1636 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1637 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
),
1638 result
->GetNumResults());
1639 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1642 TEST_P(GLES2DecoderTest1
, GetVertexAttribfvInvalidArgs2_0
) {
1643 EXPECT_CALL(*gl_
, GetVertexAttribfv(_
, _
, _
)).Times(0);
1644 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(false);
1645 cmds::GetVertexAttribfv::Result
* result
=
1646 static_cast<cmds::GetVertexAttribfv::Result
*>(shared_memory_address_
);
1648 cmds::GetVertexAttribfv cmd
;
1649 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, kInvalidSharedMemoryId
, 0);
1650 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1651 EXPECT_EQ(0u, result
->size
);
1654 TEST_P(GLES2DecoderTest1
, GetVertexAttribfvInvalidArgs2_1
) {
1655 EXPECT_CALL(*gl_
, GetVertexAttribfv(_
, _
, _
)).Times(0);
1656 SpecializedSetup
<cmds::GetVertexAttribfv
, 0>(false);
1657 cmds::GetVertexAttribfv::Result
* result
=
1658 static_cast<cmds::GetVertexAttribfv::Result
*>(shared_memory_address_
);
1660 cmds::GetVertexAttribfv cmd
;
1662 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
,
1664 kInvalidSharedMemoryOffset
);
1665 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1666 EXPECT_EQ(0u, result
->size
);
1669 TEST_P(GLES2DecoderTest1
, GetVertexAttribivValidArgs
) {
1670 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(true);
1671 typedef cmds::GetVertexAttribiv::Result Result
;
1672 Result
* result
= static_cast<Result
*>(shared_memory_address_
);
1674 cmds::GetVertexAttribiv cmd
;
1676 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
,
1678 shared_memory_offset_
);
1679 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1680 EXPECT_EQ(decoder_
->GetGLES2Util()->GLGetNumValuesReturned(
1681 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
),
1682 result
->GetNumResults());
1683 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1686 TEST_P(GLES2DecoderTest1
, GetVertexAttribivInvalidArgs2_0
) {
1687 EXPECT_CALL(*gl_
, GetVertexAttribiv(_
, _
, _
)).Times(0);
1688 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(false);
1689 cmds::GetVertexAttribiv::Result
* result
=
1690 static_cast<cmds::GetVertexAttribiv::Result
*>(shared_memory_address_
);
1692 cmds::GetVertexAttribiv cmd
;
1693 cmd
.Init(1, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
, kInvalidSharedMemoryId
, 0);
1694 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1695 EXPECT_EQ(0u, result
->size
);
1698 TEST_P(GLES2DecoderTest1
, GetVertexAttribivInvalidArgs2_1
) {
1699 EXPECT_CALL(*gl_
, GetVertexAttribiv(_
, _
, _
)).Times(0);
1700 SpecializedSetup
<cmds::GetVertexAttribiv
, 0>(false);
1701 cmds::GetVertexAttribiv::Result
* result
=
1702 static_cast<cmds::GetVertexAttribiv::Result
*>(shared_memory_address_
);
1704 cmds::GetVertexAttribiv cmd
;
1706 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
,
1708 kInvalidSharedMemoryOffset
);
1709 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1710 EXPECT_EQ(0u, result
->size
);
1712 // TODO(gman): GetVertexAttribPointerv
1714 TEST_P(GLES2DecoderTest1
, HintValidArgs
) {
1715 EXPECT_CALL(*gl_
, Hint(GL_GENERATE_MIPMAP_HINT
, GL_FASTEST
));
1716 SpecializedSetup
<cmds::Hint
, 0>(true);
1718 cmd
.Init(GL_GENERATE_MIPMAP_HINT
, GL_FASTEST
);
1719 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1720 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1723 TEST_P(GLES2DecoderTest1
, HintInvalidArgs0_0
) {
1724 EXPECT_CALL(*gl_
, Hint(_
, _
)).Times(0);
1725 SpecializedSetup
<cmds::Hint
, 0>(false);
1727 cmd
.Init(GL_PERSPECTIVE_CORRECTION_HINT
, GL_FASTEST
);
1728 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1729 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1732 TEST_P(GLES2DecoderTest1
, IsBufferValidArgs
) {
1733 SpecializedSetup
<cmds::IsBuffer
, 0>(true);
1735 cmd
.Init(client_buffer_id_
, shared_memory_id_
, shared_memory_offset_
);
1736 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1737 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1740 TEST_P(GLES2DecoderTest1
, IsBufferInvalidArgsBadSharedMemoryId
) {
1741 SpecializedSetup
<cmds::IsBuffer
, 0>(false);
1743 cmd
.Init(client_buffer_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1744 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1745 cmd
.Init(client_buffer_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1746 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1749 TEST_P(GLES2DecoderTest1
, IsEnabledValidArgs
) {
1750 SpecializedSetup
<cmds::IsEnabled
, 0>(true);
1751 cmds::IsEnabled cmd
;
1752 cmd
.Init(GL_BLEND
, shared_memory_id_
, shared_memory_offset_
);
1753 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1754 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1757 TEST_P(GLES2DecoderTest1
, IsEnabledInvalidArgs0_0
) {
1758 EXPECT_CALL(*gl_
, IsEnabled(_
)).Times(0);
1759 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
1760 cmds::IsEnabled cmd
;
1761 cmd
.Init(GL_CLIP_PLANE0
, shared_memory_id_
, shared_memory_offset_
);
1762 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1763 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1766 TEST_P(GLES2DecoderTest1
, IsEnabledInvalidArgs0_1
) {
1767 EXPECT_CALL(*gl_
, IsEnabled(_
)).Times(0);
1768 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
1769 cmds::IsEnabled cmd
;
1770 cmd
.Init(GL_POINT_SPRITE
, shared_memory_id_
, shared_memory_offset_
);
1771 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1772 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1775 TEST_P(GLES2DecoderTest1
, IsEnabledInvalidArgsBadSharedMemoryId
) {
1776 SpecializedSetup
<cmds::IsEnabled
, 0>(false);
1777 cmds::IsEnabled cmd
;
1778 cmd
.Init(GL_BLEND
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1779 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1780 cmd
.Init(GL_BLEND
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1781 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1784 TEST_P(GLES2DecoderTest1
, IsFramebufferValidArgs
) {
1785 SpecializedSetup
<cmds::IsFramebuffer
, 0>(true);
1786 cmds::IsFramebuffer cmd
;
1787 cmd
.Init(client_framebuffer_id_
, shared_memory_id_
, shared_memory_offset_
);
1788 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1789 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1792 TEST_P(GLES2DecoderTest1
, IsFramebufferInvalidArgsBadSharedMemoryId
) {
1793 SpecializedSetup
<cmds::IsFramebuffer
, 0>(false);
1794 cmds::IsFramebuffer cmd
;
1796 client_framebuffer_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1797 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1799 client_framebuffer_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1800 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1803 TEST_P(GLES2DecoderTest1
, IsProgramValidArgs
) {
1804 SpecializedSetup
<cmds::IsProgram
, 0>(true);
1805 cmds::IsProgram cmd
;
1806 cmd
.Init(client_program_id_
, shared_memory_id_
, shared_memory_offset_
);
1807 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1808 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1811 TEST_P(GLES2DecoderTest1
, IsProgramInvalidArgsBadSharedMemoryId
) {
1812 SpecializedSetup
<cmds::IsProgram
, 0>(false);
1813 cmds::IsProgram cmd
;
1814 cmd
.Init(client_program_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1815 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1816 cmd
.Init(client_program_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1817 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1820 TEST_P(GLES2DecoderTest1
, IsRenderbufferValidArgs
) {
1821 SpecializedSetup
<cmds::IsRenderbuffer
, 0>(true);
1822 cmds::IsRenderbuffer cmd
;
1823 cmd
.Init(client_renderbuffer_id_
, shared_memory_id_
, shared_memory_offset_
);
1824 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1825 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1828 TEST_P(GLES2DecoderTest1
, IsRenderbufferInvalidArgsBadSharedMemoryId
) {
1829 SpecializedSetup
<cmds::IsRenderbuffer
, 0>(false);
1830 cmds::IsRenderbuffer cmd
;
1832 client_renderbuffer_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1833 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1835 client_renderbuffer_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1836 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1839 TEST_P(GLES2DecoderTest1
, IsShaderValidArgs
) {
1840 SpecializedSetup
<cmds::IsShader
, 0>(true);
1842 cmd
.Init(client_shader_id_
, shared_memory_id_
, shared_memory_offset_
);
1843 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1844 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1847 TEST_P(GLES2DecoderTest1
, IsShaderInvalidArgsBadSharedMemoryId
) {
1848 SpecializedSetup
<cmds::IsShader
, 0>(false);
1850 cmd
.Init(client_shader_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1851 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1852 cmd
.Init(client_shader_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1853 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1856 TEST_P(GLES2DecoderTest1
, IsTextureValidArgs
) {
1857 SpecializedSetup
<cmds::IsTexture
, 0>(true);
1858 cmds::IsTexture cmd
;
1859 cmd
.Init(client_texture_id_
, shared_memory_id_
, shared_memory_offset_
);
1860 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1861 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1864 TEST_P(GLES2DecoderTest1
, IsTextureInvalidArgsBadSharedMemoryId
) {
1865 SpecializedSetup
<cmds::IsTexture
, 0>(false);
1866 cmds::IsTexture cmd
;
1867 cmd
.Init(client_texture_id_
, kInvalidSharedMemoryId
, shared_memory_offset_
);
1868 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1869 cmd
.Init(client_texture_id_
, shared_memory_id_
, kInvalidSharedMemoryOffset
);
1870 EXPECT_EQ(error::kOutOfBounds
, ExecuteCmd(cmd
));
1873 TEST_P(GLES2DecoderTest1
, LineWidthValidArgs
) {
1874 EXPECT_CALL(*gl_
, LineWidth(0.5f
));
1875 SpecializedSetup
<cmds::LineWidth
, 0>(true);
1876 cmds::LineWidth cmd
;
1878 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1879 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1882 TEST_P(GLES2DecoderTest1
, LineWidthInvalidValue0_0
) {
1883 SpecializedSetup
<cmds::LineWidth
, 0>(false);
1884 cmds::LineWidth cmd
;
1886 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1887 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1890 TEST_P(GLES2DecoderTest1
, LineWidthNaNValue0
) {
1891 SpecializedSetup
<cmds::LineWidth
, 0>(false);
1892 cmds::LineWidth cmd
;
1894 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1895 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1898 TEST_P(GLES2DecoderTest1
, LinkProgramValidArgs
) {
1899 EXPECT_CALL(*gl_
, LinkProgram(kServiceProgramId
));
1900 SpecializedSetup
<cmds::LinkProgram
, 0>(true);
1901 cmds::LinkProgram cmd
;
1902 cmd
.Init(client_program_id_
);
1903 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1904 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1906 // TODO(gman): PixelStorei
1908 TEST_P(GLES2DecoderTest1
, PolygonOffsetValidArgs
) {
1909 EXPECT_CALL(*gl_
, PolygonOffset(1, 2));
1910 SpecializedSetup
<cmds::PolygonOffset
, 0>(true);
1911 cmds::PolygonOffset cmd
;
1913 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1914 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1916 // TODO(gman): ReadPixels
1918 // TODO(gman): ReleaseShaderCompiler
1920 TEST_P(GLES2DecoderTest1
, RenderbufferStorageValidArgs
) {
1921 SpecializedSetup
<cmds::RenderbufferStorage
, 0>(true);
1922 cmds::RenderbufferStorage cmd
;
1923 cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, 3, 4);
1924 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1925 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1928 TEST_P(GLES2DecoderTest1
, RenderbufferStorageInvalidArgs0_0
) {
1929 EXPECT_CALL(*gl_
, RenderbufferStorageEXT(_
, _
, _
, _
)).Times(0);
1930 SpecializedSetup
<cmds::RenderbufferStorage
, 0>(false);
1931 cmds::RenderbufferStorage cmd
;
1932 cmd
.Init(GL_FRAMEBUFFER
, GL_RGBA4
, 3, 4);
1933 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1934 EXPECT_EQ(GL_INVALID_ENUM
, GetGLError());
1937 TEST_P(GLES2DecoderTest1
, RenderbufferStorageInvalidArgs2_0
) {
1938 EXPECT_CALL(*gl_
, RenderbufferStorageEXT(_
, _
, _
, _
)).Times(0);
1939 SpecializedSetup
<cmds::RenderbufferStorage
, 0>(false);
1940 cmds::RenderbufferStorage cmd
;
1941 cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, -1, 4);
1942 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1943 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1946 TEST_P(GLES2DecoderTest1
, RenderbufferStorageInvalidArgs3_0
) {
1947 EXPECT_CALL(*gl_
, RenderbufferStorageEXT(_
, _
, _
, _
)).Times(0);
1948 SpecializedSetup
<cmds::RenderbufferStorage
, 0>(false);
1949 cmds::RenderbufferStorage cmd
;
1950 cmd
.Init(GL_RENDERBUFFER
, GL_RGBA4
, 3, -1);
1951 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1952 EXPECT_EQ(GL_INVALID_VALUE
, GetGLError());
1955 TEST_P(GLES2DecoderTest1
, SampleCoverageValidArgs
) {
1956 EXPECT_CALL(*gl_
, SampleCoverage(1, true));
1957 SpecializedSetup
<cmds::SampleCoverage
, 0>(true);
1958 cmds::SampleCoverage cmd
;
1960 EXPECT_EQ(error::kNoError
, ExecuteCmd(cmd
));
1961 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
1963 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_