Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: gpu/command_buffer/service/program_manager_unittest.cc

Issue 332303002: gpu: Add base class for gpu service tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update gpu/build.GN Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/program_manager_unittest.cc
diff --git a/gpu/command_buffer/service/program_manager_unittest.cc b/gpu/command_buffer/service/program_manager_unittest.cc
index 686916aa5f36799399652284960c07fa349b4027..326486108b10bc773883587fd815ae40673617d4 100644
--- a/gpu/command_buffer/service/program_manager_unittest.cc
+++ b/gpu/command_buffer/service/program_manager_unittest.cc
@@ -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,7 +30,6 @@ using ::testing::ReturnRef;
using ::testing::SetArrayArgument;
using ::testing::SetArgumentPointee;
using ::testing::StrEq;
-using ::testing::StrictMock;
namespace gpu {
namespace gles2 {
@@ -41,7 +40,7 @@ const uint32 kMaxVaryingVectors = 8;
void ShaderCacheCb(const std::string& key, const std::string& shader) {}
} // namespace anonymous
-class ProgramManagerTest : public testing::Test {
+class ProgramManagerTest : public GpuServiceTest {
public:
ProgramManagerTest() : manager_(NULL, kMaxVaryingVectors) { }
virtual ~ProgramManagerTest() {
@@ -49,18 +48,6 @@ class ProgramManagerTest : public testing::Test {
}
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_;
};
@@ -138,7 +125,7 @@ TEST_F(ProgramManagerTest, Program) {
EXPECT_TRUE(program1->log_info() == NULL);
}
-class ProgramManagerWithShaderTest : public testing::Test {
+class ProgramManagerWithShaderTest : public GpuServiceTest {
public:
ProgramManagerWithShaderTest()
: manager_(NULL, kMaxVaryingVectors), program_(NULL) {
@@ -228,8 +215,7 @@ class ProgramManagerWithShaderTest : public testing::Test {
} VarInfo;
virtual void SetUp() {
- gl_.reset(new StrictMock<gfx::MockGLInterface>());
- ::gfx::MockGLInterface::SetGLInterface(gl_.get());
+ GpuServiceTest::SetUp();
SetupDefaultShaderExpectations();
@@ -272,10 +258,6 @@ class ProgramManagerWithShaderTest : public testing::Test {
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) {
@@ -398,8 +380,6 @@ class ProgramManagerWithShaderTest : public testing::Test {
static AttribInfo kAttribs[];
static UniformInfo kUniforms[];
- scoped_ptr<StrictMock<gfx::MockGLInterface> > gl_;
-
ProgramManager manager_;
Program* program_;
ShaderManager shader_manager_;
@@ -1569,7 +1549,7 @@ TEST_F(ProgramManagerWithShaderTest, BindUniformLocation) {
program->GetUniformFakeLocation(kUniform3GoodName));
}
-class ProgramManagerWithCacheTest : public testing::Test {
+class ProgramManagerWithCacheTest : public GpuServiceTest {
public:
static const GLuint kClientProgramId = 1;
static const GLuint kServiceProgramId = 10;
@@ -1592,8 +1572,7 @@ class ProgramManagerWithCacheTest : public testing::Test {
protected:
virtual void SetUp() {
- gl_.reset(new StrictMock<gfx::MockGLInterface>());
- ::gfx::MockGLInterface::SetGLInterface(gl_.get());
+ GpuServiceTest::SetUp();
vertex_shader_ = shader_manager_.CreateShader(
kVertexShaderClientId, kVertexShaderServiceId, GL_VERTEX_SHADER);
@@ -1612,10 +1591,6 @@ class ProgramManagerWithCacheTest : public testing::Test {
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);
@@ -1757,8 +1732,6 @@ class ProgramManagerWithCacheTest : public testing::Test {
.Times(1);
}
- scoped_ptr<StrictMock<gfx::MockGLInterface> > gl_;
-
scoped_ptr<MockProgramCache> cache_;
ProgramManager manager_;
« no previous file with comments | « gpu/command_buffer/service/memory_program_cache_unittest.cc ('k') | gpu/command_buffer/service/query_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698