| Index: trunk/src/gpu/command_buffer/service/program_manager_unittest.cc
|
| ===================================================================
|
| --- trunk/src/gpu/command_buffer/service/program_manager_unittest.cc (revision 278063)
|
| +++ trunk/src/gpu/command_buffer/service/program_manager_unittest.cc (working copy)
|
| @@ -13,13 +13,13 @@
|
| #include "gpu/command_buffer/common/gles2_cmd_utils.h"
|
| #include "gpu/command_buffer/service/common_decoder.h"
|
| #include "gpu/command_buffer/service/feature_info.h"
|
| -#include "gpu/command_buffer/service/gpu_service_test.h"
|
| #include "gpu/command_buffer/service/mocks.h"
|
| #include "gpu/command_buffer/service/shader_manager.h"
|
| #include "gpu/command_buffer/service/test_helper.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/gl/gl_mock.h"
|
|
|
| +using ::gfx::MockGLInterface;
|
| using ::testing::_;
|
| using ::testing::DoAll;
|
| using ::testing::InSequence;
|
| @@ -30,6 +30,7 @@
|
| using ::testing::SetArrayArgument;
|
| using ::testing::SetArgumentPointee;
|
| using ::testing::StrEq;
|
| +using ::testing::StrictMock;
|
|
|
| namespace gpu {
|
| namespace gles2 {
|
| @@ -40,7 +41,7 @@
|
| void ShaderCacheCb(const std::string& key, const std::string& shader) {}
|
| } // namespace anonymous
|
|
|
| -class ProgramManagerTest : public GpuServiceTest {
|
| +class ProgramManagerTest : public testing::Test {
|
| public:
|
| ProgramManagerTest() : manager_(NULL, kMaxVaryingVectors) { }
|
| virtual ~ProgramManagerTest() {
|
| @@ -48,6 +49,18 @@
|
| }
|
|
|
| protected:
|
| + virtual void SetUp() {
|
| + gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
|
| + ::gfx::MockGLInterface::SetGLInterface(gl_.get());
|
| + }
|
| +
|
| + virtual void TearDown() {
|
| + ::gfx::MockGLInterface::SetGLInterface(NULL);
|
| + gl_.reset();
|
| + }
|
| +
|
| + // Use StrictMock to make 100% sure we know how GL will be called.
|
| + scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
|
| ProgramManager manager_;
|
| };
|
|
|
| @@ -125,7 +138,7 @@
|
| EXPECT_TRUE(program1->log_info() == NULL);
|
| }
|
|
|
| -class ProgramManagerWithShaderTest : public GpuServiceTest {
|
| +class ProgramManagerWithShaderTest : public testing::Test {
|
| public:
|
| ProgramManagerWithShaderTest()
|
| : manager_(NULL, kMaxVaryingVectors), program_(NULL) {
|
| @@ -215,7 +228,8 @@
|
| } VarInfo;
|
|
|
| virtual void SetUp() {
|
| - GpuServiceTest::SetUp();
|
| + gl_.reset(new StrictMock<gfx::MockGLInterface>());
|
| + ::gfx::MockGLInterface::SetGLInterface(gl_.get());
|
|
|
| SetupDefaultShaderExpectations();
|
|
|
| @@ -258,6 +272,10 @@
|
| gl_.get(), uniforms, num_uniforms);
|
| }
|
|
|
| + virtual void TearDown() {
|
| + ::gfx::MockGLInterface::SetGLInterface(NULL);
|
| + }
|
| +
|
| // Return true if link status matches expected_link_status
|
| bool LinkAsExpected(Program* program,
|
| bool expected_link_status) {
|
| @@ -380,6 +398,8 @@
|
| static AttribInfo kAttribs[];
|
| static UniformInfo kUniforms[];
|
|
|
| + scoped_ptr<StrictMock<gfx::MockGLInterface> > gl_;
|
| +
|
| ProgramManager manager_;
|
| Program* program_;
|
| ShaderManager shader_manager_;
|
| @@ -1549,7 +1569,7 @@
|
| program->GetUniformFakeLocation(kUniform3GoodName));
|
| }
|
|
|
| -class ProgramManagerWithCacheTest : public GpuServiceTest {
|
| +class ProgramManagerWithCacheTest : public testing::Test {
|
| public:
|
| static const GLuint kClientProgramId = 1;
|
| static const GLuint kServiceProgramId = 10;
|
| @@ -1572,7 +1592,8 @@
|
|
|
| protected:
|
| virtual void SetUp() {
|
| - GpuServiceTest::SetUp();
|
| + gl_.reset(new StrictMock<gfx::MockGLInterface>());
|
| + ::gfx::MockGLInterface::SetGLInterface(gl_.get());
|
|
|
| vertex_shader_ = shader_manager_.CreateShader(
|
| kVertexShaderClientId, kVertexShaderServiceId, GL_VERTEX_SHADER);
|
| @@ -1591,6 +1612,10 @@
|
| program_->AttachShader(&shader_manager_, fragment_shader_);
|
| }
|
|
|
| + virtual void TearDown() {
|
| + ::gfx::MockGLInterface::SetGLInterface(NULL);
|
| + }
|
| +
|
| void SetShadersCompiled() {
|
| vertex_shader_->SetStatus(true, NULL, NULL);
|
| fragment_shader_->SetStatus(true, NULL, NULL);
|
| @@ -1732,6 +1757,8 @@
|
| .Times(1);
|
| }
|
|
|
| + scoped_ptr<StrictMock<gfx::MockGLInterface> > gl_;
|
| +
|
| scoped_ptr<MockProgramCache> cache_;
|
| ProgramManager manager_;
|
|
|
|
|