Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_unittest_base.h
blobae343d5f563227eaa323df1a7c068c8c2a0d0a19
1 // Copyright (c) 2012 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 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_
8 #include "gpu/command_buffer/common/gles2_cmd_format.h"
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
10 #include "gpu/command_buffer/service/buffer_manager.h"
11 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
12 #include "gpu/command_buffer/service/context_group.h"
13 #include "gpu/command_buffer/service/framebuffer_manager.h"
14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
16 #include "gpu/command_buffer/service/program_manager.h"
17 #include "gpu/command_buffer/service/query_manager.h"
18 #include "gpu/command_buffer/service/renderbuffer_manager.h"
19 #include "gpu/command_buffer/service/shader_manager.h"
20 #include "gpu/command_buffer/service/test_helper.h"
21 #include "gpu/command_buffer/service/texture_manager.h"
22 #include "gpu/command_buffer/service/vertex_array_manager.h"
23 #include "testing/gtest/include/gtest/gtest.h"
24 #include "ui/gl/gl_context_stub_with_extensions.h"
25 #include "ui/gl/gl_surface_stub.h"
26 #include "ui/gl/gl_mock.h"
28 namespace base {
29 class CommandLine;
32 namespace gpu {
33 namespace gles2 {
35 class MemoryTracker;
37 class GLES2DecoderTestBase : public ::testing::TestWithParam<bool> {
38 public:
39 GLES2DecoderTestBase();
40 virtual ~GLES2DecoderTestBase();
42 // Template to call glGenXXX functions.
43 template <typename T>
44 void GenHelper(GLuint client_id) {
45 int8 buffer[sizeof(T) + sizeof(client_id)];
46 T& cmd = *reinterpret_cast<T*>(&buffer);
47 cmd.Init(1, &client_id);
48 EXPECT_EQ(error::kNoError,
49 ExecuteImmediateCmd(cmd, sizeof(client_id)));
52 // This template exists solely so we can specialize it for
53 // certain commands.
54 template <typename T, int id>
55 void SpecializedSetup(bool valid) {
58 template <typename T>
59 T* GetImmediateAs() {
60 return reinterpret_cast<T*>(immediate_buffer_);
63 template <typename T, typename Command>
64 T GetImmediateDataAs(Command* cmd) {
65 return reinterpret_cast<T>(ImmediateDataAddress(cmd));
68 void ClearSharedMemory() {
69 engine_->ClearSharedMemory();
72 virtual void SetUp() OVERRIDE;
73 virtual void TearDown() OVERRIDE;
75 template <typename T>
76 error::Error ExecuteCmd(const T& cmd) {
77 COMPILE_ASSERT(T::kArgFlags == cmd::kFixed, Cmd_kArgFlags_not_kFixed);
78 return decoder_->DoCommand(cmd.kCmdId,
79 ComputeNumEntries(sizeof(cmd)) - 1,
80 &cmd);
83 template <typename T>
84 error::Error ExecuteImmediateCmd(const T& cmd, size_t data_size) {
85 COMPILE_ASSERT(T::kArgFlags == cmd::kAtLeastN, Cmd_kArgFlags_not_kAtLeastN);
86 return decoder_->DoCommand(cmd.kCmdId,
87 ComputeNumEntries(sizeof(cmd) + data_size) - 1,
88 &cmd);
91 template <typename T>
92 T GetSharedMemoryAs() {
93 return reinterpret_cast<T>(shared_memory_address_);
96 template <typename T>
97 T GetSharedMemoryAsWithOffset(uint32 offset) {
98 void* ptr = reinterpret_cast<int8*>(shared_memory_address_) + offset;
99 return reinterpret_cast<T>(ptr);
102 IdAllocatorInterface* GetIdAllocator(GLuint namespace_id) {
103 return group_->GetIdAllocator(namespace_id);
106 Buffer* GetBuffer(GLuint service_id) {
107 return group_->buffer_manager()->GetBuffer(service_id);
110 Framebuffer* GetFramebuffer(GLuint service_id) {
111 return group_->framebuffer_manager()->GetFramebuffer(service_id);
114 Renderbuffer* GetRenderbuffer(
115 GLuint service_id) {
116 return group_->renderbuffer_manager()->GetRenderbuffer(service_id);
119 TextureRef* GetTexture(GLuint client_id) {
120 return group_->texture_manager()->GetTexture(client_id);
123 Shader* GetShader(GLuint client_id) {
124 return group_->shader_manager()->GetShader(client_id);
127 Program* GetProgram(GLuint client_id) {
128 return group_->program_manager()->GetProgram(client_id);
131 QueryManager::Query* GetQueryInfo(GLuint client_id) {
132 return decoder_->GetQueryManager()->GetQuery(client_id);
135 // This name doesn't match the underlying function, but doing it this way
136 // prevents the need to special-case the unit test generation
137 VertexAttribManager* GetVertexArrayInfo(GLuint client_id) {
138 return decoder_->GetVertexArrayManager()->GetVertexAttribManager(client_id);
141 ProgramManager* program_manager() {
142 return group_->program_manager();
145 ImageManager* GetImageManager() { return decoder_->GetImageManager(); }
147 void DoCreateProgram(GLuint client_id, GLuint service_id);
148 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id);
150 void SetBucketAsCString(uint32 bucket_id, const char* str);
152 void set_memory_tracker(MemoryTracker* memory_tracker) {
153 memory_tracker_ = memory_tracker;
156 struct InitState {
157 InitState();
159 std::string extensions;
160 std::string gl_version;
161 bool has_alpha;
162 bool has_depth;
163 bool has_stencil;
164 bool request_alpha;
165 bool request_depth;
166 bool request_stencil;
167 bool bind_generates_resource;
168 bool lose_context_when_out_of_memory;
169 bool use_native_vao; // default is true.
172 void InitDecoder(const InitState& init);
173 void InitDecoderWithCommandLine(const InitState& init,
174 const base::CommandLine* command_line);
176 void ResetDecoder();
178 const ContextGroup& group() const {
179 return *group_.get();
182 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const {
183 return gl_.get();
186 GLES2Decoder* GetDecoder() const {
187 return decoder_.get();
190 typedef TestHelper::AttribInfo AttribInfo;
191 typedef TestHelper::UniformInfo UniformInfo;
193 void SetupShader(
194 AttribInfo* attribs, size_t num_attribs,
195 UniformInfo* uniforms, size_t num_uniforms,
196 GLuint client_id, GLuint service_id,
197 GLuint vertex_shader_client_id, GLuint vertex_shader_service_id,
198 GLuint fragment_shader_client_id, GLuint fragment_shader_service_id);
200 void SetupInitCapabilitiesExpectations();
201 void SetupInitStateExpectations();
202 void ExpectEnableDisable(GLenum cap, bool enable);
204 // Setups up a shader for testing glUniform.
205 void SetupShaderForUniform(GLenum uniform_type);
206 void SetupDefaultProgram();
207 void SetupCubemapProgram();
208 void SetupSamplerExternalProgram();
209 void SetupTexture();
211 // Note that the error is returned as GLint instead of GLenum.
212 // This is because there is a mismatch in the types of GLenum and
213 // the error values GL_NO_ERROR, GL_INVALID_ENUM, etc. GLenum is
214 // typedef'd as unsigned int while the error values are defined as
215 // integers. This is problematic for template functions such as
216 // EXPECT_EQ that expect both types to be the same.
217 GLint GetGLError();
219 void DoBindBuffer(GLenum target, GLuint client_id, GLuint service_id);
220 void DoBindFramebuffer(GLenum target, GLuint client_id, GLuint service_id);
221 void DoBindRenderbuffer(GLenum target, GLuint client_id, GLuint service_id);
222 void DoRenderbufferStorageMultisampleCHROMIUM(GLenum target,
223 GLsizei samples,
224 GLenum internal_format,
225 GLenum gl_format,
226 GLsizei width,
227 GLsizei height);
228 void RestoreRenderbufferBindings();
229 void EnsureRenderbufferBound(bool expect_bind);
230 void DoBindTexture(GLenum target, GLuint client_id, GLuint service_id);
231 void DoBindVertexArrayOES(GLuint client_id, GLuint service_id);
233 bool DoIsBuffer(GLuint client_id);
234 bool DoIsFramebuffer(GLuint client_id);
235 bool DoIsProgram(GLuint client_id);
236 bool DoIsRenderbuffer(GLuint client_id);
237 bool DoIsShader(GLuint client_id);
238 bool DoIsTexture(GLuint client_id);
240 void DoDeleteBuffer(GLuint client_id, GLuint service_id);
241 void DoDeleteFramebuffer(
242 GLuint client_id, GLuint service_id,
243 bool reset_draw, GLenum draw_target, GLuint draw_id,
244 bool reset_read, GLenum read_target, GLuint read_id);
245 void DoDeleteProgram(GLuint client_id, GLuint service_id);
246 void DoDeleteRenderbuffer(GLuint client_id, GLuint service_id);
247 void DoDeleteShader(GLuint client_id, GLuint service_id);
248 void DoDeleteTexture(GLuint client_id, GLuint service_id);
250 void DoCompressedTexImage2D(
251 GLenum target, GLint level, GLenum format,
252 GLsizei width, GLsizei height, GLint border,
253 GLsizei size, uint32 bucket_id);
254 void DoTexImage2D(
255 GLenum target, GLint level, GLenum internal_format,
256 GLsizei width, GLsizei height, GLint border,
257 GLenum format, GLenum type,
258 uint32 shared_memory_id, uint32 shared_memory_offset);
259 void DoTexImage2DConvertInternalFormat(
260 GLenum target, GLint level, GLenum requested_internal_format,
261 GLsizei width, GLsizei height, GLint border,
262 GLenum format, GLenum type,
263 uint32 shared_memory_id, uint32 shared_memory_offset,
264 GLenum expected_internal_format);
265 void DoRenderbufferStorage(
266 GLenum target, GLenum internal_format, GLenum actual_format,
267 GLsizei width, GLsizei height, GLenum error);
268 void DoFramebufferRenderbuffer(
269 GLenum target,
270 GLenum attachment,
271 GLenum renderbuffer_target,
272 GLuint renderbuffer_client_id,
273 GLuint renderbuffer_service_id,
274 GLenum error);
275 void DoFramebufferTexture2D(
276 GLenum target, GLenum attachment, GLenum tex_target,
277 GLuint texture_client_id, GLuint texture_service_id,
278 GLint level, GLenum error);
279 void DoVertexAttribPointer(
280 GLuint index, GLint size, GLenum type, GLsizei stride, GLuint offset);
281 void DoVertexAttribDivisorANGLE(GLuint index, GLuint divisor);
283 void DoEnableDisable(GLenum cap, bool enable);
285 void DoEnableVertexAttribArray(GLint index);
287 void DoBufferData(GLenum target, GLsizei size);
289 void DoBufferSubData(
290 GLenum target, GLint offset, GLsizei size, const void* data);
292 void SetupVertexBuffer();
293 void SetupAllNeededVertexBuffers();
295 void SetupIndexBuffer();
297 void DeleteVertexBuffer();
299 void DeleteIndexBuffer();
301 void SetupClearTextureExpectations(
302 GLuint service_id,
303 GLuint old_service_id,
304 GLenum bind_target,
305 GLenum target,
306 GLint level,
307 GLenum internal_format,
308 GLenum format,
309 GLenum type,
310 GLsizei width,
311 GLsizei height);
313 void SetupExpectationsForRestoreClearState(
314 GLclampf restore_red,
315 GLclampf restore_green,
316 GLclampf restore_blue,
317 GLclampf restore_alpha,
318 GLuint restore_stencil,
319 GLclampf restore_depth,
320 bool restore_scissor_test);
322 void SetupExpectationsForFramebufferClearing(
323 GLenum target,
324 GLuint clear_bits,
325 GLclampf restore_red,
326 GLclampf restore_green,
327 GLclampf restore_blue,
328 GLclampf restore_alpha,
329 GLuint restore_stencil,
330 GLclampf restore_depth,
331 bool restore_scissor_test);
333 void SetupExpectationsForFramebufferClearingMulti(
334 GLuint read_framebuffer_service_id,
335 GLuint draw_framebuffer_service_id,
336 GLenum target,
337 GLuint clear_bits,
338 GLclampf restore_red,
339 GLclampf restore_green,
340 GLclampf restore_blue,
341 GLclampf restore_alpha,
342 GLuint restore_stencil,
343 GLclampf restore_depth,
344 bool restore_scissor_test);
346 void SetupExpectationsForDepthMask(bool mask);
347 void SetupExpectationsForEnableDisable(GLenum cap, bool enable);
348 void SetupExpectationsForColorMask(bool red,
349 bool green,
350 bool blue,
351 bool alpha);
352 void SetupExpectationsForStencilMask(GLuint front_mask, GLuint back_mask);
354 void SetupExpectationsForApplyingDirtyState(
355 bool framebuffer_is_rgb,
356 bool framebuffer_has_depth,
357 bool framebuffer_has_stencil,
358 GLuint color_bits, // NOTE! bits are 0x1000, 0x0100, 0x0010, and 0x0001
359 bool depth_mask,
360 bool depth_enabled,
361 GLuint front_stencil_mask,
362 GLuint back_stencil_mask,
363 bool stencil_enabled);
365 void SetupExpectationsForApplyingDefaultDirtyState();
367 void AddExpectationsForSimulatedAttrib0WithError(
368 GLsizei num_vertices, GLuint buffer_id, GLenum error);
370 void AddExpectationsForSimulatedAttrib0(
371 GLsizei num_vertices, GLuint buffer_id);
373 void AddExpectationsForGenVertexArraysOES();
374 void AddExpectationsForDeleteVertexArraysOES();
375 void AddExpectationsForDeleteBoundVertexArraysOES();
376 void AddExpectationsForBindVertexArrayOES();
377 void AddExpectationsForRestoreAttribState(GLuint attrib);
379 GLvoid* BufferOffset(unsigned i) {
380 return static_cast<int8 *>(NULL)+(i);
383 template <typename Command, typename Result>
384 bool IsObjectHelper(GLuint client_id) {
385 Result* result = static_cast<Result*>(shared_memory_address_);
386 Command cmd;
387 cmd.Init(client_id, kSharedMemoryId, kSharedMemoryOffset);
388 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
389 bool isObject = static_cast<bool>(*result);
390 EXPECT_EQ(GL_NO_ERROR, GetGLError());
391 return isObject;
394 protected:
395 static const int kBackBufferWidth = 128;
396 static const int kBackBufferHeight = 64;
398 static const GLint kMaxTextureSize = 2048;
399 static const GLint kMaxCubeMapTextureSize = 256;
400 static const GLint kNumVertexAttribs = 16;
401 static const GLint kNumTextureUnits = 8;
402 static const GLint kMaxTextureImageUnits = 8;
403 static const GLint kMaxVertexTextureImageUnits = 2;
404 static const GLint kMaxFragmentUniformVectors = 16;
405 static const GLint kMaxVaryingVectors = 8;
406 static const GLint kMaxVertexUniformVectors = 128;
407 static const GLint kMaxViewportWidth = 8192;
408 static const GLint kMaxViewportHeight = 8192;
410 static const GLint kViewportX = 0;
411 static const GLint kViewportY = 0;
412 static const GLint kViewportWidth = kBackBufferWidth;
413 static const GLint kViewportHeight = kBackBufferHeight;
415 static const GLuint kServiceAttrib0BufferId = 801;
416 static const GLuint kServiceFixedAttribBufferId = 802;
418 static const GLuint kServiceBufferId = 301;
419 static const GLuint kServiceFramebufferId = 302;
420 static const GLuint kServiceRenderbufferId = 303;
421 static const GLuint kServiceTextureId = 304;
422 static const GLuint kServiceProgramId = 305;
423 static const GLuint kServiceShaderId = 306;
424 static const GLuint kServiceElementBufferId = 308;
425 static const GLuint kServiceQueryId = 309;
426 static const GLuint kServiceVertexArrayId = 310;
428 static const int32 kSharedMemoryId = 401;
429 static const size_t kSharedBufferSize = 2048;
430 static const uint32 kSharedMemoryOffset = 132;
431 static const int32 kInvalidSharedMemoryId = 402;
432 static const uint32 kInvalidSharedMemoryOffset = kSharedBufferSize + 1;
433 static const uint32 kInitialResult = 0xBDBDBDBDu;
434 static const uint8 kInitialMemoryValue = 0xBDu;
436 static const uint32 kNewClientId = 501;
437 static const uint32 kNewServiceId = 502;
438 static const uint32 kInvalidClientId = 601;
440 static const GLuint kServiceVertexShaderId = 321;
441 static const GLuint kServiceFragmentShaderId = 322;
443 static const GLuint kServiceCopyTextureChromiumShaderId = 701;
444 static const GLuint kServiceCopyTextureChromiumProgramId = 721;
446 static const GLuint kServiceCopyTextureChromiumTextureBufferId = 751;
447 static const GLuint kServiceCopyTextureChromiumVertexBufferId = 752;
448 static const GLuint kServiceCopyTextureChromiumFBOId = 753;
449 static const GLuint kServiceCopyTextureChromiumPositionAttrib = 761;
450 static const GLuint kServiceCopyTextureChromiumTexAttrib = 762;
451 static const GLuint kServiceCopyTextureChromiumSamplerLocation = 763;
453 static const GLsizei kNumVertices = 100;
454 static const GLsizei kNumIndices = 10;
455 static const int kValidIndexRangeStart = 1;
456 static const int kValidIndexRangeCount = 7;
457 static const int kInvalidIndexRangeStart = 0;
458 static const int kInvalidIndexRangeCount = 7;
459 static const int kOutOfRangeIndexRangeEnd = 10;
460 static const GLuint kMaxValidIndex = 7;
462 static const GLint kMaxAttribLength = 10;
463 static const char* kAttrib1Name;
464 static const char* kAttrib2Name;
465 static const char* kAttrib3Name;
466 static const GLint kAttrib1Size = 1;
467 static const GLint kAttrib2Size = 1;
468 static const GLint kAttrib3Size = 1;
469 static const GLint kAttrib1Location = 0;
470 static const GLint kAttrib2Location = 1;
471 static const GLint kAttrib3Location = 2;
472 static const GLenum kAttrib1Type = GL_FLOAT_VEC4;
473 static const GLenum kAttrib2Type = GL_FLOAT_VEC2;
474 static const GLenum kAttrib3Type = GL_FLOAT_VEC3;
475 static const GLint kInvalidAttribLocation = 30;
476 static const GLint kBadAttribIndex = kNumVertexAttribs;
478 static const GLint kMaxUniformLength = 12;
479 static const char* kUniform1Name;
480 static const char* kUniform2Name;
481 static const char* kUniform3Name;
482 static const GLint kUniform1Size = 1;
483 static const GLint kUniform2Size = 3;
484 static const GLint kUniform3Size = 2;
485 static const GLint kUniform1RealLocation = 3;
486 static const GLint kUniform2RealLocation = 10;
487 static const GLint kUniform2ElementRealLocation = 12;
488 static const GLint kUniform3RealLocation = 20;
489 static const GLint kUniform1FakeLocation = 0; // These are
490 static const GLint kUniform2FakeLocation = 1; // hardcoded
491 static const GLint kUniform2ElementFakeLocation = 0x10001; // to match
492 static const GLint kUniform3FakeLocation = 2; // ProgramManager.
493 static const GLint kUniform1DesiredLocation = -1;
494 static const GLint kUniform2DesiredLocation = -1;
495 static const GLint kUniform3DesiredLocation = -1;
496 static const GLenum kUniform1Type = GL_SAMPLER_2D;
497 static const GLenum kUniform2Type = GL_INT_VEC2;
498 static const GLenum kUniform3Type = GL_FLOAT_VEC3;
499 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES;
500 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE;
501 static const GLint kInvalidUniformLocation = 30;
502 static const GLint kBadUniformIndex = 1000;
504 // Use StrictMock to make 100% sure we know how GL will be called.
505 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
506 scoped_refptr<gfx::GLSurfaceStub> surface_;
507 scoped_refptr<gfx::GLContextStubWithExtensions> context_;
508 scoped_ptr<MockGLES2Decoder> mock_decoder_;
509 scoped_ptr<GLES2Decoder> decoder_;
510 MemoryTracker* memory_tracker_;
512 GLuint client_buffer_id_;
513 GLuint client_framebuffer_id_;
514 GLuint client_program_id_;
515 GLuint client_renderbuffer_id_;
516 GLuint client_shader_id_;
517 GLuint client_texture_id_;
518 GLuint client_element_buffer_id_;
519 GLuint client_vertex_shader_id_;
520 GLuint client_fragment_shader_id_;
521 GLuint client_query_id_;
522 GLuint client_vertexarray_id_;
524 uint32 shared_memory_id_;
525 uint32 shared_memory_offset_;
526 void* shared_memory_address_;
527 void* shared_memory_base_;
529 GLuint service_renderbuffer_id_;
530 bool service_renderbuffer_valid_;
532 uint32 immediate_buffer_[64];
534 const bool ignore_cached_state_for_test_;
535 bool cached_color_mask_red_;
536 bool cached_color_mask_green_;
537 bool cached_color_mask_blue_;
538 bool cached_color_mask_alpha_;
539 bool cached_depth_mask_;
540 GLuint cached_stencil_front_mask_;
541 GLuint cached_stencil_back_mask_;
543 struct EnableFlags {
544 EnableFlags();
545 bool cached_blend;
546 bool cached_cull_face;
547 bool cached_depth_test;
548 bool cached_dither;
549 bool cached_polygon_offset_fill;
550 bool cached_sample_alpha_to_coverage;
551 bool cached_sample_coverage;
552 bool cached_scissor_test;
553 bool cached_stencil_test;
556 EnableFlags enable_flags_;
558 private:
559 class MockCommandBufferEngine : public CommandBufferEngine {
560 public:
561 MockCommandBufferEngine();
563 virtual ~MockCommandBufferEngine();
565 virtual scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32 shm_id)
566 OVERRIDE;
568 void ClearSharedMemory() {
569 memset(valid_buffer_->memory(), kInitialMemoryValue, kSharedBufferSize);
572 virtual void set_token(int32 token) OVERRIDE;
574 virtual bool SetGetBuffer(int32 /* transfer_buffer_id */) OVERRIDE;
576 // Overridden from CommandBufferEngine.
577 virtual bool SetGetOffset(int32 offset) OVERRIDE;
579 // Overridden from CommandBufferEngine.
580 virtual int32 GetGetOffset() OVERRIDE;
582 private:
583 scoped_refptr<gpu::Buffer> valid_buffer_;
584 scoped_refptr<gpu::Buffer> invalid_buffer_;
587 // MockGLStates is used to track GL states and emulate driver
588 // behaviors on top of MockGLInterface.
589 class MockGLStates {
590 public:
591 MockGLStates()
592 : bound_array_buffer_object_(0),
593 bound_vertex_array_object_(0) {
596 ~MockGLStates() {
599 void OnBindArrayBuffer(GLuint id) {
600 bound_array_buffer_object_ = id;
603 void OnBindVertexArrayOES(GLuint id) {
604 bound_vertex_array_object_ = id;
607 void OnVertexAttribNullPointer() {
608 // When a vertex array object is bound, some drivers (AMD Linux,
609 // Qualcomm, etc.) have a bug where it incorrectly generates an
610 // GL_INVALID_OPERATION on glVertexAttribPointer() if pointer
611 // is NULL, no buffer is bound on GL_ARRAY_BUFFER.
612 // Make sure we don't trigger this bug.
613 if (bound_vertex_array_object_ != 0)
614 EXPECT_TRUE(bound_array_buffer_object_ != 0);
617 private:
618 GLuint bound_array_buffer_object_;
619 GLuint bound_vertex_array_object_;
620 }; // class MockGLStates
622 void AddExpectationsForVertexAttribManager();
623 void SetupMockGLBehaviors();
625 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_;
626 scoped_refptr<ContextGroup> group_;
627 MockGLStates gl_states_;
630 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase {
631 public:
632 GLES2DecoderWithShaderTestBase()
633 : GLES2DecoderTestBase() {
636 protected:
637 virtual void SetUp() OVERRIDE;
638 virtual void TearDown() OVERRIDE;
642 // SpecializedSetup specializations that are needed in multiple unittest files.
643 template <>
644 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid);
646 } // namespace gles2
647 } // namespace gpu
649 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_