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/stream_texture_manager_mock.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.h" | 23 #include "ui/gl/gl_context_stub.h" |
25 #include "ui/gl/gl_surface_stub.h" | 24 #include "ui/gl/gl_surface_stub.h" |
26 #include "ui/gl/gl_mock.h" | 25 #include "ui/gl/gl_mock.h" |
27 | 26 |
28 namespace gpu { | 27 namespace gpu { |
29 namespace gles2 { | 28 namespace gles2 { |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // This name doesn't match the underlying function, but doing it this way | 130 // This name doesn't match the underlying function, but doing it this way |
132 // prevents the need to special-case the unit test generation | 131 // prevents the need to special-case the unit test generation |
133 VertexAttribManager* GetVertexArrayInfo(GLuint client_id) { | 132 VertexAttribManager* GetVertexArrayInfo(GLuint client_id) { |
134 return decoder_->GetVertexArrayManager()->GetVertexAttribManager(client_id); | 133 return decoder_->GetVertexArrayManager()->GetVertexAttribManager(client_id); |
135 } | 134 } |
136 | 135 |
137 ProgramManager* program_manager() { | 136 ProgramManager* program_manager() { |
138 return group_->program_manager(); | 137 return group_->program_manager(); |
139 } | 138 } |
140 | 139 |
141 ::testing::StrictMock<MockStreamTextureManager>* | |
142 stream_texture_manager() const { | |
143 return stream_texture_manager_.get(); | |
144 } | |
145 | |
146 void DoCreateProgram(GLuint client_id, GLuint service_id); | 140 void DoCreateProgram(GLuint client_id, GLuint service_id); |
147 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); | 141 void DoCreateShader(GLenum shader_type, GLuint client_id, GLuint service_id); |
148 | 142 |
149 void SetBucketAsCString(uint32 bucket_id, const char* str); | 143 void SetBucketAsCString(uint32 bucket_id, const char* str); |
150 | 144 |
151 void set_memory_tracker(MemoryTracker* memory_tracker) { | 145 void set_memory_tracker(MemoryTracker* memory_tracker) { |
152 memory_tracker_ = memory_tracker; | 146 memory_tracker_ = memory_tracker; |
153 } | 147 } |
154 | 148 |
155 void InitDecoder( | 149 void InitDecoder( |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 522 |
529 private: | 523 private: |
530 scoped_ptr<int8[]> data_; | 524 scoped_ptr<int8[]> data_; |
531 gpu::Buffer valid_buffer_; | 525 gpu::Buffer valid_buffer_; |
532 gpu::Buffer invalid_buffer_; | 526 gpu::Buffer invalid_buffer_; |
533 }; | 527 }; |
534 | 528 |
535 void AddExpectationsForVertexAttribManager(); | 529 void AddExpectationsForVertexAttribManager(); |
536 | 530 |
537 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; | 531 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; |
538 scoped_ptr< ::testing::StrictMock<MockStreamTextureManager> > | |
539 stream_texture_manager_; | |
540 scoped_refptr<ContextGroup> group_; | 532 scoped_refptr<ContextGroup> group_; |
541 }; | 533 }; |
542 | 534 |
543 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { | 535 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { |
544 public: | 536 public: |
545 GLES2DecoderWithShaderTestBase() | 537 GLES2DecoderWithShaderTestBase() |
546 : GLES2DecoderTestBase() { | 538 : GLES2DecoderTestBase() { |
547 } | 539 } |
548 | 540 |
549 protected: | 541 protected: |
550 virtual void SetUp() OVERRIDE; | 542 virtual void SetUp() OVERRIDE; |
551 virtual void TearDown() OVERRIDE; | 543 virtual void TearDown() OVERRIDE; |
552 | 544 |
553 }; | 545 }; |
554 | 546 |
555 } // namespace gles2 | 547 } // namespace gles2 |
556 } // namespace gpu | 548 } // namespace gpu |
557 | 549 |
558 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 550 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
OLD | NEW |