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

Unified Diff: gpu/command_buffer/service/mailbox_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/mailbox_manager_unittest.cc
diff --git a/gpu/command_buffer/service/mailbox_manager_unittest.cc b/gpu/command_buffer/service/mailbox_manager_unittest.cc
index 13005e6c35e2da210bc8ba7b2ad596be1373c637..8e57faa96c0fe836e7d473528e635fd5febdc982 100644
--- a/gpu/command_buffer/service/mailbox_manager_unittest.cc
+++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc
@@ -5,6 +5,7 @@
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/feature_info.h"
+#include "gpu/command_buffer/service/gpu_service_test.h"
#include "gpu/command_buffer/service/mailbox_synchronizer.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -17,18 +18,32 @@ namespace gles2 {
using namespace ::testing;
-class MailboxManagerTest : public testing::Test {
+class MailboxManagerTest : public GpuServiceTest {
public:
- MailboxManagerTest() {}
+ MailboxManagerTest() : initialized_synchronizer_(false) {}
virtual ~MailboxManagerTest() {}
protected:
virtual void SetUp() {
- testing::Test::SetUp();
+ GpuServiceTest::SetUp();
feature_info_ = new FeatureInfo;
manager_ = new MailboxManager;
}
+ virtual void SetUpWithSynchronizer() {
+ GpuServiceTest::SetUp();
+ MailboxSynchronizer::Initialize();
+ initialized_synchronizer_ = true;
+ feature_info_ = new FeatureInfo;
+ manager_ = new MailboxManager;
+ }
+
+ virtual void TearDown() {
+ if (initialized_synchronizer_)
+ MailboxSynchronizer::Terminate();
+ GpuServiceTest::TearDown();
+ }
+
Texture* CreateTexture() {
return new Texture(1);
}
@@ -73,6 +88,7 @@ class MailboxManagerTest : public testing::Test {
scoped_refptr<MailboxManager> manager_;
private:
+ bool initialized_synchronizer_;
scoped_refptr<FeatureInfo> feature_info_;
DISALLOW_COPY_AND_ASSIGN(MailboxManagerTest);
@@ -185,11 +201,8 @@ class MailboxManagerSyncTest : public MailboxManagerTest {
protected:
virtual void SetUp() {
- MailboxSynchronizer::Initialize();
- MailboxManagerTest::SetUp();
+ MailboxManagerTest::SetUpWithSynchronizer();
manager2_ = new MailboxManager;
- gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
- ::gfx::MockGLInterface::SetGLInterface(gl_.get());
context_ = new gfx::GLContextStub();
surface_ = new gfx::GLSurfaceStub();
context_->MakeCurrent(surface_);
@@ -252,14 +265,10 @@ class MailboxManagerSyncTest : public MailboxManagerTest {
}
virtual void TearDown() {
- MailboxManagerTest::TearDown();
- MailboxSynchronizer::Terminate();
context_->ReleaseCurrent(NULL);
- ::gfx::MockGLInterface::SetGLInterface(NULL);
- gl_.reset();
+ MailboxManagerTest::TearDown();
}
- scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
scoped_refptr<MailboxManager> manager2_;
scoped_refptr<gfx::GLContext> context_;
scoped_refptr<gfx::GLSurface> surface_;
« no previous file with comments | « gpu/command_buffer/service/gpu_tracer_unittest.cc ('k') | gpu/command_buffer/service/memory_program_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698