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/gl_mock.h" | 8 #include "gpu/command_buffer/common/gl_mock.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
11 #include "gpu/command_buffer/service/buffer_manager.h" | 11 #include "gpu/command_buffer/service/buffer_manager.h" |
12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 12 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
13 #include "gpu/command_buffer/service/context_group.h" | 13 #include "gpu/command_buffer/service/context_group.h" |
14 #include "gpu/command_buffer/service/framebuffer_manager.h" | 14 #include "gpu/command_buffer/service/framebuffer_manager.h" |
15 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 15 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
16 #include "gpu/command_buffer/service/program_manager.h" | 16 #include "gpu/command_buffer/service/program_manager.h" |
17 #include "gpu/command_buffer/service/query_manager.h" | 17 #include "gpu/command_buffer/service/query_manager.h" |
18 #include "gpu/command_buffer/service/renderbuffer_manager.h" | 18 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
19 #include "gpu/command_buffer/service/shader_manager.h" | 19 #include "gpu/command_buffer/service/shader_manager.h" |
| 20 #include "gpu/command_buffer/service/test_helper.h" |
20 #include "gpu/command_buffer/service/texture_manager.h" | 21 #include "gpu/command_buffer/service/texture_manager.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "ui/gfx/gl/gl_context_stub.h" | 23 #include "ui/gfx/gl/gl_context_stub.h" |
23 #include "ui/gfx/gl/gl_surface_stub.h" | 24 #include "ui/gfx/gl/gl_surface_stub.h" |
24 | 25 |
25 namespace gpu { | 26 namespace gpu { |
26 namespace gles2 { | 27 namespace gles2 { |
27 | 28 |
28 class GLES2DecoderTestBase : public testing::Test { | 29 class GLES2DecoderTestBase : public testing::Test { |
29 public: | 30 public: |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 148 } |
148 | 149 |
149 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { | 150 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { |
150 return gl_.get(); | 151 return gl_.get(); |
151 } | 152 } |
152 | 153 |
153 GLES2Decoder* GetDecoder() const { | 154 GLES2Decoder* GetDecoder() const { |
154 return decoder_.get(); | 155 return decoder_.get(); |
155 } | 156 } |
156 | 157 |
157 struct AttribInfo { | 158 typedef TestHelper::AttribInfo AttribInfo; |
158 const char* name; | 159 typedef TestHelper::UniformInfo UniformInfo; |
159 GLint size; | |
160 GLenum type; | |
161 GLint location; | |
162 }; | |
163 | |
164 struct UniformInfo { | |
165 const char* name; | |
166 GLint size; | |
167 GLenum type; | |
168 GLint fake_location; | |
169 GLint real_location; | |
170 }; | |
171 | 160 |
172 void SetupShader( | 161 void SetupShader( |
173 AttribInfo* attribs, size_t num_attribs, | 162 AttribInfo* attribs, size_t num_attribs, |
174 UniformInfo* uniforms, size_t num_uniforms, | 163 UniformInfo* uniforms, size_t num_uniforms, |
175 GLuint client_id, GLuint service_id, | 164 GLuint client_id, GLuint service_id, |
176 GLuint vertex_shader_client_id, GLuint vertex_shader_service_id, | 165 GLuint vertex_shader_client_id, GLuint vertex_shader_service_id, |
177 GLuint fragment_shader_client_id, GLuint fragment_shader_service_id); | 166 GLuint fragment_shader_client_id, GLuint fragment_shader_service_id); |
178 | 167 |
179 void SetupExpectationsForClearingUniforms( | 168 void SetupExpectationsForClearingUniforms( |
180 UniformInfo* uniforms, size_t num_uniforms); | 169 UniformInfo* uniforms, size_t num_uniforms) { |
| 170 TestHelper::SetupExpectationsForClearingUniforms( |
| 171 gl_.get(), uniforms, num_uniforms); |
| 172 } |
181 | 173 |
182 // Setups up a shader for testing glUniform. | 174 // Setups up a shader for testing glUniform. |
183 void SetupShaderForUniform(); | 175 void SetupShaderForUniform(); |
184 void SetupDefaultProgram(); | 176 void SetupDefaultProgram(); |
185 void SetupCubemapProgram(); | 177 void SetupCubemapProgram(); |
186 void SetupTexture(); | 178 void SetupTexture(); |
187 | 179 |
188 // Note that the error is returned as GLint instead of GLenum. | 180 // Note that the error is returned as GLint instead of GLenum. |
189 // This is because there is a mismatch in the types of GLenum and | 181 // This is because there is a mismatch in the types of GLenum and |
190 // the error values GL_NO_ERROR, GL_INVALID_ENUM, etc. GLenum is | 182 // the error values GL_NO_ERROR, GL_INVALID_ENUM, etc. GLenum is |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 protected: | 516 protected: |
525 virtual void SetUp() OVERRIDE; | 517 virtual void SetUp() OVERRIDE; |
526 virtual void TearDown() OVERRIDE; | 518 virtual void TearDown() OVERRIDE; |
527 | 519 |
528 }; | 520 }; |
529 | 521 |
530 } // namespace gles2 | 522 } // namespace gles2 |
531 } // namespace gpu | 523 } // namespace gpu |
532 | 524 |
533 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 525 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
OLD | NEW |