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/gles2_cmd_decoder_mock.h" | |
16 #include "gpu/command_buffer/service/program_manager.h" | 15 #include "gpu/command_buffer/service/program_manager.h" |
17 #include "gpu/command_buffer/service/query_manager.h" | 16 #include "gpu/command_buffer/service/query_manager.h" |
18 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 17 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
19 #include "gpu/command_buffer/service/shader_manager.h" | 18 #include "gpu/command_buffer/service/shader_manager.h" |
20 #include "gpu/command_buffer/service/test_helper.h" | 19 #include "gpu/command_buffer/service/test_helper.h" |
21 #include "gpu/command_buffer/service/texture_manager.h" | 20 #include "gpu/command_buffer/service/texture_manager.h" |
22 #include "gpu/command_buffer/service/vertex_array_manager.h" | 21 #include "gpu/command_buffer/service/vertex_array_manager.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "ui/gl/gl_context_stub_with_extensions.h" | 23 #include "ui/gl/gl_context_stub_with_extensions.h" |
25 #include "ui/gl/gl_surface_stub.h" | 24 #include "ui/gl/gl_surface_stub.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 143 |
145 void DoCreateProgram(GLuint client_id, GLuint service_id); | 144 void DoCreateProgram(GLuint client_id, GLuint service_id); |
146 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); | 145 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); |
147 | 146 |
148 void SetBucketAsCString(uint32 bucket_id, const char* str); | 147 void SetBucketAsCString(uint32 bucket_id, const char* str); |
149 | 148 |
150 void set_memory_tracker(MemoryTracker* memory_tracker) { | 149 void set_memory_tracker(MemoryTracker* memory_tracker) { |
151 memory_tracker_ = memory_tracker; | 150 memory_tracker_ = memory_tracker; |
152 } | 151 } |
153 | 152 |
154 struct InitState { | 153 void InitDecoder( |
155 InitState(); | 154 const char* extensions, |
| 155 const char* gl_version, |
| 156 bool has_alpha, |
| 157 bool has_depth, |
| 158 bool has_stencil, |
| 159 bool request_alpha, |
| 160 bool request_depth, |
| 161 bool request_stencil, |
| 162 bool bind_generates_resource); |
156 | 163 |
157 std::string extensions; | 164 void InitDecoderWithCommandLine( |
158 std::string gl_version; | 165 const char* extensions, |
159 bool has_alpha; | 166 const char* gl_version, |
160 bool has_depth; | 167 bool has_alpha, |
161 bool has_stencil; | 168 bool has_depth, |
162 bool request_alpha; | 169 bool has_stencil, |
163 bool request_depth; | 170 bool request_alpha, |
164 bool request_stencil; | 171 bool request_depth, |
165 bool bind_generates_resource; | 172 bool request_stencil, |
166 bool lose_context_when_out_of_memory; | 173 bool bind_generates_resource, |
167 }; | 174 const base::CommandLine* command_line); |
168 | |
169 void InitDecoder(const InitState& init); | |
170 void InitDecoderWithCommandLine(const InitState& init, | |
171 const base::CommandLine* command_line); | |
172 | 175 |
173 void ResetDecoder(); | 176 void ResetDecoder(); |
174 | 177 |
175 const ContextGroup& group() const { | 178 const ContextGroup& group() const { |
176 return *group_.get(); | 179 return *group_.get(); |
177 } | 180 } |
178 | 181 |
179 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { | 182 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { |
180 return gl_.get(); | 183 return gl_.get(); |
181 } | 184 } |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 static const GLenum kUniform3Type = GL_FLOAT_VEC3; | 482 static const GLenum kUniform3Type = GL_FLOAT_VEC3; |
480 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES; | 483 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES; |
481 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; | 484 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; |
482 static const GLint kInvalidUniformLocation = 30; | 485 static const GLint kInvalidUniformLocation = 30; |
483 static const GLint kBadUniformIndex = 1000; | 486 static const GLint kBadUniformIndex = 1000; |
484 | 487 |
485 // Use StrictMock to make 100% sure we know how GL will be called. | 488 // Use StrictMock to make 100% sure we know how GL will be called. |
486 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 489 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; |
487 scoped_refptr<gfx::GLSurfaceStub> surface_; | 490 scoped_refptr<gfx::GLSurfaceStub> surface_; |
488 scoped_refptr<gfx::GLContextStubWithExtensions> context_; | 491 scoped_refptr<gfx::GLContextStubWithExtensions> context_; |
489 scoped_ptr<MockGLES2Decoder> mock_decoder_; | 492 scoped_ptr<GLES2Decoder> mock_decoder_; |
490 scoped_ptr<GLES2Decoder> decoder_; | 493 scoped_ptr<GLES2Decoder> decoder_; |
491 MemoryTracker* memory_tracker_; | 494 MemoryTracker* memory_tracker_; |
492 | 495 |
493 GLuint client_buffer_id_; | 496 GLuint client_buffer_id_; |
494 GLuint client_framebuffer_id_; | 497 GLuint client_framebuffer_id_; |
495 GLuint client_program_id_; | 498 GLuint client_program_id_; |
496 GLuint client_renderbuffer_id_; | 499 GLuint client_renderbuffer_id_; |
497 GLuint client_shader_id_; | 500 GLuint client_shader_id_; |
498 GLuint client_texture_id_; | 501 GLuint client_texture_id_; |
499 GLuint client_element_buffer_id_; | 502 GLuint client_element_buffer_id_; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 protected: | 556 protected: |
554 virtual void SetUp() OVERRIDE; | 557 virtual void SetUp() OVERRIDE; |
555 virtual void TearDown() OVERRIDE; | 558 virtual void TearDown() OVERRIDE; |
556 | 559 |
557 }; | 560 }; |
558 | 561 |
559 } // namespace gles2 | 562 } // namespace gles2 |
560 } // namespace gpu | 563 } // namespace gpu |
561 | 564 |
562 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 565 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
OLD | NEW |