Rewrite AndroidSyncSettings to be significantly simpler.
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_unittest_1_autogen.h
blobf03d3a53c7f6bd9a56df43caea747689b32adc38
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
9 // DO NOT EDIT!
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);
30 cmds::BindBuffer cmd;
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);
41 cmds::BindBuffer cmd;
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);
51 cmds::BindBuffer cmd;
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) {
58 EXPECT_CALL(
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) {
71 EXPECT_CALL(*gl_,
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) {
155 EXPECT_CALL(*gl_,
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;
271 cmd.Init(GL_MIN);
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;
280 cmd.Init(GL_MAX);
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);
333 cmds::BlendFunc cmd;
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);
391 cmds::Clear cmd;
392 cmd.Init(1);
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);
413 GLfloat temp[4] = {
416 cmd.Init(GL_COLOR, 2, &temp[0]);
417 EXPECT_CALL(*gl_,
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);
431 GLint temp[4] = {
434 cmd.Init(GL_COLOR, 2, &temp[0]);
435 EXPECT_CALL(*gl_, ClearBufferiv(
436 GL_COLOR, 2,
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);
449 GLuint temp[4] = {
452 cmd.Init(GL_COLOR, 2, &temp[0]);
453 EXPECT_CALL(*gl_, ClearBufferuiv(
454 GL_COLOR, 2,
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;
476 cmd.Init(0.5f);
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;
485 cmd.Init(1);
486 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
487 EXPECT_EQ(GL_NO_ERROR, GetGLError());
489 // TODO(gman): ClientWaitSync
491 TEST_P(GLES2DecoderTest1, ColorMaskValidArgs) {
492 SpecializedSetup<cmds::ColorMask, 0>(true);
493 cmds::ColorMask cmd;
494 cmd.Init(true, true, true, true);
495 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
496 EXPECT_EQ(GL_NO_ERROR, GetGLError());
498 // TODO(gman): CompileShader
499 // TODO(gman): CompressedTexImage2DBucket
500 // TODO(gman): CompressedTexImage2D
502 // TODO(gman): CompressedTexSubImage2DBucket
503 // TODO(gman): CompressedTexSubImage2D
505 TEST_P(GLES2DecoderTest1, CopyBufferSubDataValidArgs) {
506 EXPECT_CALL(*gl_,
507 CopyBufferSubData(GL_ARRAY_BUFFER, GL_ARRAY_BUFFER, 3, 4, 5));
508 SpecializedSetup<cmds::CopyBufferSubData, 0>(true);
509 cmds::CopyBufferSubData cmd;
510 cmd.Init(GL_ARRAY_BUFFER, GL_ARRAY_BUFFER, 3, 4, 5);
511 decoder_->set_unsafe_es3_apis_enabled(true);
512 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
513 EXPECT_EQ(GL_NO_ERROR, GetGLError());
514 decoder_->set_unsafe_es3_apis_enabled(false);
515 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
517 // TODO(gman): CopyTexImage2D
519 TEST_P(GLES2DecoderTest1, CopyTexSubImage2DValidArgs) {
520 EXPECT_CALL(*gl_, CopyTexSubImage2D(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8));
521 SpecializedSetup<cmds::CopyTexSubImage2D, 0>(true);
522 cmds::CopyTexSubImage2D cmd;
523 cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, 8);
524 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
525 EXPECT_EQ(GL_NO_ERROR, GetGLError());
528 TEST_P(GLES2DecoderTest1, CopyTexSubImage2DInvalidArgs0_0) {
529 EXPECT_CALL(*gl_, CopyTexSubImage2D(_, _, _, _, _, _, _, _)).Times(0);
530 SpecializedSetup<cmds::CopyTexSubImage2D, 0>(false);
531 cmds::CopyTexSubImage2D cmd;
532 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, 2, 3, 4, 5, 6, 7, 8);
533 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
534 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
537 TEST_P(GLES2DecoderTest1, CopyTexSubImage2DInvalidArgs6_0) {
538 EXPECT_CALL(*gl_, CopyTexSubImage2D(_, _, _, _, _, _, _, _)).Times(0);
539 SpecializedSetup<cmds::CopyTexSubImage2D, 0>(false);
540 cmds::CopyTexSubImage2D cmd;
541 cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5, 6, -1, 8);
542 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
543 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
546 TEST_P(GLES2DecoderTest1, CopyTexSubImage2DInvalidArgs7_0) {
547 EXPECT_CALL(*gl_, CopyTexSubImage2D(_, _, _, _, _, _, _, _)).Times(0);
548 SpecializedSetup<cmds::CopyTexSubImage2D, 0>(false);
549 cmds::CopyTexSubImage2D cmd;
550 cmd.Init(GL_TEXTURE_2D, 2, 3, 4, 5, 6, 7, -1);
551 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
552 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
555 TEST_P(GLES2DecoderTest1, CopyTexSubImage3DValidArgs) {
556 EXPECT_CALL(*gl_, CopyTexSubImage3D(GL_TEXTURE_3D, 2, 3, 4, 5, 6, 7, 8, 9));
557 SpecializedSetup<cmds::CopyTexSubImage3D, 0>(true);
558 cmds::CopyTexSubImage3D cmd;
559 cmd.Init(GL_TEXTURE_3D, 2, 3, 4, 5, 6, 7, 8, 9);
560 decoder_->set_unsafe_es3_apis_enabled(true);
561 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
562 EXPECT_EQ(GL_NO_ERROR, GetGLError());
563 decoder_->set_unsafe_es3_apis_enabled(false);
564 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
567 TEST_P(GLES2DecoderTest1, CreateProgramValidArgs) {
568 EXPECT_CALL(*gl_, CreateProgram()).WillOnce(Return(kNewServiceId));
569 SpecializedSetup<cmds::CreateProgram, 0>(true);
570 cmds::CreateProgram cmd;
571 cmd.Init(kNewClientId);
572 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
573 EXPECT_EQ(GL_NO_ERROR, GetGLError());
574 EXPECT_TRUE(GetProgram(kNewClientId));
577 TEST_P(GLES2DecoderTest1, CreateShaderValidArgs) {
578 EXPECT_CALL(*gl_, CreateShader(GL_VERTEX_SHADER))
579 .WillOnce(Return(kNewServiceId));
580 SpecializedSetup<cmds::CreateShader, 0>(true);
581 cmds::CreateShader cmd;
582 cmd.Init(GL_VERTEX_SHADER, kNewClientId);
583 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
584 EXPECT_EQ(GL_NO_ERROR, GetGLError());
585 EXPECT_TRUE(GetShader(kNewClientId));
588 TEST_P(GLES2DecoderTest1, CreateShaderInvalidArgs0_0) {
589 EXPECT_CALL(*gl_, CreateShader(_)).Times(0);
590 SpecializedSetup<cmds::CreateShader, 0>(false);
591 cmds::CreateShader cmd;
592 cmd.Init(GL_GEOMETRY_SHADER, kNewClientId);
593 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
594 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
597 TEST_P(GLES2DecoderTest1, CullFaceValidArgs) {
598 EXPECT_CALL(*gl_, CullFace(GL_FRONT));
599 SpecializedSetup<cmds::CullFace, 0>(true);
600 cmds::CullFace cmd;
601 cmd.Init(GL_FRONT);
602 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
603 EXPECT_EQ(GL_NO_ERROR, GetGLError());
606 TEST_P(GLES2DecoderTest1, DeleteBuffersImmediateValidArgs) {
607 EXPECT_CALL(*gl_, DeleteBuffersARB(1, Pointee(kServiceBufferId))).Times(1);
608 cmds::DeleteBuffersImmediate& cmd =
609 *GetImmediateAs<cmds::DeleteBuffersImmediate>();
610 SpecializedSetup<cmds::DeleteBuffersImmediate, 0>(true);
611 cmd.Init(1, &client_buffer_id_);
612 EXPECT_EQ(error::kNoError,
613 ExecuteImmediateCmd(cmd, sizeof(client_buffer_id_)));
614 EXPECT_EQ(GL_NO_ERROR, GetGLError());
615 EXPECT_TRUE(GetBuffer(client_buffer_id_) == NULL);
618 TEST_P(GLES2DecoderTest1, DeleteBuffersImmediateInvalidArgs) {
619 cmds::DeleteBuffersImmediate& cmd =
620 *GetImmediateAs<cmds::DeleteBuffersImmediate>();
621 SpecializedSetup<cmds::DeleteBuffersImmediate, 0>(false);
622 GLuint temp = kInvalidClientId;
623 cmd.Init(1, &temp);
624 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
627 TEST_P(GLES2DecoderTest1, DeleteFramebuffersImmediateValidArgs) {
628 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, Pointee(kServiceFramebufferId)))
629 .Times(1);
630 cmds::DeleteFramebuffersImmediate& cmd =
631 *GetImmediateAs<cmds::DeleteFramebuffersImmediate>();
632 SpecializedSetup<cmds::DeleteFramebuffersImmediate, 0>(true);
633 cmd.Init(1, &client_framebuffer_id_);
634 EXPECT_EQ(error::kNoError,
635 ExecuteImmediateCmd(cmd, sizeof(client_framebuffer_id_)));
636 EXPECT_EQ(GL_NO_ERROR, GetGLError());
637 EXPECT_TRUE(GetFramebuffer(client_framebuffer_id_) == NULL);
640 TEST_P(GLES2DecoderTest1, DeleteFramebuffersImmediateInvalidArgs) {
641 cmds::DeleteFramebuffersImmediate& cmd =
642 *GetImmediateAs<cmds::DeleteFramebuffersImmediate>();
643 SpecializedSetup<cmds::DeleteFramebuffersImmediate, 0>(false);
644 GLuint temp = kInvalidClientId;
645 cmd.Init(1, &temp);
646 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
649 TEST_P(GLES2DecoderTest1, DeleteProgramValidArgs) {
650 EXPECT_CALL(*gl_, DeleteProgram(kServiceProgramId));
651 SpecializedSetup<cmds::DeleteProgram, 0>(true);
652 cmds::DeleteProgram cmd;
653 cmd.Init(client_program_id_);
654 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
655 EXPECT_EQ(GL_NO_ERROR, GetGLError());
658 TEST_P(GLES2DecoderTest1, DeleteRenderbuffersImmediateValidArgs) {
659 EXPECT_CALL(*gl_, DeleteRenderbuffersEXT(1, Pointee(kServiceRenderbufferId)))
660 .Times(1);
661 cmds::DeleteRenderbuffersImmediate& cmd =
662 *GetImmediateAs<cmds::DeleteRenderbuffersImmediate>();
663 SpecializedSetup<cmds::DeleteRenderbuffersImmediate, 0>(true);
664 cmd.Init(1, &client_renderbuffer_id_);
665 EXPECT_EQ(error::kNoError,
666 ExecuteImmediateCmd(cmd, sizeof(client_renderbuffer_id_)));
667 EXPECT_EQ(GL_NO_ERROR, GetGLError());
668 EXPECT_TRUE(GetRenderbuffer(client_renderbuffer_id_) == NULL);
671 TEST_P(GLES2DecoderTest1, DeleteRenderbuffersImmediateInvalidArgs) {
672 cmds::DeleteRenderbuffersImmediate& cmd =
673 *GetImmediateAs<cmds::DeleteRenderbuffersImmediate>();
674 SpecializedSetup<cmds::DeleteRenderbuffersImmediate, 0>(false);
675 GLuint temp = kInvalidClientId;
676 cmd.Init(1, &temp);
677 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
680 TEST_P(GLES2DecoderTest1, DeleteSamplersImmediateValidArgs) {
681 EXPECT_CALL(*gl_, DeleteSamplers(1, Pointee(kServiceSamplerId))).Times(1);
682 cmds::DeleteSamplersImmediate& cmd =
683 *GetImmediateAs<cmds::DeleteSamplersImmediate>();
684 SpecializedSetup<cmds::DeleteSamplersImmediate, 0>(true);
685 cmd.Init(1, &client_sampler_id_);
686 decoder_->set_unsafe_es3_apis_enabled(true);
687 EXPECT_EQ(error::kNoError,
688 ExecuteImmediateCmd(cmd, sizeof(client_sampler_id_)));
689 EXPECT_EQ(GL_NO_ERROR, GetGLError());
690 EXPECT_FALSE(GetSamplerServiceId(client_sampler_id_, NULL));
691 decoder_->set_unsafe_es3_apis_enabled(false);
692 EXPECT_EQ(error::kUnknownCommand,
693 ExecuteImmediateCmd(cmd, sizeof(client_sampler_id_)));
696 TEST_P(GLES2DecoderTest1, DeleteSamplersImmediateInvalidArgs) {
697 cmds::DeleteSamplersImmediate& cmd =
698 *GetImmediateAs<cmds::DeleteSamplersImmediate>();
699 SpecializedSetup<cmds::DeleteSamplersImmediate, 0>(false);
700 GLuint temp = kInvalidClientId;
701 cmd.Init(1, &temp);
702 decoder_->set_unsafe_es3_apis_enabled(true);
703 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
704 decoder_->set_unsafe_es3_apis_enabled(false);
705 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
708 TEST_P(GLES2DecoderTest1, DeleteSyncValidArgs) {
709 EXPECT_CALL(*gl_, DeleteSync(reinterpret_cast<GLsync>(kServiceSyncId)));
710 SpecializedSetup<cmds::DeleteSync, 0>(true);
711 cmds::DeleteSync cmd;
712 cmd.Init(client_sync_id_);
713 decoder_->set_unsafe_es3_apis_enabled(true);
714 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
715 EXPECT_EQ(GL_NO_ERROR, GetGLError());
716 decoder_->set_unsafe_es3_apis_enabled(false);
717 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
720 TEST_P(GLES2DecoderTest1, DeleteShaderValidArgs) {
721 EXPECT_CALL(*gl_, DeleteShader(kServiceShaderId));
722 SpecializedSetup<cmds::DeleteShader, 0>(true);
723 cmds::DeleteShader cmd;
724 cmd.Init(client_shader_id_);
725 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
726 EXPECT_EQ(GL_NO_ERROR, GetGLError());
729 TEST_P(GLES2DecoderTest1, DeleteTexturesImmediateValidArgs) {
730 EXPECT_CALL(*gl_, DeleteTextures(1, Pointee(kServiceTextureId))).Times(1);
731 cmds::DeleteTexturesImmediate& cmd =
732 *GetImmediateAs<cmds::DeleteTexturesImmediate>();
733 SpecializedSetup<cmds::DeleteTexturesImmediate, 0>(true);
734 cmd.Init(1, &client_texture_id_);
735 EXPECT_EQ(error::kNoError,
736 ExecuteImmediateCmd(cmd, sizeof(client_texture_id_)));
737 EXPECT_EQ(GL_NO_ERROR, GetGLError());
738 EXPECT_TRUE(GetTexture(client_texture_id_) == NULL);
741 TEST_P(GLES2DecoderTest1, DeleteTexturesImmediateInvalidArgs) {
742 cmds::DeleteTexturesImmediate& cmd =
743 *GetImmediateAs<cmds::DeleteTexturesImmediate>();
744 SpecializedSetup<cmds::DeleteTexturesImmediate, 0>(false);
745 GLuint temp = kInvalidClientId;
746 cmd.Init(1, &temp);
747 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
750 TEST_P(GLES2DecoderTest1, DeleteTransformFeedbacksImmediateValidArgs) {
751 EXPECT_CALL(*gl_, DeleteTransformFeedbacks(
752 1, Pointee(kServiceTransformFeedbackId))).Times(1);
753 cmds::DeleteTransformFeedbacksImmediate& cmd =
754 *GetImmediateAs<cmds::DeleteTransformFeedbacksImmediate>();
755 SpecializedSetup<cmds::DeleteTransformFeedbacksImmediate, 0>(true);
756 cmd.Init(1, &client_transformfeedback_id_);
757 decoder_->set_unsafe_es3_apis_enabled(true);
758 EXPECT_EQ(error::kNoError,
759 ExecuteImmediateCmd(cmd, sizeof(client_transformfeedback_id_)));
760 EXPECT_EQ(GL_NO_ERROR, GetGLError());
761 EXPECT_FALSE(
762 GetTransformFeedbackServiceId(client_transformfeedback_id_, NULL));
763 decoder_->set_unsafe_es3_apis_enabled(false);
764 EXPECT_EQ(error::kUnknownCommand,
765 ExecuteImmediateCmd(cmd, sizeof(client_transformfeedback_id_)));
768 TEST_P(GLES2DecoderTest1, DeleteTransformFeedbacksImmediateInvalidArgs) {
769 cmds::DeleteTransformFeedbacksImmediate& cmd =
770 *GetImmediateAs<cmds::DeleteTransformFeedbacksImmediate>();
771 SpecializedSetup<cmds::DeleteTransformFeedbacksImmediate, 0>(false);
772 GLuint temp = kInvalidClientId;
773 cmd.Init(1, &temp);
774 decoder_->set_unsafe_es3_apis_enabled(true);
775 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
776 decoder_->set_unsafe_es3_apis_enabled(false);
777 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
780 TEST_P(GLES2DecoderTest1, DepthFuncValidArgs) {
781 EXPECT_CALL(*gl_, DepthFunc(GL_NEVER));
782 SpecializedSetup<cmds::DepthFunc, 0>(true);
783 cmds::DepthFunc cmd;
784 cmd.Init(GL_NEVER);
785 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
786 EXPECT_EQ(GL_NO_ERROR, GetGLError());
789 TEST_P(GLES2DecoderTest1, DepthMaskValidArgs) {
790 SpecializedSetup<cmds::DepthMask, 0>(true);
791 cmds::DepthMask cmd;
792 cmd.Init(true);
793 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
794 EXPECT_EQ(GL_NO_ERROR, GetGLError());
797 TEST_P(GLES2DecoderTest1, DepthRangefValidArgs) {
798 EXPECT_CALL(*gl_, DepthRange(1, 2));
799 SpecializedSetup<cmds::DepthRangef, 0>(true);
800 cmds::DepthRangef cmd;
801 cmd.Init(1, 2);
802 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
803 EXPECT_EQ(GL_NO_ERROR, GetGLError());
806 TEST_P(GLES2DecoderTest1, DetachShaderValidArgs) {
807 EXPECT_CALL(*gl_, DetachShader(kServiceProgramId, kServiceShaderId));
808 SpecializedSetup<cmds::DetachShader, 0>(true);
809 cmds::DetachShader cmd;
810 cmd.Init(client_program_id_, client_shader_id_);
811 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
812 EXPECT_EQ(GL_NO_ERROR, GetGLError());
815 TEST_P(GLES2DecoderTest1, DisableValidArgs) {
816 SetupExpectationsForEnableDisable(GL_BLEND, false);
817 SpecializedSetup<cmds::Disable, 0>(true);
818 cmds::Disable cmd;
819 cmd.Init(GL_BLEND);
820 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
821 EXPECT_EQ(GL_NO_ERROR, GetGLError());
824 TEST_P(GLES2DecoderTest1, DisableInvalidArgs0_0) {
825 EXPECT_CALL(*gl_, Disable(_)).Times(0);
826 SpecializedSetup<cmds::Disable, 0>(false);
827 cmds::Disable cmd;
828 cmd.Init(GL_CLIP_PLANE0);
829 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
830 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
833 TEST_P(GLES2DecoderTest1, DisableInvalidArgs0_1) {
834 EXPECT_CALL(*gl_, Disable(_)).Times(0);
835 SpecializedSetup<cmds::Disable, 0>(false);
836 cmds::Disable cmd;
837 cmd.Init(GL_POINT_SPRITE);
838 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
839 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
842 TEST_P(GLES2DecoderTest1, DisableVertexAttribArrayValidArgs) {
843 EXPECT_CALL(*gl_, DisableVertexAttribArray(1));
844 SpecializedSetup<cmds::DisableVertexAttribArray, 0>(true);
845 cmds::DisableVertexAttribArray cmd;
846 cmd.Init(1);
847 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
848 EXPECT_EQ(GL_NO_ERROR, GetGLError());
850 // TODO(gman): DrawArrays
852 // TODO(gman): DrawElements
854 TEST_P(GLES2DecoderTest1, EnableValidArgs) {
855 SetupExpectationsForEnableDisable(GL_BLEND, true);
856 SpecializedSetup<cmds::Enable, 0>(true);
857 cmds::Enable cmd;
858 cmd.Init(GL_BLEND);
859 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
860 EXPECT_EQ(GL_NO_ERROR, GetGLError());
863 TEST_P(GLES2DecoderTest1, EnableInvalidArgs0_0) {
864 EXPECT_CALL(*gl_, Enable(_)).Times(0);
865 SpecializedSetup<cmds::Enable, 0>(false);
866 cmds::Enable cmd;
867 cmd.Init(GL_CLIP_PLANE0);
868 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
869 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
872 TEST_P(GLES2DecoderTest1, EnableInvalidArgs0_1) {
873 EXPECT_CALL(*gl_, Enable(_)).Times(0);
874 SpecializedSetup<cmds::Enable, 0>(false);
875 cmds::Enable cmd;
876 cmd.Init(GL_POINT_SPRITE);
877 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
878 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
881 TEST_P(GLES2DecoderTest1, EnableVertexAttribArrayValidArgs) {
882 EXPECT_CALL(*gl_, EnableVertexAttribArray(1));
883 SpecializedSetup<cmds::EnableVertexAttribArray, 0>(true);
884 cmds::EnableVertexAttribArray cmd;
885 cmd.Init(1);
886 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
887 EXPECT_EQ(GL_NO_ERROR, GetGLError());
890 TEST_P(GLES2DecoderTest1, FenceSyncValidArgs) {
891 const GLsync kNewServiceIdGLuint = reinterpret_cast<GLsync>(kNewServiceId);
892 EXPECT_CALL(*gl_, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0))
893 .WillOnce(Return(kNewServiceIdGLuint));
894 SpecializedSetup<cmds::FenceSync, 0>(true);
895 cmds::FenceSync cmd;
896 cmd.Init(kNewClientId);
897 decoder_->set_unsafe_es3_apis_enabled(true);
898 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
899 EXPECT_EQ(GL_NO_ERROR, GetGLError());
900 GLsync service_id = 0;
901 EXPECT_TRUE(GetSyncServiceId(kNewClientId, &service_id));
902 EXPECT_EQ(kNewServiceIdGLuint, service_id);
903 decoder_->set_unsafe_es3_apis_enabled(false);
904 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
907 TEST_P(GLES2DecoderTest1, FinishValidArgs) {
908 EXPECT_CALL(*gl_, Finish());
909 SpecializedSetup<cmds::Finish, 0>(true);
910 cmds::Finish cmd;
911 cmd.Init();
912 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
913 EXPECT_EQ(GL_NO_ERROR, GetGLError());
916 TEST_P(GLES2DecoderTest1, FlushValidArgs) {
917 EXPECT_CALL(*gl_, Flush());
918 SpecializedSetup<cmds::Flush, 0>(true);
919 cmds::Flush cmd;
920 cmd.Init();
921 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
922 EXPECT_EQ(GL_NO_ERROR, GetGLError());
925 TEST_P(GLES2DecoderTest1, FramebufferRenderbufferValidArgs) {
926 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(
927 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
928 kServiceRenderbufferId));
929 SpecializedSetup<cmds::FramebufferRenderbuffer, 0>(true);
930 cmds::FramebufferRenderbuffer cmd;
931 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
932 client_renderbuffer_id_);
933 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
934 EXPECT_EQ(GL_NO_ERROR, GetGLError());
937 TEST_P(GLES2DecoderTest1, FramebufferRenderbufferInvalidArgs0_0) {
938 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)).Times(0);
939 SpecializedSetup<cmds::FramebufferRenderbuffer, 0>(false);
940 cmds::FramebufferRenderbuffer cmd;
941 cmd.Init(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
942 client_renderbuffer_id_);
943 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
944 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
947 TEST_P(GLES2DecoderTest1, FramebufferRenderbufferInvalidArgs0_1) {
948 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)).Times(0);
949 SpecializedSetup<cmds::FramebufferRenderbuffer, 0>(false);
950 cmds::FramebufferRenderbuffer cmd;
951 cmd.Init(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
952 client_renderbuffer_id_);
953 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
954 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
957 TEST_P(GLES2DecoderTest1, FramebufferRenderbufferInvalidArgs2_0) {
958 EXPECT_CALL(*gl_, FramebufferRenderbufferEXT(_, _, _, _)).Times(0);
959 SpecializedSetup<cmds::FramebufferRenderbuffer, 0>(false);
960 cmds::FramebufferRenderbuffer cmd;
961 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER,
962 client_renderbuffer_id_);
963 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
964 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
967 TEST_P(GLES2DecoderTest1, FramebufferTexture2DValidArgs) {
968 EXPECT_CALL(*gl_,
969 FramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
970 GL_TEXTURE_2D, kServiceTextureId, 0));
971 SpecializedSetup<cmds::FramebufferTexture2D, 0>(true);
972 cmds::FramebufferTexture2D cmd;
973 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
974 client_texture_id_);
975 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
976 EXPECT_EQ(GL_NO_ERROR, GetGLError());
979 TEST_P(GLES2DecoderTest1, FramebufferTexture2DInvalidArgs0_0) {
980 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)).Times(0);
981 SpecializedSetup<cmds::FramebufferTexture2D, 0>(false);
982 cmds::FramebufferTexture2D cmd;
983 cmd.Init(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
984 client_texture_id_);
985 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
986 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
989 TEST_P(GLES2DecoderTest1, FramebufferTexture2DInvalidArgs0_1) {
990 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)).Times(0);
991 SpecializedSetup<cmds::FramebufferTexture2D, 0>(false);
992 cmds::FramebufferTexture2D cmd;
993 cmd.Init(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
994 client_texture_id_);
995 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
996 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
999 TEST_P(GLES2DecoderTest1, FramebufferTexture2DInvalidArgs2_0) {
1000 EXPECT_CALL(*gl_, FramebufferTexture2DEXT(_, _, _, _, _)).Times(0);
1001 SpecializedSetup<cmds::FramebufferTexture2D, 0>(false);
1002 cmds::FramebufferTexture2D cmd;
1003 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_PROXY_TEXTURE_CUBE_MAP,
1004 client_texture_id_);
1005 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1006 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1009 TEST_P(GLES2DecoderTest1, FramebufferTextureLayerValidArgs) {
1010 EXPECT_CALL(*gl_,
1011 FramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1012 kServiceTextureId, 4, 5));
1013 SpecializedSetup<cmds::FramebufferTextureLayer, 0>(true);
1014 cmds::FramebufferTextureLayer cmd;
1015 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, 4, 5);
1016 decoder_->set_unsafe_es3_apis_enabled(true);
1017 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1018 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1019 decoder_->set_unsafe_es3_apis_enabled(false);
1020 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1023 TEST_P(GLES2DecoderTest1, FrontFaceValidArgs) {
1024 EXPECT_CALL(*gl_, FrontFace(GL_CW));
1025 SpecializedSetup<cmds::FrontFace, 0>(true);
1026 cmds::FrontFace cmd;
1027 cmd.Init(GL_CW);
1028 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1029 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1032 TEST_P(GLES2DecoderTest1, GenBuffersImmediateValidArgs) {
1033 EXPECT_CALL(*gl_, GenBuffersARB(1, _))
1034 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1035 cmds::GenBuffersImmediate* cmd = GetImmediateAs<cmds::GenBuffersImmediate>();
1036 GLuint temp = kNewClientId;
1037 SpecializedSetup<cmds::GenBuffersImmediate, 0>(true);
1038 cmd->Init(1, &temp);
1039 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp)));
1040 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1041 EXPECT_TRUE(GetBuffer(kNewClientId) != NULL);
1044 TEST_P(GLES2DecoderTest1, GenBuffersImmediateInvalidArgs) {
1045 EXPECT_CALL(*gl_, GenBuffersARB(_, _)).Times(0);
1046 cmds::GenBuffersImmediate* cmd = GetImmediateAs<cmds::GenBuffersImmediate>();
1047 SpecializedSetup<cmds::GenBuffersImmediate, 0>(false);
1048 cmd->Init(1, &client_buffer_id_);
1049 EXPECT_EQ(error::kInvalidArguments,
1050 ExecuteImmediateCmd(*cmd, sizeof(&client_buffer_id_)));
1053 TEST_P(GLES2DecoderTest1, GenerateMipmapValidArgs) {
1054 EXPECT_CALL(*gl_, GenerateMipmapEXT(GL_TEXTURE_2D));
1055 SpecializedSetup<cmds::GenerateMipmap, 0>(true);
1056 cmds::GenerateMipmap cmd;
1057 cmd.Init(GL_TEXTURE_2D);
1058 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1059 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1062 TEST_P(GLES2DecoderTest1, GenerateMipmapInvalidArgs0_0) {
1063 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0);
1064 SpecializedSetup<cmds::GenerateMipmap, 0>(false);
1065 cmds::GenerateMipmap cmd;
1066 cmd.Init(GL_TEXTURE_1D);
1067 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1068 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1071 TEST_P(GLES2DecoderTest1, GenerateMipmapInvalidArgs0_1) {
1072 EXPECT_CALL(*gl_, GenerateMipmapEXT(_)).Times(0);
1073 SpecializedSetup<cmds::GenerateMipmap, 0>(false);
1074 cmds::GenerateMipmap cmd;
1075 cmd.Init(GL_TEXTURE_3D);
1076 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1077 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1080 TEST_P(GLES2DecoderTest1, GenFramebuffersImmediateValidArgs) {
1081 EXPECT_CALL(*gl_, GenFramebuffersEXT(1, _))
1082 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1083 cmds::GenFramebuffersImmediate* cmd =
1084 GetImmediateAs<cmds::GenFramebuffersImmediate>();
1085 GLuint temp = kNewClientId;
1086 SpecializedSetup<cmds::GenFramebuffersImmediate, 0>(true);
1087 cmd->Init(1, &temp);
1088 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp)));
1089 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1090 EXPECT_TRUE(GetFramebuffer(kNewClientId) != NULL);
1093 TEST_P(GLES2DecoderTest1, GenFramebuffersImmediateInvalidArgs) {
1094 EXPECT_CALL(*gl_, GenFramebuffersEXT(_, _)).Times(0);
1095 cmds::GenFramebuffersImmediate* cmd =
1096 GetImmediateAs<cmds::GenFramebuffersImmediate>();
1097 SpecializedSetup<cmds::GenFramebuffersImmediate, 0>(false);
1098 cmd->Init(1, &client_framebuffer_id_);
1099 EXPECT_EQ(error::kInvalidArguments,
1100 ExecuteImmediateCmd(*cmd, sizeof(&client_framebuffer_id_)));
1103 TEST_P(GLES2DecoderTest1, GenRenderbuffersImmediateValidArgs) {
1104 EXPECT_CALL(*gl_, GenRenderbuffersEXT(1, _))
1105 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1106 cmds::GenRenderbuffersImmediate* cmd =
1107 GetImmediateAs<cmds::GenRenderbuffersImmediate>();
1108 GLuint temp = kNewClientId;
1109 SpecializedSetup<cmds::GenRenderbuffersImmediate, 0>(true);
1110 cmd->Init(1, &temp);
1111 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp)));
1112 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1113 EXPECT_TRUE(GetRenderbuffer(kNewClientId) != NULL);
1116 TEST_P(GLES2DecoderTest1, GenRenderbuffersImmediateInvalidArgs) {
1117 EXPECT_CALL(*gl_, GenRenderbuffersEXT(_, _)).Times(0);
1118 cmds::GenRenderbuffersImmediate* cmd =
1119 GetImmediateAs<cmds::GenRenderbuffersImmediate>();
1120 SpecializedSetup<cmds::GenRenderbuffersImmediate, 0>(false);
1121 cmd->Init(1, &client_renderbuffer_id_);
1122 EXPECT_EQ(error::kInvalidArguments,
1123 ExecuteImmediateCmd(*cmd, sizeof(&client_renderbuffer_id_)));
1126 TEST_P(GLES2DecoderTest1, GenSamplersImmediateValidArgs) {
1127 EXPECT_CALL(*gl_, GenSamplers(1, _))
1128 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1129 cmds::GenSamplersImmediate* cmd =
1130 GetImmediateAs<cmds::GenSamplersImmediate>();
1131 GLuint temp = kNewClientId;
1132 SpecializedSetup<cmds::GenSamplersImmediate, 0>(true);
1133 decoder_->set_unsafe_es3_apis_enabled(true);
1134 cmd->Init(1, &temp);
1135 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp)));
1136 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1137 GLuint service_id;
1138 EXPECT_TRUE(GetSamplerServiceId(kNewClientId, &service_id));
1139 EXPECT_EQ(kNewServiceId, service_id);
1140 decoder_->set_unsafe_es3_apis_enabled(false);
1141 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(*cmd, sizeof(temp)));
1144 TEST_P(GLES2DecoderTest1, GenSamplersImmediateInvalidArgs) {
1145 EXPECT_CALL(*gl_, GenSamplers(_, _)).Times(0);
1146 cmds::GenSamplersImmediate* cmd =
1147 GetImmediateAs<cmds::GenSamplersImmediate>();
1148 SpecializedSetup<cmds::GenSamplersImmediate, 0>(false);
1149 cmd->Init(1, &client_sampler_id_);
1150 decoder_->set_unsafe_es3_apis_enabled(true);
1151 EXPECT_EQ(error::kInvalidArguments,
1152 ExecuteImmediateCmd(*cmd, sizeof(&client_sampler_id_)));
1153 decoder_->set_unsafe_es3_apis_enabled(false);
1156 TEST_P(GLES2DecoderTest1, GenTexturesImmediateValidArgs) {
1157 EXPECT_CALL(*gl_, GenTextures(1, _))
1158 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1159 cmds::GenTexturesImmediate* cmd =
1160 GetImmediateAs<cmds::GenTexturesImmediate>();
1161 GLuint temp = kNewClientId;
1162 SpecializedSetup<cmds::GenTexturesImmediate, 0>(true);
1163 cmd->Init(1, &temp);
1164 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp)));
1165 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1166 EXPECT_TRUE(GetTexture(kNewClientId) != NULL);
1169 TEST_P(GLES2DecoderTest1, GenTexturesImmediateInvalidArgs) {
1170 EXPECT_CALL(*gl_, GenTextures(_, _)).Times(0);
1171 cmds::GenTexturesImmediate* cmd =
1172 GetImmediateAs<cmds::GenTexturesImmediate>();
1173 SpecializedSetup<cmds::GenTexturesImmediate, 0>(false);
1174 cmd->Init(1, &client_texture_id_);
1175 EXPECT_EQ(error::kInvalidArguments,
1176 ExecuteImmediateCmd(*cmd, sizeof(&client_texture_id_)));
1179 TEST_P(GLES2DecoderTest1, GenTransformFeedbacksImmediateValidArgs) {
1180 EXPECT_CALL(*gl_, GenTransformFeedbacks(1, _))
1181 .WillOnce(SetArgumentPointee<1>(kNewServiceId));
1182 cmds::GenTransformFeedbacksImmediate* cmd =
1183 GetImmediateAs<cmds::GenTransformFeedbacksImmediate>();
1184 GLuint temp = kNewClientId;
1185 SpecializedSetup<cmds::GenTransformFeedbacksImmediate, 0>(true);
1186 decoder_->set_unsafe_es3_apis_enabled(true);
1187 cmd->Init(1, &temp);
1188 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp)));
1189 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1190 GLuint service_id;
1191 EXPECT_TRUE(GetTransformFeedbackServiceId(kNewClientId, &service_id));
1192 EXPECT_EQ(kNewServiceId, service_id);
1193 decoder_->set_unsafe_es3_apis_enabled(false);
1194 EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(*cmd, sizeof(temp)));
1197 TEST_P(GLES2DecoderTest1, GenTransformFeedbacksImmediateInvalidArgs) {
1198 EXPECT_CALL(*gl_, GenTransformFeedbacks(_, _)).Times(0);
1199 cmds::GenTransformFeedbacksImmediate* cmd =
1200 GetImmediateAs<cmds::GenTransformFeedbacksImmediate>();
1201 SpecializedSetup<cmds::GenTransformFeedbacksImmediate, 0>(false);
1202 cmd->Init(1, &client_transformfeedback_id_);
1203 decoder_->set_unsafe_es3_apis_enabled(true);
1204 EXPECT_EQ(error::kInvalidArguments,
1205 ExecuteImmediateCmd(*cmd, sizeof(&client_transformfeedback_id_)));
1206 decoder_->set_unsafe_es3_apis_enabled(false);
1208 // TODO(gman): GetActiveAttrib
1210 // TODO(gman): GetActiveUniform
1212 // TODO(gman): GetActiveUniformBlockiv
1214 // TODO(gman): GetActiveUniformBlockName
1216 // TODO(gman): GetActiveUniformsiv
1218 // TODO(gman): GetAttachedShaders
1220 // TODO(gman): GetAttribLocation
1222 TEST_P(GLES2DecoderTest1, GetBooleanvValidArgs) {
1223 EXPECT_CALL(*gl_, GetError())
1224 .WillOnce(Return(GL_NO_ERROR))
1225 .WillOnce(Return(GL_NO_ERROR))
1226 .RetiresOnSaturation();
1227 SpecializedSetup<cmds::GetBooleanv, 0>(true);
1228 typedef cmds::GetBooleanv::Result Result;
1229 Result* result = static_cast<Result*>(shared_memory_address_);
1230 EXPECT_CALL(*gl_, GetBooleanv(GL_ACTIVE_TEXTURE, result->GetData()));
1231 result->size = 0;
1232 cmds::GetBooleanv cmd;
1233 cmd.Init(GL_ACTIVE_TEXTURE, shared_memory_id_, shared_memory_offset_);
1234 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1235 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE),
1236 result->GetNumResults());
1237 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1240 TEST_P(GLES2DecoderTest1, GetBooleanvInvalidArgs0_0) {
1241 EXPECT_CALL(*gl_, GetBooleanv(_, _)).Times(0);
1242 SpecializedSetup<cmds::GetBooleanv, 0>(false);
1243 cmds::GetBooleanv::Result* result =
1244 static_cast<cmds::GetBooleanv::Result*>(shared_memory_address_);
1245 result->size = 0;
1246 cmds::GetBooleanv cmd;
1247 cmd.Init(GL_FOG_HINT, shared_memory_id_, shared_memory_offset_);
1248 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1249 EXPECT_EQ(0u, result->size);
1250 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1253 TEST_P(GLES2DecoderTest1, GetBooleanvInvalidArgs1_0) {
1254 EXPECT_CALL(*gl_, GetBooleanv(_, _)).Times(0);
1255 SpecializedSetup<cmds::GetBooleanv, 0>(false);
1256 cmds::GetBooleanv::Result* result =
1257 static_cast<cmds::GetBooleanv::Result*>(shared_memory_address_);
1258 result->size = 0;
1259 cmds::GetBooleanv cmd;
1260 cmd.Init(GL_ACTIVE_TEXTURE, kInvalidSharedMemoryId, 0);
1261 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1262 EXPECT_EQ(0u, result->size);
1265 TEST_P(GLES2DecoderTest1, GetBooleanvInvalidArgs1_1) {
1266 EXPECT_CALL(*gl_, GetBooleanv(_, _)).Times(0);
1267 SpecializedSetup<cmds::GetBooleanv, 0>(false);
1268 cmds::GetBooleanv::Result* result =
1269 static_cast<cmds::GetBooleanv::Result*>(shared_memory_address_);
1270 result->size = 0;
1271 cmds::GetBooleanv cmd;
1272 cmd.Init(GL_ACTIVE_TEXTURE, shared_memory_id_, kInvalidSharedMemoryOffset);
1273 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1274 EXPECT_EQ(0u, result->size);
1277 TEST_P(GLES2DecoderTest1, GetBufferParameterivValidArgs) {
1278 SpecializedSetup<cmds::GetBufferParameteriv, 0>(true);
1279 typedef cmds::GetBufferParameteriv::Result Result;
1280 Result* result = static_cast<Result*>(shared_memory_address_);
1281 result->size = 0;
1282 cmds::GetBufferParameteriv cmd;
1283 cmd.Init(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, shared_memory_id_,
1284 shared_memory_offset_);
1285 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1286 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_BUFFER_SIZE),
1287 result->GetNumResults());
1288 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1291 TEST_P(GLES2DecoderTest1, GetBufferParameterivInvalidArgs0_0) {
1292 EXPECT_CALL(*gl_, GetBufferParameteriv(_, _, _)).Times(0);
1293 SpecializedSetup<cmds::GetBufferParameteriv, 0>(false);
1294 cmds::GetBufferParameteriv::Result* result =
1295 static_cast<cmds::GetBufferParameteriv::Result*>(shared_memory_address_);
1296 result->size = 0;
1297 cmds::GetBufferParameteriv cmd;
1298 cmd.Init(GL_RENDERBUFFER, GL_BUFFER_SIZE, shared_memory_id_,
1299 shared_memory_offset_);
1300 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1301 EXPECT_EQ(0u, result->size);
1302 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1305 TEST_P(GLES2DecoderTest1, GetBufferParameterivInvalidArgs1_0) {
1306 EXPECT_CALL(*gl_, GetBufferParameteriv(_, _, _)).Times(0);
1307 SpecializedSetup<cmds::GetBufferParameteriv, 0>(false);
1308 cmds::GetBufferParameteriv::Result* result =
1309 static_cast<cmds::GetBufferParameteriv::Result*>(shared_memory_address_);
1310 result->size = 0;
1311 cmds::GetBufferParameteriv cmd;
1312 cmd.Init(GL_ARRAY_BUFFER, GL_PIXEL_PACK_BUFFER, shared_memory_id_,
1313 shared_memory_offset_);
1314 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1315 EXPECT_EQ(0u, result->size);
1316 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1319 TEST_P(GLES2DecoderTest1, GetBufferParameterivInvalidArgs2_0) {
1320 EXPECT_CALL(*gl_, GetBufferParameteriv(_, _, _)).Times(0);
1321 SpecializedSetup<cmds::GetBufferParameteriv, 0>(false);
1322 cmds::GetBufferParameteriv::Result* result =
1323 static_cast<cmds::GetBufferParameteriv::Result*>(shared_memory_address_);
1324 result->size = 0;
1325 cmds::GetBufferParameteriv cmd;
1326 cmd.Init(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, kInvalidSharedMemoryId, 0);
1327 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1328 EXPECT_EQ(0u, result->size);
1331 TEST_P(GLES2DecoderTest1, GetBufferParameterivInvalidArgs2_1) {
1332 EXPECT_CALL(*gl_, GetBufferParameteriv(_, _, _)).Times(0);
1333 SpecializedSetup<cmds::GetBufferParameteriv, 0>(false);
1334 cmds::GetBufferParameteriv::Result* result =
1335 static_cast<cmds::GetBufferParameteriv::Result*>(shared_memory_address_);
1336 result->size = 0;
1337 cmds::GetBufferParameteriv cmd;
1338 cmd.Init(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, shared_memory_id_,
1339 kInvalidSharedMemoryOffset);
1340 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1341 EXPECT_EQ(0u, result->size);
1344 TEST_P(GLES2DecoderTest1, GetErrorValidArgs) {
1345 EXPECT_CALL(*gl_, GetError());
1346 SpecializedSetup<cmds::GetError, 0>(true);
1347 cmds::GetError cmd;
1348 cmd.Init(shared_memory_id_, shared_memory_offset_);
1349 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1350 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1353 TEST_P(GLES2DecoderTest1, GetErrorInvalidArgsBadSharedMemoryId) {
1354 EXPECT_CALL(*gl_, GetError()).Times(0);
1355 SpecializedSetup<cmds::GetError, 0>(false);
1356 cmds::GetError cmd;
1357 cmd.Init(kInvalidSharedMemoryId, shared_memory_offset_);
1358 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1359 cmd.Init(shared_memory_id_, kInvalidSharedMemoryOffset);
1360 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1363 TEST_P(GLES2DecoderTest1, GetFloatvValidArgs) {
1364 EXPECT_CALL(*gl_, GetError())
1365 .WillOnce(Return(GL_NO_ERROR))
1366 .WillOnce(Return(GL_NO_ERROR))
1367 .RetiresOnSaturation();
1368 SpecializedSetup<cmds::GetFloatv, 0>(true);
1369 typedef cmds::GetFloatv::Result Result;
1370 Result* result = static_cast<Result*>(shared_memory_address_);
1371 EXPECT_CALL(*gl_, GetFloatv(GL_ACTIVE_TEXTURE, result->GetData()));
1372 result->size = 0;
1373 cmds::GetFloatv cmd;
1374 cmd.Init(GL_ACTIVE_TEXTURE, shared_memory_id_, shared_memory_offset_);
1375 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1376 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE),
1377 result->GetNumResults());
1378 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1381 TEST_P(GLES2DecoderTest1, GetFloatvInvalidArgs0_0) {
1382 EXPECT_CALL(*gl_, GetFloatv(_, _)).Times(0);
1383 SpecializedSetup<cmds::GetFloatv, 0>(false);
1384 cmds::GetFloatv::Result* result =
1385 static_cast<cmds::GetFloatv::Result*>(shared_memory_address_);
1386 result->size = 0;
1387 cmds::GetFloatv cmd;
1388 cmd.Init(GL_FOG_HINT, shared_memory_id_, shared_memory_offset_);
1389 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1390 EXPECT_EQ(0u, result->size);
1391 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1394 TEST_P(GLES2DecoderTest1, GetFloatvInvalidArgs1_0) {
1395 EXPECT_CALL(*gl_, GetFloatv(_, _)).Times(0);
1396 SpecializedSetup<cmds::GetFloatv, 0>(false);
1397 cmds::GetFloatv::Result* result =
1398 static_cast<cmds::GetFloatv::Result*>(shared_memory_address_);
1399 result->size = 0;
1400 cmds::GetFloatv cmd;
1401 cmd.Init(GL_ACTIVE_TEXTURE, kInvalidSharedMemoryId, 0);
1402 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1403 EXPECT_EQ(0u, result->size);
1406 TEST_P(GLES2DecoderTest1, GetFloatvInvalidArgs1_1) {
1407 EXPECT_CALL(*gl_, GetFloatv(_, _)).Times(0);
1408 SpecializedSetup<cmds::GetFloatv, 0>(false);
1409 cmds::GetFloatv::Result* result =
1410 static_cast<cmds::GetFloatv::Result*>(shared_memory_address_);
1411 result->size = 0;
1412 cmds::GetFloatv cmd;
1413 cmd.Init(GL_ACTIVE_TEXTURE, shared_memory_id_, kInvalidSharedMemoryOffset);
1414 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1415 EXPECT_EQ(0u, result->size);
1417 // TODO(gman): GetFragDataLocation
1419 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivValidArgs) {
1420 EXPECT_CALL(*gl_, GetError())
1421 .WillOnce(Return(GL_NO_ERROR))
1422 .WillOnce(Return(GL_NO_ERROR))
1423 .RetiresOnSaturation();
1424 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(true);
1425 typedef cmds::GetFramebufferAttachmentParameteriv::Result Result;
1426 Result* result = static_cast<Result*>(shared_memory_address_);
1427 EXPECT_CALL(*gl_,
1428 GetFramebufferAttachmentParameterivEXT(
1429 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1430 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, result->GetData()));
1431 result->size = 0;
1432 cmds::GetFramebufferAttachmentParameteriv cmd;
1433 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1434 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, shared_memory_id_,
1435 shared_memory_offset_);
1436 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1437 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
1438 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE),
1439 result->GetNumResults());
1440 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1443 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivInvalidArgs0_0) {
1444 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _))
1445 .Times(0);
1446 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(false);
1447 cmds::GetFramebufferAttachmentParameteriv::Result* result =
1448 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result*>(
1449 shared_memory_address_);
1450 result->size = 0;
1451 cmds::GetFramebufferAttachmentParameteriv cmd;
1452 cmd.Init(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1453 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, shared_memory_id_,
1454 shared_memory_offset_);
1455 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1456 EXPECT_EQ(0u, result->size);
1457 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1460 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivInvalidArgs0_1) {
1461 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _))
1462 .Times(0);
1463 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(false);
1464 cmds::GetFramebufferAttachmentParameteriv::Result* result =
1465 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result*>(
1466 shared_memory_address_);
1467 result->size = 0;
1468 cmds::GetFramebufferAttachmentParameteriv cmd;
1469 cmd.Init(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1470 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, shared_memory_id_,
1471 shared_memory_offset_);
1472 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1473 EXPECT_EQ(0u, result->size);
1474 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1477 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivInvalidArgs3_0) {
1478 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _))
1479 .Times(0);
1480 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(false);
1481 cmds::GetFramebufferAttachmentParameteriv::Result* result =
1482 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result*>(
1483 shared_memory_address_);
1484 result->size = 0;
1485 cmds::GetFramebufferAttachmentParameteriv cmd;
1486 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1487 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, kInvalidSharedMemoryId, 0);
1488 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1489 EXPECT_EQ(0u, result->size);
1492 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivInvalidArgs3_1) {
1493 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _))
1494 .Times(0);
1495 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(false);
1496 cmds::GetFramebufferAttachmentParameteriv::Result* result =
1497 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result*>(
1498 shared_memory_address_);
1499 result->size = 0;
1500 cmds::GetFramebufferAttachmentParameteriv cmd;
1501 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
1502 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, shared_memory_id_,
1503 kInvalidSharedMemoryOffset);
1504 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1505 EXPECT_EQ(0u, result->size);
1508 TEST_P(GLES2DecoderTest1, GetIntegervValidArgs) {
1509 EXPECT_CALL(*gl_, GetError())
1510 .WillOnce(Return(GL_NO_ERROR))
1511 .WillOnce(Return(GL_NO_ERROR))
1512 .RetiresOnSaturation();
1513 SpecializedSetup<cmds::GetIntegerv, 0>(true);
1514 typedef cmds::GetIntegerv::Result Result;
1515 Result* result = static_cast<Result*>(shared_memory_address_);
1516 EXPECT_CALL(*gl_, GetIntegerv(GL_ACTIVE_TEXTURE, result->GetData()));
1517 result->size = 0;
1518 cmds::GetIntegerv cmd;
1519 cmd.Init(GL_ACTIVE_TEXTURE, shared_memory_id_, shared_memory_offset_);
1520 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1521 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_ACTIVE_TEXTURE),
1522 result->GetNumResults());
1523 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1526 TEST_P(GLES2DecoderTest1, GetIntegervInvalidArgs0_0) {
1527 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(0);
1528 SpecializedSetup<cmds::GetIntegerv, 0>(false);
1529 cmds::GetIntegerv::Result* result =
1530 static_cast<cmds::GetIntegerv::Result*>(shared_memory_address_);
1531 result->size = 0;
1532 cmds::GetIntegerv cmd;
1533 cmd.Init(GL_FOG_HINT, shared_memory_id_, shared_memory_offset_);
1534 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1535 EXPECT_EQ(0u, result->size);
1536 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1539 TEST_P(GLES2DecoderTest1, GetIntegervInvalidArgs1_0) {
1540 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(0);
1541 SpecializedSetup<cmds::GetIntegerv, 0>(false);
1542 cmds::GetIntegerv::Result* result =
1543 static_cast<cmds::GetIntegerv::Result*>(shared_memory_address_);
1544 result->size = 0;
1545 cmds::GetIntegerv cmd;
1546 cmd.Init(GL_ACTIVE_TEXTURE, kInvalidSharedMemoryId, 0);
1547 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1548 EXPECT_EQ(0u, result->size);
1551 TEST_P(GLES2DecoderTest1, GetIntegervInvalidArgs1_1) {
1552 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(0);
1553 SpecializedSetup<cmds::GetIntegerv, 0>(false);
1554 cmds::GetIntegerv::Result* result =
1555 static_cast<cmds::GetIntegerv::Result*>(shared_memory_address_);
1556 result->size = 0;
1557 cmds::GetIntegerv cmd;
1558 cmd.Init(GL_ACTIVE_TEXTURE, shared_memory_id_, kInvalidSharedMemoryOffset);
1559 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1560 EXPECT_EQ(0u, result->size);
1563 TEST_P(GLES2DecoderTest1, GetInternalformativValidArgs) {
1564 EXPECT_CALL(*gl_, GetError())
1565 .WillOnce(Return(GL_NO_ERROR))
1566 .WillOnce(Return(GL_NO_ERROR))
1567 .RetiresOnSaturation();
1568 SpecializedSetup<cmds::GetInternalformativ, 0>(true);
1569 typedef cmds::GetInternalformativ::Result Result;
1570 Result* result = static_cast<Result*>(shared_memory_address_);
1571 EXPECT_CALL(*gl_, GetInternalformativ(GL_RENDERBUFFER, GL_RGBA4,
1572 GL_RENDERBUFFER_RED_SIZE, 4,
1573 result->GetData()));
1574 result->size = 0;
1575 cmds::GetInternalformativ cmd;
1576 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, GL_RENDERBUFFER_RED_SIZE, 4,
1577 shared_memory_id_, shared_memory_offset_);
1578 decoder_->set_unsafe_es3_apis_enabled(true);
1579 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1580 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
1581 GL_RENDERBUFFER_RED_SIZE),
1582 result->GetNumResults());
1583 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1584 decoder_->set_unsafe_es3_apis_enabled(false);
1585 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1588 TEST_P(GLES2DecoderTest1, GetProgramivValidArgs) {
1589 SpecializedSetup<cmds::GetProgramiv, 0>(true);
1590 typedef cmds::GetProgramiv::Result Result;
1591 Result* result = static_cast<Result*>(shared_memory_address_);
1592 result->size = 0;
1593 cmds::GetProgramiv cmd;
1594 cmd.Init(client_program_id_, GL_DELETE_STATUS, shared_memory_id_,
1595 shared_memory_offset_);
1596 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1597 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_DELETE_STATUS),
1598 result->GetNumResults());
1599 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1602 TEST_P(GLES2DecoderTest1, GetProgramivInvalidArgs2_0) {
1603 EXPECT_CALL(*gl_, GetProgramiv(_, _, _)).Times(0);
1604 SpecializedSetup<cmds::GetProgramiv, 0>(false);
1605 cmds::GetProgramiv::Result* result =
1606 static_cast<cmds::GetProgramiv::Result*>(shared_memory_address_);
1607 result->size = 0;
1608 cmds::GetProgramiv cmd;
1609 cmd.Init(client_program_id_, GL_DELETE_STATUS, kInvalidSharedMemoryId, 0);
1610 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1611 EXPECT_EQ(0u, result->size);
1614 TEST_P(GLES2DecoderTest1, GetProgramivInvalidArgs2_1) {
1615 EXPECT_CALL(*gl_, GetProgramiv(_, _, _)).Times(0);
1616 SpecializedSetup<cmds::GetProgramiv, 0>(false);
1617 cmds::GetProgramiv::Result* result =
1618 static_cast<cmds::GetProgramiv::Result*>(shared_memory_address_);
1619 result->size = 0;
1620 cmds::GetProgramiv cmd;
1621 cmd.Init(client_program_id_, GL_DELETE_STATUS, shared_memory_id_,
1622 kInvalidSharedMemoryOffset);
1623 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1624 EXPECT_EQ(0u, result->size);
1627 TEST_P(GLES2DecoderTest1, GetProgramInfoLogValidArgs) {
1628 const char* kInfo = "hello";
1629 const uint32_t kBucketId = 123;
1630 SpecializedSetup<cmds::GetProgramInfoLog, 0>(true);
1632 cmds::GetProgramInfoLog cmd;
1633 cmd.Init(client_program_id_, kBucketId);
1634 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1635 CommonDecoder::Bucket* bucket = decoder_->GetBucket(kBucketId);
1636 ASSERT_TRUE(bucket != NULL);
1637 EXPECT_EQ(strlen(kInfo) + 1, bucket->size());
1638 EXPECT_EQ(0,
1639 memcmp(bucket->GetData(0, bucket->size()), kInfo, bucket->size()));
1640 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1643 TEST_P(GLES2DecoderTest1, GetProgramInfoLogInvalidArgs) {
1644 const uint32_t kBucketId = 123;
1645 cmds::GetProgramInfoLog cmd;
1646 cmd.Init(kInvalidClientId, kBucketId);
1647 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1648 EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
1651 TEST_P(GLES2DecoderTest1, GetRenderbufferParameterivValidArgs) {
1652 EXPECT_CALL(*gl_, GetError())
1653 .WillOnce(Return(GL_NO_ERROR))
1654 .WillOnce(Return(GL_NO_ERROR))
1655 .RetiresOnSaturation();
1656 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(true);
1657 typedef cmds::GetRenderbufferParameteriv::Result Result;
1658 Result* result = static_cast<Result*>(shared_memory_address_);
1659 EXPECT_CALL(
1660 *gl_, GetRenderbufferParameterivEXT(
1661 GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, result->GetData()));
1662 result->size = 0;
1663 cmds::GetRenderbufferParameteriv cmd;
1664 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
1665 shared_memory_offset_);
1666 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1667 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
1668 GL_RENDERBUFFER_RED_SIZE),
1669 result->GetNumResults());
1670 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1673 TEST_P(GLES2DecoderTest1, GetRenderbufferParameterivInvalidArgs0_0) {
1674 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
1675 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
1676 cmds::GetRenderbufferParameteriv::Result* result =
1677 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
1678 shared_memory_address_);
1679 result->size = 0;
1680 cmds::GetRenderbufferParameteriv cmd;
1681 cmd.Init(GL_FRAMEBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
1682 shared_memory_offset_);
1683 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1684 EXPECT_EQ(0u, result->size);
1685 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1688 TEST_P(GLES2DecoderTest1, GetRenderbufferParameterivInvalidArgs2_0) {
1689 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
1690 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
1691 cmds::GetRenderbufferParameteriv::Result* result =
1692 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
1693 shared_memory_address_);
1694 result->size = 0;
1695 cmds::GetRenderbufferParameteriv cmd;
1696 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, kInvalidSharedMemoryId,
1698 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1699 EXPECT_EQ(0u, result->size);
1702 TEST_P(GLES2DecoderTest1, GetRenderbufferParameterivInvalidArgs2_1) {
1703 EXPECT_CALL(*gl_, GetRenderbufferParameterivEXT(_, _, _)).Times(0);
1704 SpecializedSetup<cmds::GetRenderbufferParameteriv, 0>(false);
1705 cmds::GetRenderbufferParameteriv::Result* result =
1706 static_cast<cmds::GetRenderbufferParameteriv::Result*>(
1707 shared_memory_address_);
1708 result->size = 0;
1709 cmds::GetRenderbufferParameteriv cmd;
1710 cmd.Init(GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, shared_memory_id_,
1711 kInvalidSharedMemoryOffset);
1712 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1713 EXPECT_EQ(0u, result->size);
1716 TEST_P(GLES2DecoderTest1, GetSamplerParameterfvValidArgs) {
1717 EXPECT_CALL(*gl_, GetError())
1718 .WillOnce(Return(GL_NO_ERROR))
1719 .WillOnce(Return(GL_NO_ERROR))
1720 .RetiresOnSaturation();
1721 SpecializedSetup<cmds::GetSamplerParameterfv, 0>(true);
1722 typedef cmds::GetSamplerParameterfv::Result Result;
1723 Result* result = static_cast<Result*>(shared_memory_address_);
1724 EXPECT_CALL(*gl_,
1725 GetSamplerParameterfv(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
1726 result->GetData()));
1727 result->size = 0;
1728 cmds::GetSamplerParameterfv cmd;
1729 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
1730 shared_memory_offset_);
1731 decoder_->set_unsafe_es3_apis_enabled(true);
1732 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1733 EXPECT_EQ(
1734 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
1735 result->GetNumResults());
1736 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1737 decoder_->set_unsafe_es3_apis_enabled(false);
1738 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1741 TEST_P(GLES2DecoderTest1, GetSamplerParameterivValidArgs) {
1742 EXPECT_CALL(*gl_, GetError())
1743 .WillOnce(Return(GL_NO_ERROR))
1744 .WillOnce(Return(GL_NO_ERROR))
1745 .RetiresOnSaturation();
1746 SpecializedSetup<cmds::GetSamplerParameteriv, 0>(true);
1747 typedef cmds::GetSamplerParameteriv::Result Result;
1748 Result* result = static_cast<Result*>(shared_memory_address_);
1749 EXPECT_CALL(*gl_,
1750 GetSamplerParameteriv(kServiceSamplerId, GL_TEXTURE_MAG_FILTER,
1751 result->GetData()));
1752 result->size = 0;
1753 cmds::GetSamplerParameteriv cmd;
1754 cmd.Init(client_sampler_id_, GL_TEXTURE_MAG_FILTER, shared_memory_id_,
1755 shared_memory_offset_);
1756 decoder_->set_unsafe_es3_apis_enabled(true);
1757 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1758 EXPECT_EQ(
1759 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER),
1760 result->GetNumResults());
1761 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1762 decoder_->set_unsafe_es3_apis_enabled(false);
1763 EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
1766 TEST_P(GLES2DecoderTest1, GetShaderivValidArgs) {
1767 EXPECT_CALL(*gl_, GetError())
1768 .WillOnce(Return(GL_NO_ERROR))
1769 .WillOnce(Return(GL_NO_ERROR))
1770 .RetiresOnSaturation();
1771 SpecializedSetup<cmds::GetShaderiv, 0>(true);
1772 typedef cmds::GetShaderiv::Result Result;
1773 Result* result = static_cast<Result*>(shared_memory_address_);
1774 EXPECT_CALL(*gl_,
1775 GetShaderiv(kServiceShaderId, GL_SHADER_TYPE, result->GetData()));
1776 result->size = 0;
1777 cmds::GetShaderiv cmd;
1778 cmd.Init(client_shader_id_, GL_SHADER_TYPE, shared_memory_id_,
1779 shared_memory_offset_);
1780 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1781 EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_SHADER_TYPE),
1782 result->GetNumResults());
1783 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1786 TEST_P(GLES2DecoderTest1, GetShaderivInvalidArgs2_0) {
1787 EXPECT_CALL(*gl_, GetShaderiv(_, _, _)).Times(0);
1788 SpecializedSetup<cmds::GetShaderiv, 0>(false);
1789 cmds::GetShaderiv::Result* result =
1790 static_cast<cmds::GetShaderiv::Result*>(shared_memory_address_);
1791 result->size = 0;
1792 cmds::GetShaderiv cmd;
1793 cmd.Init(client_shader_id_, GL_SHADER_TYPE, kInvalidSharedMemoryId, 0);
1794 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1795 EXPECT_EQ(0u, result->size);
1798 TEST_P(GLES2DecoderTest1, GetShaderivInvalidArgs2_1) {
1799 EXPECT_CALL(*gl_, GetShaderiv(_, _, _)).Times(0);
1800 SpecializedSetup<cmds::GetShaderiv, 0>(false);
1801 cmds::GetShaderiv::Result* result =
1802 static_cast<cmds::GetShaderiv::Result*>(shared_memory_address_);
1803 result->size = 0;
1804 cmds::GetShaderiv cmd;
1805 cmd.Init(client_shader_id_, GL_SHADER_TYPE, shared_memory_id_,
1806 kInvalidSharedMemoryOffset);
1807 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd));
1808 EXPECT_EQ(0u, result->size);
1810 // TODO(gman): GetShaderInfoLog
1811 // TODO(gman): GetShaderPrecisionFormat
1813 // TODO(gman): GetShaderSource
1814 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_