| 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_TEST_HELPER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include "gpu/command_buffer/service/shader_translator.h" |
| 8 #include "ui/gl/gl_implementation.h" | 9 #include "ui/gl/gl_implementation.h" |
| 9 #include "ui/gl/gl_mock.h" | 10 #include "ui/gl/gl_mock.h" |
| 10 | 11 |
| 11 namespace gpu { | 12 namespace gpu { |
| 12 namespace gles2 { | 13 namespace gles2 { |
| 13 | 14 |
| 14 struct DisallowedFeatures; | 15 struct DisallowedFeatures; |
| 15 class Buffer; | 16 class Buffer; |
| 16 class BufferManager; | 17 class BufferManager; |
| 17 class MockErrorState; | 18 class MockErrorState; |
| 19 class Shader; |
| 18 class TextureRef; | 20 class TextureRef; |
| 19 class TextureManager; | 21 class TextureManager; |
| 20 | 22 |
| 21 class TestHelper { | 23 class TestHelper { |
| 22 public: | 24 public: |
| 23 static const GLuint kServiceBlackTexture2dId = 701; | 25 static const GLuint kServiceBlackTexture2dId = 701; |
| 24 static const GLuint kServiceDefaultTexture2dId = 702; | 26 static const GLuint kServiceDefaultTexture2dId = 702; |
| 25 static const GLuint kServiceBlackTextureCubemapId = 703; | 27 static const GLuint kServiceBlackTextureCubemapId = 703; |
| 26 static const GLuint kServiceDefaultTextureCubemapId = 704; | 28 static const GLuint kServiceDefaultTextureCubemapId = 704; |
| 27 static const GLuint kServiceBlackExternalTextureId = 705; | 29 static const GLuint kServiceBlackExternalTextureId = 705; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 static void DoBufferData( | 102 static void DoBufferData( |
| 101 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 103 ::gfx::MockGLInterface* gl, MockErrorState* error_state, |
| 102 BufferManager* manager, Buffer* buffer, GLsizeiptr size, GLenum usage, | 104 BufferManager* manager, Buffer* buffer, GLsizeiptr size, GLenum usage, |
| 103 const GLvoid* data, GLenum error); | 105 const GLvoid* data, GLenum error); |
| 104 | 106 |
| 105 static void SetTexParameteriWithExpectations( | 107 static void SetTexParameteriWithExpectations( |
| 106 ::gfx::MockGLInterface* gl, MockErrorState* error_state, | 108 ::gfx::MockGLInterface* gl, MockErrorState* error_state, |
| 107 TextureManager* manager, TextureRef* texture_ref, | 109 TextureManager* manager, TextureRef* texture_ref, |
| 108 GLenum pname, GLint value, GLenum error); | 110 GLenum pname, GLint value, GLenum error); |
| 109 | 111 |
| 112 static void SetShaderStates( |
| 113 ::gfx::MockGLInterface* gl, Shader* shader, |
| 114 bool expected_valid, |
| 115 const std::string* const expected_log_info, |
| 116 const std::string* const expected_translated_source, |
| 117 const ShaderTranslatorInterface::VariableMap* const expected_attrib_map, |
| 118 const ShaderTranslatorInterface::VariableMap* const expected_uniform_map, |
| 119 const ShaderTranslatorInterface::VariableMap* const expected_varying_map, |
| 120 const ShaderTranslatorInterface::NameMap* const expected_name_map); |
| 121 |
| 122 static void SetShaderStates( |
| 123 ::gfx::MockGLInterface* gl, Shader* shader, bool valid); |
| 124 |
| 110 private: | 125 private: |
| 111 static void SetupTextureInitializationExpectations(::gfx::MockGLInterface* gl, | 126 static void SetupTextureInitializationExpectations(::gfx::MockGLInterface* gl, |
| 112 GLenum target, | 127 GLenum target, |
| 113 bool use_default_textures); | 128 bool use_default_textures); |
| 114 static void SetupTextureDestructionExpectations(::gfx::MockGLInterface* gl, | 129 static void SetupTextureDestructionExpectations(::gfx::MockGLInterface* gl, |
| 115 GLenum target, | 130 GLenum target, |
| 116 bool use_default_textures); | 131 bool use_default_textures); |
| 117 }; | 132 }; |
| 118 | 133 |
| 119 // This object temporaritly Sets what gfx::GetGLImplementation returns. During | 134 // This object temporaritly Sets what gfx::GetGLImplementation returns. During |
| 120 // testing the GLImplementation is set to kGLImplemenationMockGL but lots of | 135 // testing the GLImplementation is set to kGLImplemenationMockGL but lots of |
| 121 // code branches based on what gfx::GetGLImplementation returns. | 136 // code branches based on what gfx::GetGLImplementation returns. |
| 122 class ScopedGLImplementationSetter { | 137 class ScopedGLImplementationSetter { |
| 123 public: | 138 public: |
| 124 explicit ScopedGLImplementationSetter(gfx::GLImplementation implementation); | 139 explicit ScopedGLImplementationSetter(gfx::GLImplementation implementation); |
| 125 ~ScopedGLImplementationSetter(); | 140 ~ScopedGLImplementationSetter(); |
| 126 | 141 |
| 127 private: | 142 private: |
| 128 gfx::GLImplementation old_implementation_; | 143 gfx::GLImplementation old_implementation_; |
| 129 }; | 144 }; |
| 130 | 145 |
| 131 } // namespace gles2 | 146 } // namespace gles2 |
| 132 } // namespace gpu | 147 } // namespace gpu |
| 133 | 148 |
| 134 #endif // GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ | 149 #endif // GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_ |
| 135 | 150 |
| OLD | NEW |