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. 4 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! 10 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_ 14 15 // TODO(gman): ActiveTexture 16 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()); 24 } 25 // TODO(gman): BindAttribLocationBucket 26 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()); 34 } 35 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); 46 } 47 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()); 55 } 56 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()); 64 } 65 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); 76 } 77 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()); 85 } 86 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()); 94 } 95 96 TEST_P(GLES2DecoderTest1, BindRenderbufferValidArgs) { 97 EXPECT_CALL(*gl_, 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()); 104 } 105 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); 116 } 117 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()); 125 } 126 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()); 134 } 135 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); 146 } 147 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()); 155 } 156 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()); 164 } 165 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()); 173 } 174 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()); 182 } 183 184 TEST_P(GLES2DecoderTest1, BlendEquationInvalidArgs0_0) { 185 EXPECT_CALL(*gl_, BlendEquation(_)).Times(0); 186 SpecializedSetup<cmds::BlendEquation, 0>(false); 187 cmds::BlendEquation cmd; 188 cmd.Init(GL_MIN); 189 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 190 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 191 } 192 193 TEST_P(GLES2DecoderTest1, BlendEquationInvalidArgs0_1) { 194 EXPECT_CALL(*gl_, BlendEquation(_)).Times(0); 195 SpecializedSetup<cmds::BlendEquation, 0>(false); 196 cmds::BlendEquation cmd; 197 cmd.Init(GL_MAX); 198 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 199 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 200 } 201 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()); 209 } 210 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()); 218 } 219 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()); 227 } 228 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()); 236 } 237 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()); 245 } 246 247 TEST_P(GLES2DecoderTest1, BlendFuncValidArgs) { 248 EXPECT_CALL(*gl_, BlendFunc(GL_ZERO, GL_ZERO)); 249 SpecializedSetup<cmds::BlendFunc, 0>(true); 250 cmds::BlendFunc cmd; 251 cmd.Init(GL_ZERO, GL_ZERO); 252 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 253 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 254 } 255 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()); 263 } 264 // TODO(gman): BufferData 265 266 // TODO(gman): BufferSubData 267 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()); 275 } 276 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()); 284 } 285 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()); 293 } 294 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)); 303 } 304 305 TEST_P(GLES2DecoderTest1, ClearValidArgs) { 306 EXPECT_CALL(*gl_, Clear(1)); 307 SpecializedSetup<cmds::Clear, 0>(true); 308 cmds::Clear cmd; 309 cmd.Init(1); 310 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 311 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 312 } 313 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()); 321 } 322 323 TEST_P(GLES2DecoderTest1, ClearDepthfValidArgs) { 324 EXPECT_CALL(*gl_, ClearDepth(0.5f)); 325 SpecializedSetup<cmds::ClearDepthf, 0>(true); 326 cmds::ClearDepthf cmd; 327 cmd.Init(0.5f); 328 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 329 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 330 } 331 332 TEST_P(GLES2DecoderTest1, ClearStencilValidArgs) { 333 EXPECT_CALL(*gl_, ClearStencil(1)); 334 SpecializedSetup<cmds::ClearStencil, 0>(true); 335 cmds::ClearStencil cmd; 336 cmd.Init(1); 337 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 338 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 339 } 340 341 TEST_P(GLES2DecoderTest1, ColorMaskValidArgs) { 342 SpecializedSetup<cmds::ColorMask, 0>(true); 343 cmds::ColorMask cmd; 344 cmd.Init(true, true, true, true); 345 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 346 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 347 } 348 // TODO(gman): CompileShader 349 // TODO(gman): CompressedTexImage2DBucket 350 // TODO(gman): CompressedTexImage2D 351 352 // TODO(gman): CompressedTexSubImage2DBucket 353 // TODO(gman): CompressedTexSubImage2D 354 355 // TODO(gman): CopyTexImage2D 356 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()); 364 } 365 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()); 373 } 374 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()); 382 } 383 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()); 391 } 392 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); 401 } 402 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); 412 } 413 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()); 421 } 422 423 TEST_P(GLES2DecoderTest1, CullFaceValidArgs) { 424 EXPECT_CALL(*gl_, CullFace(GL_FRONT)); 425 SpecializedSetup<cmds::CullFace, 0>(true); 426 cmds::CullFace cmd; 427 cmd.Init(GL_FRONT); 428 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 429 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 430 } 431 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); 442 } 443 444 TEST_P(GLES2DecoderTest1, DeleteBuffersImmediateInvalidArgs) { 445 cmds::DeleteBuffersImmediate& cmd = 446 *GetImmediateAs<cmds::DeleteBuffersImmediate>(); 447 SpecializedSetup<cmds::DeleteBuffersImmediate, 0>(false); 448 GLuint temp = kInvalidClientId; 449 cmd.Init(1, &temp); 450 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 451 } 452 453 TEST_P(GLES2DecoderTest1, DeleteFramebuffersImmediateValidArgs) { 454 EXPECT_CALL(*gl_, DeleteFramebuffersEXT(1, Pointee(kServiceFramebufferId))) 455 .Times(1); 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); 464 } 465 466 TEST_P(GLES2DecoderTest1, DeleteFramebuffersImmediateInvalidArgs) { 467 cmds::DeleteFramebuffersImmediate& cmd = 468 *GetImmediateAs<cmds::DeleteFramebuffersImmediate>(); 469 SpecializedSetup<cmds::DeleteFramebuffersImmediate, 0>(false); 470 GLuint temp = kInvalidClientId; 471 cmd.Init(1, &temp); 472 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 473 } 474 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()); 482 } 483 484 TEST_P(GLES2DecoderTest1, DeleteRenderbuffersImmediateValidArgs) { 485 EXPECT_CALL(*gl_, DeleteRenderbuffersEXT(1, Pointee(kServiceRenderbufferId))) 486 .Times(1); 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); 495 } 496 497 TEST_P(GLES2DecoderTest1, DeleteRenderbuffersImmediateInvalidArgs) { 498 cmds::DeleteRenderbuffersImmediate& cmd = 499 *GetImmediateAs<cmds::DeleteRenderbuffersImmediate>(); 500 SpecializedSetup<cmds::DeleteRenderbuffersImmediate, 0>(false); 501 GLuint temp = kInvalidClientId; 502 cmd.Init(1, &temp); 503 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 504 } 505 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()); 513 } 514 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); 525 } 526 527 TEST_P(GLES2DecoderTest1, DeleteTexturesImmediateInvalidArgs) { 528 cmds::DeleteTexturesImmediate& cmd = 529 *GetImmediateAs<cmds::DeleteTexturesImmediate>(); 530 SpecializedSetup<cmds::DeleteTexturesImmediate, 0>(false); 531 GLuint temp = kInvalidClientId; 532 cmd.Init(1, &temp); 533 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp))); 534 } 535 536 TEST_P(GLES2DecoderTest1, DepthFuncValidArgs) { 537 EXPECT_CALL(*gl_, DepthFunc(GL_NEVER)); 538 SpecializedSetup<cmds::DepthFunc, 0>(true); 539 cmds::DepthFunc cmd; 540 cmd.Init(GL_NEVER); 541 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 542 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 543 } 544 545 TEST_P(GLES2DecoderTest1, DepthMaskValidArgs) { 546 SpecializedSetup<cmds::DepthMask, 0>(true); 547 cmds::DepthMask cmd; 548 cmd.Init(true); 549 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 550 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 551 } 552 553 TEST_P(GLES2DecoderTest1, DepthRangefValidArgs) { 554 EXPECT_CALL(*gl_, DepthRange(1, 2)); 555 SpecializedSetup<cmds::DepthRangef, 0>(true); 556 cmds::DepthRangef cmd; 557 cmd.Init(1, 2); 558 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 559 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 560 } 561 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()); 569 } 570 571 TEST_P(GLES2DecoderTest1, DisableValidArgs) { 572 SetupExpectationsForEnableDisable(GL_BLEND, false); 573 SpecializedSetup<cmds::Disable, 0>(true); 574 cmds::Disable cmd; 575 cmd.Init(GL_BLEND); 576 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 577 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 578 } 579 580 TEST_P(GLES2DecoderTest1, DisableInvalidArgs0_0) { 581 EXPECT_CALL(*gl_, Disable(_)).Times(0); 582 SpecializedSetup<cmds::Disable, 0>(false); 583 cmds::Disable cmd; 584 cmd.Init(GL_CLIP_PLANE0); 585 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 586 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 587 } 588 589 TEST_P(GLES2DecoderTest1, DisableInvalidArgs0_1) { 590 EXPECT_CALL(*gl_, Disable(_)).Times(0); 591 SpecializedSetup<cmds::Disable, 0>(false); 592 cmds::Disable cmd; 593 cmd.Init(GL_POINT_SPRITE); 594 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 595 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 596 } 597 598 TEST_P(GLES2DecoderTest1, DisableVertexAttribArrayValidArgs) { 599 EXPECT_CALL(*gl_, DisableVertexAttribArray(1)); 600 SpecializedSetup<cmds::DisableVertexAttribArray, 0>(true); 601 cmds::DisableVertexAttribArray cmd; 602 cmd.Init(1); 603 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 604 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 605 } 606 // TODO(gman): DrawArrays 607 608 // TODO(gman): DrawElements 609 610 TEST_P(GLES2DecoderTest1, EnableValidArgs) { 611 SetupExpectationsForEnableDisable(GL_BLEND, true); 612 SpecializedSetup<cmds::Enable, 0>(true); 613 cmds::Enable cmd; 614 cmd.Init(GL_BLEND); 615 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 616 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 617 } 618 619 TEST_P(GLES2DecoderTest1, EnableInvalidArgs0_0) { 620 EXPECT_CALL(*gl_, Enable(_)).Times(0); 621 SpecializedSetup<cmds::Enable, 0>(false); 622 cmds::Enable cmd; 623 cmd.Init(GL_CLIP_PLANE0); 624 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 625 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 626 } 627 628 TEST_P(GLES2DecoderTest1, EnableInvalidArgs0_1) { 629 EXPECT_CALL(*gl_, Enable(_)).Times(0); 630 SpecializedSetup<cmds::Enable, 0>(false); 631 cmds::Enable cmd; 632 cmd.Init(GL_POINT_SPRITE); 633 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 634 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 635 } 636 637 TEST_P(GLES2DecoderTest1, EnableVertexAttribArrayValidArgs) { 638 EXPECT_CALL(*gl_, EnableVertexAttribArray(1)); 639 SpecializedSetup<cmds::EnableVertexAttribArray, 0>(true); 640 cmds::EnableVertexAttribArray cmd; 641 cmd.Init(1); 642 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 643 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 644 } 645 646 TEST_P(GLES2DecoderTest1, FinishValidArgs) { 647 EXPECT_CALL(*gl_, Finish()); 648 SpecializedSetup<cmds::Finish, 0>(true); 649 cmds::Finish cmd; 650 cmd.Init(); 651 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 652 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 653 } 654 655 TEST_P(GLES2DecoderTest1, FlushValidArgs) { 656 EXPECT_CALL(*gl_, Flush()); 657 SpecializedSetup<cmds::Flush, 0>(true); 658 cmds::Flush cmd; 659 cmd.Init(); 660 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 661 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 662 } 663 664 TEST_P(GLES2DecoderTest1, FramebufferRenderbufferValidArgs) { 665 EXPECT_CALL(*gl_, 666 FramebufferRenderbufferEXT(GL_FRAMEBUFFER, 667 GL_COLOR_ATTACHMENT0, 668 GL_RENDERBUFFER, 669 kServiceRenderbufferId)); 670 SpecializedSetup<cmds::FramebufferRenderbuffer, 0>(true); 671 cmds::FramebufferRenderbuffer cmd; 672 cmd.Init(GL_FRAMEBUFFER, 673 GL_COLOR_ATTACHMENT0, 674 GL_RENDERBUFFER, 675 client_renderbuffer_id_); 676 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 677 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 678 } 679 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, 686 GL_RENDERBUFFER, 687 client_renderbuffer_id_); 688 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 689 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 690 } 691 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, 698 GL_RENDERBUFFER, 699 client_renderbuffer_id_); 700 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 701 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 702 } 703 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, 710 GL_FRAMEBUFFER, 711 client_renderbuffer_id_); 712 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 713 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 714 } 715 716 TEST_P(GLES2DecoderTest1, FramebufferTexture2DValidArgs) { 717 EXPECT_CALL(*gl_, 718 FramebufferTexture2DEXT(GL_FRAMEBUFFER, 719 GL_COLOR_ATTACHMENT0, 720 GL_TEXTURE_2D, 721 kServiceTextureId, 722 0)); 723 SpecializedSetup<cmds::FramebufferTexture2D, 0>(true); 724 cmds::FramebufferTexture2D cmd; 725 cmd.Init( 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()); 729 } 730 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, 737 GL_TEXTURE_2D, 738 client_texture_id_); 739 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 740 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 741 } 742 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, 749 GL_TEXTURE_2D, 750 client_texture_id_); 751 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 752 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 753 } 754 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, 762 client_texture_id_); 763 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 764 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 765 } 766 767 TEST_P(GLES2DecoderTest1, FrontFaceValidArgs) { 768 EXPECT_CALL(*gl_, FrontFace(GL_CW)); 769 SpecializedSetup<cmds::FrontFace, 0>(true); 770 cmds::FrontFace cmd; 771 cmd.Init(GL_CW); 772 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 773 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 774 } 775 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); 782 cmd->Init(1, &temp); 783 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp))); 784 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 785 EXPECT_TRUE(GetBuffer(kNewClientId) != NULL); 786 } 787 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_))); 795 } 796 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()); 804 } 805 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()); 813 } 814 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()); 822 } 823 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); 831 cmd->Init(1, &temp); 832 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp))); 833 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 834 EXPECT_TRUE(GetFramebuffer(kNewClientId) != NULL); 835 } 836 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_))); 845 } 846 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); 854 cmd->Init(1, &temp); 855 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp))); 856 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 857 EXPECT_TRUE(GetRenderbuffer(kNewClientId) != NULL); 858 } 859 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_))); 868 } 869 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); 877 cmd->Init(1, &temp); 878 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(*cmd, sizeof(temp))); 879 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 880 EXPECT_TRUE(GetTexture(kNewClientId) != NULL); 881 } 882 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_))); 891 } 892 // TODO(gman): GetActiveAttrib 893 894 // TODO(gman): GetActiveUniform 895 896 // TODO(gman): GetAttachedShaders 897 898 // TODO(gman): GetAttribLocation 899 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())); 909 result->size = 0; 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()); 916 } 917 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_); 923 result->size = 0; 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()); 929 } 930 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_); 936 result->size = 0; 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); 941 } 942 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_); 948 result->size = 0; 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); 953 } 954 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_); 959 result->size = 0; 960 cmds::GetBufferParameteriv cmd; 961 cmd.Init(GL_ARRAY_BUFFER, 962 GL_BUFFER_SIZE, 963 shared_memory_id_, 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()); 969 } 970 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_); 976 result->size = 0; 977 cmds::GetBufferParameteriv cmd; 978 cmd.Init(GL_RENDERBUFFER, 979 GL_BUFFER_SIZE, 980 shared_memory_id_, 981 shared_memory_offset_); 982 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 983 EXPECT_EQ(0u, result->size); 984 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 985 } 986 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_); 992 result->size = 0; 993 cmds::GetBufferParameteriv cmd; 994 cmd.Init(GL_ARRAY_BUFFER, 995 GL_PIXEL_PACK_BUFFER, 996 shared_memory_id_, 997 shared_memory_offset_); 998 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 999 EXPECT_EQ(0u, result->size); 1000 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1001 } 1002 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_); 1008 result->size = 0; 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); 1013 } 1014 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_); 1020 result->size = 0; 1021 cmds::GetBufferParameteriv cmd; 1022 cmd.Init(GL_ARRAY_BUFFER, 1023 GL_BUFFER_SIZE, 1024 shared_memory_id_, 1025 kInvalidSharedMemoryOffset); 1026 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1027 EXPECT_EQ(0u, result->size); 1028 } 1029 1030 TEST_P(GLES2DecoderTest1, GetErrorValidArgs) { 1031 EXPECT_CALL(*gl_, GetError()); 1032 SpecializedSetup<cmds::GetError, 0>(true); 1033 cmds::GetError cmd; 1034 cmd.Init(shared_memory_id_, shared_memory_offset_); 1035 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1036 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1037 } 1038 1039 TEST_P(GLES2DecoderTest1, GetErrorInvalidArgsBadSharedMemoryId) { 1040 EXPECT_CALL(*gl_, GetError()).Times(0); 1041 SpecializedSetup<cmds::GetError, 0>(false); 1042 cmds::GetError cmd; 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)); 1047 } 1048 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())); 1058 result->size = 0; 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()); 1065 } 1066 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_); 1072 result->size = 0; 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()); 1078 } 1079 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_); 1085 result->size = 0; 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); 1090 } 1091 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_); 1097 result->size = 0; 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); 1102 } 1103 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_); 1112 EXPECT_CALL(*gl_, 1113 GetFramebufferAttachmentParameterivEXT( 1114 GL_FRAMEBUFFER, 1115 GL_COLOR_ATTACHMENT0, 1116 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, 1117 result->GetData())); 1118 result->size = 0; 1119 cmds::GetFramebufferAttachmentParameteriv cmd; 1120 cmd.Init(GL_FRAMEBUFFER, 1121 GL_COLOR_ATTACHMENT0, 1122 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, 1123 shared_memory_id_, 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()); 1130 } 1131 1132 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivInvalidArgs0_0) { 1133 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) 1134 .Times(0); 1135 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(false); 1136 cmds::GetFramebufferAttachmentParameteriv::Result* result = 1137 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result*>( 1138 shared_memory_address_); 1139 result->size = 0; 1140 cmds::GetFramebufferAttachmentParameteriv cmd; 1141 cmd.Init(GL_DRAW_FRAMEBUFFER, 1142 GL_COLOR_ATTACHMENT0, 1143 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, 1144 shared_memory_id_, 1145 shared_memory_offset_); 1146 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1147 EXPECT_EQ(0u, result->size); 1148 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1149 } 1150 1151 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivInvalidArgs0_1) { 1152 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) 1153 .Times(0); 1154 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(false); 1155 cmds::GetFramebufferAttachmentParameteriv::Result* result = 1156 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result*>( 1157 shared_memory_address_); 1158 result->size = 0; 1159 cmds::GetFramebufferAttachmentParameteriv cmd; 1160 cmd.Init(GL_READ_FRAMEBUFFER, 1161 GL_COLOR_ATTACHMENT0, 1162 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, 1163 shared_memory_id_, 1164 shared_memory_offset_); 1165 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1166 EXPECT_EQ(0u, result->size); 1167 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1168 } 1169 1170 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivInvalidArgs3_0) { 1171 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) 1172 .Times(0); 1173 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(false); 1174 cmds::GetFramebufferAttachmentParameteriv::Result* result = 1175 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result*>( 1176 shared_memory_address_); 1177 result->size = 0; 1178 cmds::GetFramebufferAttachmentParameteriv cmd; 1179 cmd.Init(GL_FRAMEBUFFER, 1180 GL_COLOR_ATTACHMENT0, 1181 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, 1182 kInvalidSharedMemoryId, 1183 0); 1184 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1185 EXPECT_EQ(0u, result->size); 1186 } 1187 1188 TEST_P(GLES2DecoderTest1, GetFramebufferAttachmentParameterivInvalidArgs3_1) { 1189 EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) 1190 .Times(0); 1191 SpecializedSetup<cmds::GetFramebufferAttachmentParameteriv, 0>(false); 1192 cmds::GetFramebufferAttachmentParameteriv::Result* result = 1193 static_cast<cmds::GetFramebufferAttachmentParameteriv::Result*>( 1194 shared_memory_address_); 1195 result->size = 0; 1196 cmds::GetFramebufferAttachmentParameteriv cmd; 1197 cmd.Init(GL_FRAMEBUFFER, 1198 GL_COLOR_ATTACHMENT0, 1199 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, 1200 shared_memory_id_, 1201 kInvalidSharedMemoryOffset); 1202 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1203 EXPECT_EQ(0u, result->size); 1204 } 1205 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())); 1215 result->size = 0; 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()); 1222 } 1223 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_); 1229 result->size = 0; 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()); 1235 } 1236 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_); 1242 result->size = 0; 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); 1247 } 1248 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_); 1254 result->size = 0; 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); 1259 } 1260 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_); 1265 result->size = 0; 1266 cmds::GetProgramiv cmd; 1267 cmd.Init(client_program_id_, 1268 GL_DELETE_STATUS, 1269 shared_memory_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()); 1275 } 1276 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_); 1282 result->size = 0; 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); 1287 } 1288 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_); 1294 result->size = 0; 1295 cmds::GetProgramiv cmd; 1296 cmd.Init(client_program_id_, 1297 GL_DELETE_STATUS, 1298 shared_memory_id_, 1299 kInvalidSharedMemoryOffset); 1300 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1301 EXPECT_EQ(0u, result->size); 1302 } 1303 1304 TEST_P(GLES2DecoderTest1, GetProgramInfoLogValidArgs) { 1305 const char* kInfo = "hello"; 1306 const uint32_t kBucketId = 123; 1307 SpecializedSetup<cmds::GetProgramInfoLog, 0>(true); 1308 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()); 1315 EXPECT_EQ(0, 1316 memcmp(bucket->GetData(0, bucket->size()), kInfo, bucket->size())); 1317 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1318 } 1319 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()); 1326 } 1327 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_); 1336 EXPECT_CALL( 1337 *gl_, 1338 GetRenderbufferParameterivEXT( 1339 GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, result->GetData())); 1340 result->size = 0; 1341 cmds::GetRenderbufferParameteriv cmd; 1342 cmd.Init(GL_RENDERBUFFER, 1343 GL_RENDERBUFFER_RED_SIZE, 1344 shared_memory_id_, 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()); 1351 } 1352 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_); 1359 result->size = 0; 1360 cmds::GetRenderbufferParameteriv cmd; 1361 cmd.Init(GL_FRAMEBUFFER, 1362 GL_RENDERBUFFER_RED_SIZE, 1363 shared_memory_id_, 1364 shared_memory_offset_); 1365 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1366 EXPECT_EQ(0u, result->size); 1367 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1368 } 1369 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_); 1376 result->size = 0; 1377 cmds::GetRenderbufferParameteriv cmd; 1378 cmd.Init( 1379 GL_RENDERBUFFER, GL_RENDERBUFFER_RED_SIZE, kInvalidSharedMemoryId, 0); 1380 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1381 EXPECT_EQ(0u, result->size); 1382 } 1383 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_); 1390 result->size = 0; 1391 cmds::GetRenderbufferParameteriv cmd; 1392 cmd.Init(GL_RENDERBUFFER, 1393 GL_RENDERBUFFER_RED_SIZE, 1394 shared_memory_id_, 1395 kInvalidSharedMemoryOffset); 1396 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1397 EXPECT_EQ(0u, result->size); 1398 } 1399 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_); 1408 EXPECT_CALL(*gl_, 1409 GetShaderiv(kServiceShaderId, GL_SHADER_TYPE, result->GetData())); 1410 result->size = 0; 1411 cmds::GetShaderiv cmd; 1412 cmd.Init(client_shader_id_, 1413 GL_SHADER_TYPE, 1414 shared_memory_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()); 1420 } 1421 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_); 1427 result->size = 0; 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); 1432 } 1433 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_); 1439 result->size = 0; 1440 cmds::GetShaderiv cmd; 1441 cmd.Init(client_shader_id_, 1442 GL_SHADER_TYPE, 1443 shared_memory_id_, 1444 kInvalidSharedMemoryOffset); 1445 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1446 EXPECT_EQ(0u, result->size); 1447 } 1448 // TODO(gman): GetShaderInfoLog 1449 // TODO(gman): GetShaderPrecisionFormat 1450 1451 // TODO(gman): GetShaderSource 1452 // TODO(gman): GetString 1453 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_); 1462 EXPECT_CALL(*gl_, 1463 GetTexParameterfv( 1464 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, result->GetData())); 1465 result->size = 0; 1466 cmds::GetTexParameterfv cmd; 1467 cmd.Init(GL_TEXTURE_2D, 1468 GL_TEXTURE_MAG_FILTER, 1469 shared_memory_id_, 1470 shared_memory_offset_); 1471 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1472 EXPECT_EQ( 1473 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER), 1474 result->GetNumResults()); 1475 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1476 } 1477 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_); 1483 result->size = 0; 1484 cmds::GetTexParameterfv cmd; 1485 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, 1486 GL_TEXTURE_MAG_FILTER, 1487 shared_memory_id_, 1488 shared_memory_offset_); 1489 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1490 EXPECT_EQ(0u, result->size); 1491 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1492 } 1493 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_); 1499 result->size = 0; 1500 cmds::GetTexParameterfv cmd; 1501 cmd.Init(GL_TEXTURE_2D, 1502 GL_GENERATE_MIPMAP, 1503 shared_memory_id_, 1504 shared_memory_offset_); 1505 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1506 EXPECT_EQ(0u, result->size); 1507 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1508 } 1509 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_); 1515 result->size = 0; 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); 1520 } 1521 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_); 1527 result->size = 0; 1528 cmds::GetTexParameterfv cmd; 1529 cmd.Init(GL_TEXTURE_2D, 1530 GL_TEXTURE_MAG_FILTER, 1531 shared_memory_id_, 1532 kInvalidSharedMemoryOffset); 1533 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1534 EXPECT_EQ(0u, result->size); 1535 } 1536 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_); 1545 EXPECT_CALL(*gl_, 1546 GetTexParameteriv( 1547 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, result->GetData())); 1548 result->size = 0; 1549 cmds::GetTexParameteriv cmd; 1550 cmd.Init(GL_TEXTURE_2D, 1551 GL_TEXTURE_MAG_FILTER, 1552 shared_memory_id_, 1553 shared_memory_offset_); 1554 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1555 EXPECT_EQ( 1556 decoder_->GetGLES2Util()->GLGetNumValuesReturned(GL_TEXTURE_MAG_FILTER), 1557 result->GetNumResults()); 1558 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1559 } 1560 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_); 1566 result->size = 0; 1567 cmds::GetTexParameteriv cmd; 1568 cmd.Init(GL_PROXY_TEXTURE_CUBE_MAP, 1569 GL_TEXTURE_MAG_FILTER, 1570 shared_memory_id_, 1571 shared_memory_offset_); 1572 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1573 EXPECT_EQ(0u, result->size); 1574 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1575 } 1576 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_); 1582 result->size = 0; 1583 cmds::GetTexParameteriv cmd; 1584 cmd.Init(GL_TEXTURE_2D, 1585 GL_GENERATE_MIPMAP, 1586 shared_memory_id_, 1587 shared_memory_offset_); 1588 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1589 EXPECT_EQ(0u, result->size); 1590 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1591 } 1592 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_); 1598 result->size = 0; 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); 1603 } 1604 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_); 1610 result->size = 0; 1611 cmds::GetTexParameteriv cmd; 1612 cmd.Init(GL_TEXTURE_2D, 1613 GL_TEXTURE_MAG_FILTER, 1614 shared_memory_id_, 1615 kInvalidSharedMemoryOffset); 1616 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1617 EXPECT_EQ(0u, result->size); 1618 } 1619 // TODO(gman): GetUniformfv 1620 1621 // TODO(gman): GetUniformiv 1622 1623 // TODO(gman): GetUniformLocation 1624 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_); 1629 result->size = 0; 1630 cmds::GetVertexAttribfv cmd; 1631 cmd.Init(1, 1632 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, 1633 shared_memory_id_, 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()); 1640 } 1641 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_); 1647 result->size = 0; 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); 1652 } 1653 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_); 1659 result->size = 0; 1660 cmds::GetVertexAttribfv cmd; 1661 cmd.Init(1, 1662 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, 1663 shared_memory_id_, 1664 kInvalidSharedMemoryOffset); 1665 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1666 EXPECT_EQ(0u, result->size); 1667 } 1668 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_); 1673 result->size = 0; 1674 cmds::GetVertexAttribiv cmd; 1675 cmd.Init(1, 1676 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, 1677 shared_memory_id_, 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()); 1684 } 1685 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_); 1691 result->size = 0; 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); 1696 } 1697 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_); 1703 result->size = 0; 1704 cmds::GetVertexAttribiv cmd; 1705 cmd.Init(1, 1706 GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, 1707 shared_memory_id_, 1708 kInvalidSharedMemoryOffset); 1709 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1710 EXPECT_EQ(0u, result->size); 1711 } 1712 // TODO(gman): GetVertexAttribPointerv 1713 1714 TEST_P(GLES2DecoderTest1, HintValidArgs) { 1715 EXPECT_CALL(*gl_, Hint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST)); 1716 SpecializedSetup<cmds::Hint, 0>(true); 1717 cmds::Hint cmd; 1718 cmd.Init(GL_GENERATE_MIPMAP_HINT, GL_FASTEST); 1719 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1720 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1721 } 1722 1723 TEST_P(GLES2DecoderTest1, HintInvalidArgs0_0) { 1724 EXPECT_CALL(*gl_, Hint(_, _)).Times(0); 1725 SpecializedSetup<cmds::Hint, 0>(false); 1726 cmds::Hint cmd; 1727 cmd.Init(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); 1728 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1729 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1730 } 1731 1732 TEST_P(GLES2DecoderTest1, IsBufferValidArgs) { 1733 SpecializedSetup<cmds::IsBuffer, 0>(true); 1734 cmds::IsBuffer cmd; 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()); 1738 } 1739 1740 TEST_P(GLES2DecoderTest1, IsBufferInvalidArgsBadSharedMemoryId) { 1741 SpecializedSetup<cmds::IsBuffer, 0>(false); 1742 cmds::IsBuffer cmd; 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)); 1747 } 1748 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()); 1755 } 1756 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()); 1764 } 1765 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()); 1773 } 1774 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)); 1782 } 1783 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()); 1790 } 1791 1792 TEST_P(GLES2DecoderTest1, IsFramebufferInvalidArgsBadSharedMemoryId) { 1793 SpecializedSetup<cmds::IsFramebuffer, 0>(false); 1794 cmds::IsFramebuffer cmd; 1795 cmd.Init( 1796 client_framebuffer_id_, kInvalidSharedMemoryId, shared_memory_offset_); 1797 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1798 cmd.Init( 1799 client_framebuffer_id_, shared_memory_id_, kInvalidSharedMemoryOffset); 1800 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1801 } 1802 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()); 1809 } 1810 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)); 1818 } 1819 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()); 1826 } 1827 1828 TEST_P(GLES2DecoderTest1, IsRenderbufferInvalidArgsBadSharedMemoryId) { 1829 SpecializedSetup<cmds::IsRenderbuffer, 0>(false); 1830 cmds::IsRenderbuffer cmd; 1831 cmd.Init( 1832 client_renderbuffer_id_, kInvalidSharedMemoryId, shared_memory_offset_); 1833 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1834 cmd.Init( 1835 client_renderbuffer_id_, shared_memory_id_, kInvalidSharedMemoryOffset); 1836 EXPECT_EQ(error::kOutOfBounds, ExecuteCmd(cmd)); 1837 } 1838 1839 TEST_P(GLES2DecoderTest1, IsShaderValidArgs) { 1840 SpecializedSetup<cmds::IsShader, 0>(true); 1841 cmds::IsShader cmd; 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()); 1845 } 1846 1847 TEST_P(GLES2DecoderTest1, IsShaderInvalidArgsBadSharedMemoryId) { 1848 SpecializedSetup<cmds::IsShader, 0>(false); 1849 cmds::IsShader cmd; 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)); 1854 } 1855 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()); 1862 } 1863 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)); 1871 } 1872 1873 TEST_P(GLES2DecoderTest1, LineWidthValidArgs) { 1874 EXPECT_CALL(*gl_, LineWidth(0.5f)); 1875 SpecializedSetup<cmds::LineWidth, 0>(true); 1876 cmds::LineWidth cmd; 1877 cmd.Init(0.5f); 1878 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1879 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1880 } 1881 1882 TEST_P(GLES2DecoderTest1, LineWidthInvalidValue0_0) { 1883 SpecializedSetup<cmds::LineWidth, 0>(false); 1884 cmds::LineWidth cmd; 1885 cmd.Init(0.0f); 1886 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1887 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1888 } 1889 1890 TEST_P(GLES2DecoderTest1, LinkProgramValidArgs) { 1891 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId)); 1892 SpecializedSetup<cmds::LinkProgram, 0>(true); 1893 cmds::LinkProgram cmd; 1894 cmd.Init(client_program_id_); 1895 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1896 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1897 } 1898 // TODO(gman): PixelStorei 1899 1900 TEST_P(GLES2DecoderTest1, PolygonOffsetValidArgs) { 1901 EXPECT_CALL(*gl_, PolygonOffset(1, 2)); 1902 SpecializedSetup<cmds::PolygonOffset, 0>(true); 1903 cmds::PolygonOffset cmd; 1904 cmd.Init(1, 2); 1905 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1906 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1907 } 1908 // TODO(gman): ReadPixels 1909 1910 // TODO(gman): ReleaseShaderCompiler 1911 1912 TEST_P(GLES2DecoderTest1, RenderbufferStorageValidArgs) { 1913 SpecializedSetup<cmds::RenderbufferStorage, 0>(true); 1914 cmds::RenderbufferStorage cmd; 1915 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, 4); 1916 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1917 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1918 } 1919 1920 TEST_P(GLES2DecoderTest1, RenderbufferStorageInvalidArgs0_0) { 1921 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); 1922 SpecializedSetup<cmds::RenderbufferStorage, 0>(false); 1923 cmds::RenderbufferStorage cmd; 1924 cmd.Init(GL_FRAMEBUFFER, GL_RGBA4, 3, 4); 1925 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1926 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 1927 } 1928 1929 TEST_P(GLES2DecoderTest1, RenderbufferStorageInvalidArgs2_0) { 1930 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); 1931 SpecializedSetup<cmds::RenderbufferStorage, 0>(false); 1932 cmds::RenderbufferStorage cmd; 1933 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, -1, 4); 1934 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1935 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1936 } 1937 1938 TEST_P(GLES2DecoderTest1, RenderbufferStorageInvalidArgs3_0) { 1939 EXPECT_CALL(*gl_, RenderbufferStorageEXT(_, _, _, _)).Times(0); 1940 SpecializedSetup<cmds::RenderbufferStorage, 0>(false); 1941 cmds::RenderbufferStorage cmd; 1942 cmd.Init(GL_RENDERBUFFER, GL_RGBA4, 3, -1); 1943 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1944 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); 1945 } 1946 1947 TEST_P(GLES2DecoderTest1, SampleCoverageValidArgs) { 1948 EXPECT_CALL(*gl_, SampleCoverage(1, true)); 1949 SpecializedSetup<cmds::SampleCoverage, 0>(true); 1950 cmds::SampleCoverage cmd; 1951 cmd.Init(1, true); 1952 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 1953 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1954 } 1955 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_1_AUTOGEN_H_ 1956