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

Unified Diff: gpu/command_buffer/service/texture_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/texture_manager_unittest.cc
diff --git a/gpu/command_buffer/service/texture_manager_unittest.cc b/gpu/command_buffer/service/texture_manager_unittest.cc
index 873511d3d359e46ad596c27de72e5bf7a628f587..2335191a0e9a5e2ba394e0f9668b570e287cfaf3 100644
--- a/gpu/command_buffer/service/texture_manager_unittest.cc
+++ b/gpu/command_buffer/service/texture_manager_unittest.cc
@@ -9,6 +9,7 @@
#include "gpu/command_buffer/service/feature_info.h"
#include "gpu/command_buffer/service/framebuffer_manager.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
+#include "gpu/command_buffer/service/gpu_service_test.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/command_buffer/service/mocks.h"
@@ -39,7 +40,7 @@ class TextureTestHelper {
}
};
-class TextureManagerTest : public testing::Test {
+class TextureManagerTest : public GpuServiceTest {
public:
static const GLint kMaxTextureSize = 16;
static const GLint kMaxCubeMapTextureSize = 8;
@@ -56,9 +57,7 @@ class TextureManagerTest : public testing::Test {
protected:
virtual void SetUp() {
- gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
- ::gfx::MockGLInterface::SetGLInterface(gl_.get());
-
+ GpuServiceTest::SetUp();
manager_.reset(new TextureManager(NULL,
feature_info_.get(),
kMaxTextureSize,
@@ -73,8 +72,7 @@ class TextureManagerTest : public testing::Test {
virtual void TearDown() {
manager_->Destroy(false);
manager_.reset();
- ::gfx::MockGLInterface::SetGLInterface(NULL);
- gl_.reset();
+ GpuServiceTest::TearDown();
}
void SetParameter(
@@ -84,8 +82,6 @@ class TextureManagerTest : public testing::Test {
texture_ref, pname, value, error);
}
- // Use StrictMock to make 100% sure we know how GL will be called.
- scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
scoped_refptr<FeatureInfo> feature_info_;
scoped_ptr<TextureManager> manager_;
scoped_ptr<MockErrorState> error_state_;
@@ -385,7 +381,7 @@ TEST_F(TextureManagerTest, ValidForTargetNPOT) {
manager.Destroy(false);
}
-class TextureTestBase : public testing::Test {
+class TextureTestBase : public GpuServiceTest {
public:
static const GLint kMaxTextureSize = 16;
static const GLint kMaxCubeMapTextureSize = 8;
@@ -404,9 +400,7 @@ class TextureTestBase : public testing::Test {
protected:
void SetUpBase(MemoryTracker* memory_tracker, std::string extensions) {
- gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
- ::gfx::MockGLInterface::SetGLInterface(gl_.get());
-
+ GpuServiceTest::SetUp();
if (!extensions.empty()) {
TestHelper::SetupFeatureInfoInitExpectations(gl_.get(),
extensions.c_str());
@@ -440,8 +434,7 @@ class TextureTestBase : public testing::Test {
}
manager_->Destroy(false);
manager_.reset();
- ::gfx::MockGLInterface::SetGLInterface(NULL);
- gl_.reset();
+ GpuServiceTest::TearDown();
}
void SetParameter(
@@ -453,8 +446,6 @@ class TextureTestBase : public testing::Test {
scoped_ptr<MockGLES2Decoder> decoder_;
scoped_ptr<MockErrorState> error_state_;
- // Use StrictMock to make 100% sure we know how GL will be called.
- scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
scoped_refptr<FeatureInfo> feature_info_;
scoped_ptr<TextureManager> manager_;
scoped_refptr<TextureRef> texture_ref_;
@@ -2201,7 +2192,7 @@ class CountingMemoryTracker : public MemoryTracker {
DISALLOW_COPY_AND_ASSIGN(CountingMemoryTracker);
};
-class SharedTextureTest : public testing::Test {
+class SharedTextureTest : public GpuServiceTest {
public:
static const bool kUseDefaultTextures = false;
@@ -2211,9 +2202,7 @@ class SharedTextureTest : public testing::Test {
}
virtual void SetUp() {
- gl_.reset(new ::gfx::MockGLInterface());
- ::gfx::MockGLInterface::SetGLInterface(gl_.get());
-
+ GpuServiceTest::SetUp();
memory_tracker1_ = new CountingMemoryTracker;
texture_manager1_.reset(
new TextureManager(memory_tracker1_.get(),
@@ -2241,12 +2230,10 @@ class SharedTextureTest : public testing::Test {
texture_manager2_.reset();
texture_manager1_->Destroy(false);
texture_manager1_.reset();
- ::gfx::MockGLInterface::SetGLInterface(NULL);
- gl_.reset();
+ GpuServiceTest::TearDown();
}
protected:
- scoped_ptr< ::gfx::MockGLInterface > gl_;
scoped_refptr<FeatureInfo> feature_info_;
scoped_refptr<CountingMemoryTracker> memory_tracker1_;
scoped_ptr<TextureManager> texture_manager1_;
« no previous file with comments | « gpu/command_buffer/service/shader_manager_unittest.cc ('k') | gpu/command_buffer/service/vertex_array_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698