| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 
| 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 
| 7 | 7 | 
| 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 
| 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 
| 10 #include "gpu/command_buffer/service/buffer_manager.h" | 10 #include "gpu/command_buffer/service/buffer_manager.h" | 
| 11 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 11 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 
| 12 #include "gpu/command_buffer/service/context_group.h" | 12 #include "gpu/command_buffer/service/context_group.h" | 
| 13 #include "gpu/command_buffer/service/framebuffer_manager.h" | 13 #include "gpu/command_buffer/service/framebuffer_manager.h" | 
| 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 
| 15 #include "gpu/command_buffer/service/program_manager.h" | 15 #include "gpu/command_buffer/service/program_manager.h" | 
| 16 #include "gpu/command_buffer/service/query_manager.h" | 16 #include "gpu/command_buffer/service/query_manager.h" | 
| 17 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 17 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 
| 18 #include "gpu/command_buffer/service/shader_manager.h" | 18 #include "gpu/command_buffer/service/shader_manager.h" | 
| 19 #include "gpu/command_buffer/service/test_helper.h" | 19 #include "gpu/command_buffer/service/test_helper.h" | 
| 20 #include "gpu/command_buffer/service/texture_manager.h" | 20 #include "gpu/command_buffer/service/texture_manager.h" | 
| 21 #include "gpu/command_buffer/service/vertex_array_manager.h" | 21 #include "gpu/command_buffer/service/vertex_array_manager.h" | 
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" | 
| 23 #include "ui/gl/gl_context_stub.h" | 23 #include "ui/gl/gl_context_stub.h" | 
| 24 #include "ui/gl/gl_surface_stub.h" | 24 #include "ui/gl/gl_surface_stub.h" | 
| 25 #include "ui/gl/gl_mock.h" | 25 #include "ui/gl/gl_mock.h" | 
| 26 | 26 | 
| 27 namespace gpu { | 27 namespace gpu { | 
| 28 namespace gles2 { | 28 namespace gles2 { | 
| 29 | 29 | 
|  | 30 class MemoryTracker; | 
|  | 31 | 
| 30 class GLES2DecoderTestBase : public testing::Test { | 32 class GLES2DecoderTestBase : public testing::Test { | 
| 31  public: | 33  public: | 
| 32   GLES2DecoderTestBase(); | 34   GLES2DecoderTestBase(); | 
| 33   virtual ~GLES2DecoderTestBase(); | 35   virtual ~GLES2DecoderTestBase(); | 
| 34 | 36 | 
| 35   // Template to call glGenXXX functions. | 37   // Template to call glGenXXX functions. | 
| 36   template <typename T> | 38   template <typename T> | 
| 37   void GenHelper(GLuint client_id) { | 39   void GenHelper(GLuint client_id) { | 
| 38     int8 buffer[sizeof(T) + sizeof(client_id)]; | 40     int8 buffer[sizeof(T) + sizeof(client_id)]; | 
| 39     T& cmd = *reinterpret_cast<T*>(&buffer); | 41     T& cmd = *reinterpret_cast<T*>(&buffer); | 
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 133 | 135 | 
| 134   ProgramManager* program_manager() { | 136   ProgramManager* program_manager() { | 
| 135     return group_->program_manager(); | 137     return group_->program_manager(); | 
| 136   } | 138   } | 
| 137 | 139 | 
| 138   void DoCreateProgram(GLuint client_id, GLuint service_id); | 140   void DoCreateProgram(GLuint client_id, GLuint service_id); | 
| 139   void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); | 141   void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); | 
| 140 | 142 | 
| 141   void SetBucketAsCString(uint32 bucket_id, const char* str); | 143   void SetBucketAsCString(uint32 bucket_id, const char* str); | 
| 142 | 144 | 
|  | 145   void set_memory_tracker(MemoryTracker* memory_tracker) { | 
|  | 146     memory_tracker_ = memory_tracker; | 
|  | 147   } | 
|  | 148 | 
| 143   void InitDecoder( | 149   void InitDecoder( | 
| 144       const char* extensions, | 150       const char* extensions, | 
| 145       bool has_alpha, | 151       bool has_alpha, | 
| 146       bool has_depth, | 152       bool has_depth, | 
| 147       bool has_stencil, | 153       bool has_stencil, | 
| 148       bool request_alpha, | 154       bool request_alpha, | 
| 149       bool request_depth, | 155       bool request_depth, | 
| 150       bool request_stencil, | 156       bool request_stencil, | 
| 151       bool bind_generates_resource); | 157       bool bind_generates_resource); | 
| 152 | 158 | 
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 461   static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; | 467   static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; | 
| 462   static const GLint kInvalidUniformLocation = 30; | 468   static const GLint kInvalidUniformLocation = 30; | 
| 463   static const GLint kBadUniformIndex = 1000; | 469   static const GLint kBadUniformIndex = 1000; | 
| 464 | 470 | 
| 465   // Use StrictMock to make 100% sure we know how GL will be called. | 471   // Use StrictMock to make 100% sure we know how GL will be called. | 
| 466   scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 472   scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 
| 467   scoped_refptr<gfx::GLSurfaceStub> surface_; | 473   scoped_refptr<gfx::GLSurfaceStub> surface_; | 
| 468   scoped_refptr<gfx::GLContextStub> context_; | 474   scoped_refptr<gfx::GLContextStub> context_; | 
| 469   scoped_ptr<GLES2Decoder> mock_decoder_; | 475   scoped_ptr<GLES2Decoder> mock_decoder_; | 
| 470   scoped_ptr<GLES2Decoder> decoder_; | 476   scoped_ptr<GLES2Decoder> decoder_; | 
|  | 477   MemoryTracker* memory_tracker_; | 
| 471 | 478 | 
| 472   GLuint client_buffer_id_; | 479   GLuint client_buffer_id_; | 
| 473   GLuint client_framebuffer_id_; | 480   GLuint client_framebuffer_id_; | 
| 474   GLuint client_program_id_; | 481   GLuint client_program_id_; | 
| 475   GLuint client_renderbuffer_id_; | 482   GLuint client_renderbuffer_id_; | 
| 476   GLuint client_shader_id_; | 483   GLuint client_shader_id_; | 
| 477   GLuint client_texture_id_; | 484   GLuint client_texture_id_; | 
| 478   GLuint client_element_buffer_id_; | 485   GLuint client_element_buffer_id_; | 
| 479   GLuint client_vertex_shader_id_; | 486   GLuint client_vertex_shader_id_; | 
| 480   GLuint client_fragment_shader_id_; | 487   GLuint client_fragment_shader_id_; | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 532  protected: | 539  protected: | 
| 533   virtual void SetUp() OVERRIDE; | 540   virtual void SetUp() OVERRIDE; | 
| 534   virtual void TearDown() OVERRIDE; | 541   virtual void TearDown() OVERRIDE; | 
| 535 | 542 | 
| 536 }; | 543 }; | 
| 537 | 544 | 
| 538 }  // namespace gles2 | 545 }  // namespace gles2 | 
| 539 }  // namespace gpu | 546 }  // namespace gpu | 
| 540 | 547 | 
| 541 #endif  // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 548 #endif  // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 
| OLD | NEW | 
|---|