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/gl_context_mock.h" |
14 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 15 #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/gles2_cmd_decoder_mock.h" |
16 #include "gpu/command_buffer/service/program_manager.h" | 17 #include "gpu/command_buffer/service/program_manager.h" |
17 #include "gpu/command_buffer/service/query_manager.h" | 18 #include "gpu/command_buffer/service/query_manager.h" |
18 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 19 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
19 #include "gpu/command_buffer/service/shader_manager.h" | 20 #include "gpu/command_buffer/service/shader_manager.h" |
20 #include "gpu/command_buffer/service/test_helper.h" | 21 #include "gpu/command_buffer/service/test_helper.h" |
21 #include "gpu/command_buffer/service/texture_manager.h" | 22 #include "gpu/command_buffer/service/texture_manager.h" |
22 #include "gpu/command_buffer/service/valuebuffer_manager.h" | 23 #include "gpu/command_buffer/service/valuebuffer_manager.h" |
23 #include "gpu/command_buffer/service/vertex_array_manager.h" | 24 #include "gpu/command_buffer/service/vertex_array_manager.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "ui/gl/gl_context_stub_with_extensions.h" | |
26 #include "ui/gl/gl_surface_stub.h" | 26 #include "ui/gl/gl_surface_stub.h" |
27 #include "ui/gl/gl_mock.h" | 27 #include "ui/gl/gl_mock.h" |
28 | 28 |
29 namespace base { | 29 namespace base { |
30 class CommandLine; | 30 class CommandLine; |
31 } | 31 } |
32 | 32 |
33 namespace gpu { | 33 namespace gpu { |
34 namespace gles2 { | 34 namespace gles2 { |
35 | 35 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void InitDecoder(const InitState& init); | 204 void InitDecoder(const InitState& init); |
205 void InitDecoderWithCommandLine(const InitState& init, | 205 void InitDecoderWithCommandLine(const InitState& init, |
206 const base::CommandLine* command_line); | 206 const base::CommandLine* command_line); |
207 | 207 |
208 void ResetDecoder(); | 208 void ResetDecoder(); |
209 | 209 |
210 const ContextGroup& group() const { | 210 const ContextGroup& group() const { |
211 return *group_.get(); | 211 return *group_.get(); |
212 } | 212 } |
213 | 213 |
| 214 void LoseContexts(error::ContextLostReason reason) const { |
| 215 group_->LoseContexts(reason); |
| 216 } |
| 217 |
214 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { | 218 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { |
215 return gl_.get(); | 219 return gl_.get(); |
216 } | 220 } |
217 | 221 |
218 GLES2Decoder* GetDecoder() const { | 222 GLES2Decoder* GetDecoder() const { |
219 return decoder_.get(); | 223 return decoder_.get(); |
220 } | 224 } |
221 | 225 |
222 typedef TestHelper::AttribInfo AttribInfo; | 226 typedef TestHelper::AttribInfo AttribInfo; |
223 typedef TestHelper::UniformInfo UniformInfo; | 227 typedef TestHelper::UniformInfo UniformInfo; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 static const GLenum kUniform2Type = GL_INT_VEC2; | 537 static const GLenum kUniform2Type = GL_INT_VEC2; |
534 static const GLenum kUniform3Type = GL_FLOAT_VEC3; | 538 static const GLenum kUniform3Type = GL_FLOAT_VEC3; |
535 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES; | 539 static const GLenum kUniformSamplerExternalType = GL_SAMPLER_EXTERNAL_OES; |
536 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; | 540 static const GLenum kUniformCubemapType = GL_SAMPLER_CUBE; |
537 static const GLint kInvalidUniformLocation = 30; | 541 static const GLint kInvalidUniformLocation = 30; |
538 static const GLint kBadUniformIndex = 1000; | 542 static const GLint kBadUniformIndex = 1000; |
539 | 543 |
540 // Use StrictMock to make 100% sure we know how GL will be called. | 544 // Use StrictMock to make 100% sure we know how GL will be called. |
541 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 545 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; |
542 scoped_refptr<gfx::GLSurfaceStub> surface_; | 546 scoped_refptr<gfx::GLSurfaceStub> surface_; |
543 scoped_refptr<gfx::GLContextStubWithExtensions> context_; | 547 scoped_refptr<GLContextMock> context_; |
544 scoped_ptr<MockGLES2Decoder> mock_decoder_; | 548 scoped_ptr<MockGLES2Decoder> mock_decoder_; |
545 scoped_ptr<GLES2Decoder> decoder_; | 549 scoped_ptr<GLES2Decoder> decoder_; |
546 MemoryTracker* memory_tracker_; | 550 MemoryTracker* memory_tracker_; |
547 | 551 |
548 GLuint client_buffer_id_; | 552 GLuint client_buffer_id_; |
549 GLuint client_framebuffer_id_; | 553 GLuint client_framebuffer_id_; |
550 GLuint client_program_id_; | 554 GLuint client_program_id_; |
551 GLuint client_renderbuffer_id_; | 555 GLuint client_renderbuffer_id_; |
552 GLuint client_sampler_id_; | 556 GLuint client_sampler_id_; |
553 GLuint client_shader_id_; | 557 GLuint client_shader_id_; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 }; | 682 }; |
679 | 683 |
680 // SpecializedSetup specializations that are needed in multiple unittest files. | 684 // SpecializedSetup specializations that are needed in multiple unittest files. |
681 template <> | 685 template <> |
682 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid); | 686 void GLES2DecoderTestBase::SpecializedSetup<cmds::LinkProgram, 0>(bool valid); |
683 | 687 |
684 } // namespace gles2 | 688 } // namespace gles2 |
685 } // namespace gpu | 689 } // namespace gpu |
686 | 690 |
687 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 691 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
OLD | NEW |