Don't add an aura tooltip to bubble close buttons on Windows.
[chromium-blink-merge.git] / gpu / command_buffer / service / test_helper.h
blob2cf3f96b6abcbe943448d7552c5b5050ff117f3b
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
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_
8 #include <string>
9 #include <vector>
11 #include "gpu/command_buffer/service/shader_translator.h"
12 #include "ui/gl/gl_implementation.h"
13 #include "ui/gl/gl_mock.h"
15 namespace gpu {
16 namespace gles2 {
18 struct DisallowedFeatures;
19 class Buffer;
20 class BufferManager;
21 class MockErrorState;
22 class Shader;
23 class TextureRef;
24 class TextureManager;
26 class TestHelper {
27 public:
28 static const GLuint kServiceBlackTexture2dId = 701;
29 static const GLuint kServiceDefaultTexture2dId = 702;
30 static const GLuint kServiceBlackTextureCubemapId = 703;
31 static const GLuint kServiceDefaultTextureCubemapId = 704;
32 static const GLuint kServiceBlackExternalTextureId = 705;
33 static const GLuint kServiceDefaultExternalTextureId = 706;
34 static const GLuint kServiceBlackRectangleTextureId = 707;
35 static const GLuint kServiceDefaultRectangleTextureId = 708;
37 static const GLint kMaxSamples = 4;
38 static const GLint kMaxRenderbufferSize = 1024;
39 static const GLint kMaxTextureSize = 2048;
40 static const GLint kMaxCubeMapTextureSize = 256;
41 static const GLint kMaxRectangleTextureSize = 64;
42 static const GLint kNumVertexAttribs = 16;
43 static const GLint kNumTextureUnits = 8;
44 static const GLint kMaxTextureImageUnits = 8;
45 static const GLint kMaxVertexTextureImageUnits = 2;
46 static const GLint kMaxFragmentUniformVectors = 16;
47 static const GLint kMaxFragmentUniformComponents =
48 kMaxFragmentUniformVectors * 4;
49 static const GLint kMaxVaryingVectors = 8;
50 static const GLint kMaxVaryingFloats = kMaxVaryingVectors * 4;
51 static const GLint kMaxVertexUniformVectors = 128;
52 static const GLint kMaxVertexUniformComponents = kMaxVertexUniformVectors * 4;
54 struct AttribInfo {
55 const char* name;
56 GLint size;
57 GLenum type;
58 GLint location;
61 struct UniformInfo {
62 const char* name;
63 GLint size;
64 GLenum type;
65 GLint fake_location;
66 GLint real_location;
67 GLint desired_location;
68 const char* good_name;
71 static void SetupContextGroupInitExpectations(
72 ::gfx::MockGLInterface* gl,
73 const DisallowedFeatures& disallowed_features,
74 const char* extensions,
75 const char* gl_version,
76 bool bind_generates_resource);
77 static void SetupFeatureInfoInitExpectations(
78 ::gfx::MockGLInterface* gl, const char* extensions);
79 static void SetupFeatureInfoInitExpectationsWithGLVersion(
80 ::gfx::MockGLInterface* gl,
81 const char* extensions,
82 const char* gl_renderer,
83 const char* gl_version);
84 static void SetupTextureManagerInitExpectations(::gfx::MockGLInterface* gl,
85 const char* extensions,
86 bool use_default_textures);
87 static void SetupTextureManagerDestructionExpectations(
88 ::gfx::MockGLInterface* gl,
89 const char* extensions,
90 bool use_default_textures);
92 static void SetupExpectationsForClearingUniforms(
93 ::gfx::MockGLInterface* gl, UniformInfo* uniforms, size_t num_uniforms);
95 static void SetupShader(
96 ::gfx::MockGLInterface* gl,
97 AttribInfo* attribs, size_t num_attribs,
98 UniformInfo* uniforms, size_t num_uniforms,
99 GLuint service_id);
101 static void SetupProgramSuccessExpectations(::gfx::MockGLInterface* gl,
102 AttribInfo* attribs, size_t num_attribs,
103 UniformInfo* uniforms, size_t num_uniforms,
104 GLuint service_id);
106 static void DoBufferData(
107 ::gfx::MockGLInterface* gl, MockErrorState* error_state,
108 BufferManager* manager, Buffer* buffer, GLsizeiptr size, GLenum usage,
109 const GLvoid* data, GLenum error);
111 static void SetTexParameteriWithExpectations(
112 ::gfx::MockGLInterface* gl, MockErrorState* error_state,
113 TextureManager* manager, TextureRef* texture_ref,
114 GLenum pname, GLint value, GLenum error);
116 static void SetShaderStates(
117 ::gfx::MockGLInterface* gl, Shader* shader,
118 bool expected_valid,
119 const std::string* const expected_log_info,
120 const std::string* const expected_translated_source,
121 const AttributeMap* const expected_attrib_map,
122 const UniformMap* const expected_uniform_map,
123 const VaryingMap* const expected_varying_map,
124 const NameMap* const expected_name_map);
126 static void SetShaderStates(
127 ::gfx::MockGLInterface* gl, Shader* shader, bool valid);
129 static sh::Attribute ConstructAttribute(
130 GLenum type, GLint array_size, GLenum precision,
131 bool static_use, const std::string& name);
132 static sh::Uniform ConstructUniform(
133 GLenum type, GLint array_size, GLenum precision,
134 bool static_use, const std::string& name);
135 static sh::Varying ConstructVarying(
136 GLenum type, GLint array_size, GLenum precision,
137 bool static_use, const std::string& name);
139 private:
140 static void SetupTextureInitializationExpectations(::gfx::MockGLInterface* gl,
141 GLenum target,
142 bool use_default_textures);
143 static void SetupTextureDestructionExpectations(::gfx::MockGLInterface* gl,
144 GLenum target,
145 bool use_default_textures);
147 static std::vector<std::string> split_extensions_;
150 // This object temporaritly Sets what gfx::GetGLImplementation returns. During
151 // testing the GLImplementation is set to kGLImplemenationMockGL but lots of
152 // code branches based on what gfx::GetGLImplementation returns.
153 class ScopedGLImplementationSetter {
154 public:
155 explicit ScopedGLImplementationSetter(gfx::GLImplementation implementation);
156 ~ScopedGLImplementationSetter();
158 private:
159 gfx::GLImplementation old_implementation_;
162 } // namespace gles2
163 } // namespace gpu
165 #endif // GPU_COMMAND_BUFFER_SERVICE_TEST_HELPER_H_