Chromium Code Reviews| Index: gpu/command_buffer/service/test_helper.cc |
| diff --git a/gpu/command_buffer/service/test_helper.cc b/gpu/command_buffer/service/test_helper.cc |
| index 3de75d5a223ef0c8b43f7b2f5d9ef8e75ced20ca..10b5622381353a1ece07fd02fa5bca494e84c296 100644 |
| --- a/gpu/command_buffer/service/test_helper.cc |
| +++ b/gpu/command_buffer/service/test_helper.cc |
| @@ -4,11 +4,15 @@ |
| #include "gpu/command_buffer/service/test_helper.h" |
| +#include "base/string_tokenizer.h" |
| #include "gpu/command_buffer/common/gl_mock.h" |
| #include "gpu/command_buffer/common/types.h" |
| +#include "gpu/command_buffer/service/gl_utils.h" |
| #include "gpu/GLES2/gles2_command_buffer.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| +#include <string.h> |
| + |
| using ::testing::_; |
| using ::testing::DoAll; |
| using ::testing::InSequence; |
| @@ -29,6 +33,8 @@ const GLuint TestHelper::kServiceBlackTexture2dId; |
| const GLuint TestHelper::kServiceBlackTextureCubemapId; |
| const GLuint TestHelper::kServiceDefaultTexture2dId; |
| const GLuint TestHelper::kServiceDefaultTextureCubemapId; |
| +const GLuint TestHelper::kServiceDefaultExternalTextureId; |
| +const GLuint TestHelper::kServiceBlackExternalTextureId; |
| const GLint TestHelper::kMaxRenderbufferSize; |
| const GLint TestHelper::kMaxTextureSize; |
| @@ -46,7 +52,8 @@ const GLint TestHelper::kMaxVertexUniformComponents; |
| #endif |
| void TestHelper::SetupTextureManagerInitExpectations( |
| - ::gfx::MockGLInterface* gl) { |
| + ::gfx::MockGLInterface* gl, |
| + const char* extensions) { |
|
greggman
2011/07/20 01:41:18
Would it be possible to pass in a FeatureInfo here
no sievers
2011/07/20 23:00:37
Is it ok to interleave the expectation setup and G
greggman
2011/07/21 07:49:32
I think I see your point. I guess leave it the way
|
| static GLuint texture_ids[] = { |
| kServiceBlackTexture2dId, |
| kServiceDefaultTexture2dId, |
| @@ -89,6 +96,30 @@ void TestHelper::SetupTextureManagerInitExpectations( |
| EXPECT_CALL(*gl, BindTexture(GL_TEXTURE_CUBE_MAP, 0)) |
| .Times(1) |
| .RetiresOnSaturation(); |
| + |
| + bool ext_image_external = false; |
| + CStringTokenizer t(extensions, extensions + strlen(extensions), " "); |
| + while (t.GetNext()) { |
| + if (t.token() == "GL_OES_EGL_image_external") { |
| + ext_image_external = true; |
| + break; |
| + } |
| + } |
| + |
| + if (ext_image_external) { |
| + static GLuint external_texture_ids[] = { |
| + kServiceDefaultExternalTextureId, |
| + kServiceBlackExternalTextureId, |
| + }; |
| + EXPECT_CALL(*gl, GenTextures(arraysize(external_texture_ids), _)) |
| + .WillOnce(SetArrayArgument<1>( |
| + external_texture_ids, |
| + external_texture_ids + arraysize(texture_ids))) |
| + .RetiresOnSaturation(); |
| + EXPECT_CALL(*gl, BindTexture(GL_TEXTURE_EXTERNAL_OES, 0)) |
| + .Times(1) |
| + .RetiresOnSaturation(); |
| + } |
| } |
| void TestHelper::SetupContextGroupInitExpectations( |
| @@ -131,7 +162,7 @@ void TestHelper::SetupContextGroupInitExpectations( |
| .WillOnce(SetArgumentPointee<1>(kMaxVertexUniformComponents)) |
| .RetiresOnSaturation(); |
| - SetupTextureManagerInitExpectations(gl); |
| + SetupTextureManagerInitExpectations(gl, extensions); |
| } |
| void TestHelper::SetupFeatureInfoInitExpectations( |