| 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 #include "gpu/command_buffer/service/test_helper.h" | 5 #include "gpu/command_buffer/service/test_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 .RetiresOnSaturation(); | 271 .RetiresOnSaturation(); |
| 272 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, _)) | 272 EXPECT_CALL(*gl, GetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, _)) |
| 273 .WillOnce(SetArgumentPointee<1>(kMaxVertexUniformComponents)) | 273 .WillOnce(SetArgumentPointee<1>(kMaxVertexUniformComponents)) |
| 274 .RetiresOnSaturation(); | 274 .RetiresOnSaturation(); |
| 275 | 275 |
| 276 SetupTextureManagerInitExpectations(gl, extensions); | 276 SetupTextureManagerInitExpectations(gl, extensions); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void TestHelper::SetupFeatureInfoInitExpectations( | 279 void TestHelper::SetupFeatureInfoInitExpectations( |
| 280 ::gfx::MockGLInterface* gl, const char* extensions) { | 280 ::gfx::MockGLInterface* gl, const char* extensions) { |
| 281 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, ""); | 281 SetupFeatureInfoInitExpectationsWithGLVersion(gl, extensions, "", ""); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( | 284 void TestHelper::SetupFeatureInfoInitExpectationsWithGLVersion( |
| 285 ::gfx::MockGLInterface* gl, | 285 ::gfx::MockGLInterface* gl, |
| 286 const char* extensions, | 286 const char* extensions, |
| 287 const char* version) { | 287 const char* gl_renderer, |
| 288 const char* gl_version) { |
| 288 InSequence sequence; | 289 InSequence sequence; |
| 289 | 290 |
| 290 EXPECT_CALL(*gl, GetString(GL_EXTENSIONS)) | 291 EXPECT_CALL(*gl, GetString(GL_EXTENSIONS)) |
| 291 .WillOnce(Return(reinterpret_cast<const uint8*>(extensions))) | 292 .WillOnce(Return(reinterpret_cast<const uint8*>(extensions))) |
| 292 .RetiresOnSaturation(); | 293 .RetiresOnSaturation(); |
| 294 EXPECT_CALL(*gl, GetString(GL_RENDERER)) |
| 295 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_renderer))) |
| 296 .RetiresOnSaturation(); |
| 293 EXPECT_CALL(*gl, GetString(GL_VERSION)) | 297 EXPECT_CALL(*gl, GetString(GL_VERSION)) |
| 294 .WillOnce(Return(reinterpret_cast<const uint8*>(version))) | 298 .WillOnce(Return(reinterpret_cast<const uint8*>(gl_version))) |
| 295 .RetiresOnSaturation(); | 299 .RetiresOnSaturation(); |
| 296 } | 300 } |
| 297 | 301 |
| 298 void TestHelper::SetupExpectationsForClearingUniforms( | 302 void TestHelper::SetupExpectationsForClearingUniforms( |
| 299 ::gfx::MockGLInterface* gl, UniformInfo* uniforms, size_t num_uniforms) { | 303 ::gfx::MockGLInterface* gl, UniformInfo* uniforms, size_t num_uniforms) { |
| 300 for (size_t ii = 0; ii < num_uniforms; ++ii) { | 304 for (size_t ii = 0; ii < num_uniforms; ++ii) { |
| 301 const UniformInfo& info = uniforms[ii]; | 305 const UniformInfo& info = uniforms[ii]; |
| 302 switch (info.type) { | 306 switch (info.type) { |
| 303 case GL_FLOAT: | 307 case GL_FLOAT: |
| 304 EXPECT_CALL(*gl, Uniform1fv(info.real_location, info.size, _)) | 308 EXPECT_CALL(*gl, Uniform1fv(info.real_location, info.size, _)) |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 gfx::SetGLImplementation(implementation); | 553 gfx::SetGLImplementation(implementation); |
| 550 } | 554 } |
| 551 | 555 |
| 552 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { | 556 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { |
| 553 gfx::SetGLImplementation(old_implementation_); | 557 gfx::SetGLImplementation(old_implementation_); |
| 554 } | 558 } |
| 555 | 559 |
| 556 } // namespace gles2 | 560 } // namespace gles2 |
| 557 } // namespace gpu | 561 } // namespace gpu |
| 558 | 562 |
| OLD | NEW |