Index: content/browser/gpu/gpu_ipc_browsertests.cc |
diff --git a/content/browser/gpu/gpu_ipc_browsertests.cc b/content/browser/gpu/gpu_ipc_browsertests.cc |
index ca2ccf9ee0510b4fb0d1c5478784f78c0465d731..d1ebfffc9ae3c83fd18560f26fab07ede55c727d 100644 |
--- a/content/browser/gpu/gpu_ipc_browsertests.cc |
+++ b/content/browser/gpu/gpu_ipc_browsertests.cc |
@@ -9,7 +9,6 @@ |
#include "content/common/gpu/client/context_provider_command_buffer.h" |
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
#include "content/common/gpu/gpu_process_launch_causes.h" |
-#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/gpu_data_manager.h" |
#include "content/public/common/content_switches.h" |
#include "content/test/content_browser_test.h" |
@@ -20,6 +19,10 @@ namespace { |
using content::WebGraphicsContext3DCommandBufferImpl; |
+const content::CauseForGpuLaunch kInitCause = |
+ content:: |
+ CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
+ |
class ContextTestBase : public content::ContentBrowserTest { |
public: |
virtual void SetUpOnMainThread() OVERRIDE { |
@@ -33,9 +36,7 @@ class ContextTestBase : public content::ContentBrowserTest { |
content::BrowserGpuChannelHostFactory::instance(); |
CHECK(factory); |
scoped_refptr<content::GpuChannelHost> gpu_channel_host( |
- factory->EstablishGpuChannelSync( |
- content:: |
- CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
+ factory->EstablishGpuChannelSync(kInitCause)); |
context_.reset( |
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
gpu_channel_host.get(), |
@@ -55,7 +56,7 @@ class ContextTestBase : public content::ContentBrowserTest { |
} |
protected: |
- scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context_; |
+ scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl> context_; |
gpu::ContextSupport* context_support_; |
}; |
@@ -70,13 +71,13 @@ namespace content { |
class BrowserGpuChannelHostFactoryTest : public ContextTestBase { |
public: |
virtual void SetUpOnMainThread() OVERRIDE { |
- if (!content::BrowserGpuChannelHostFactory::CanUseForTesting()) |
+ if (!BrowserGpuChannelHostFactory::CanUseForTesting()) |
return; |
// Start all tests without a gpu channel so that the tests exercise a |
// consistent codepath. |
- if (!content::BrowserGpuChannelHostFactory::instance()) |
- content::BrowserGpuChannelHostFactory::Initialize(false); |
+ if (!BrowserGpuChannelHostFactory::instance()) |
+ BrowserGpuChannelHostFactory::Initialize(false); |
CHECK(GetFactory()); |
@@ -109,9 +110,7 @@ class BrowserGpuChannelHostFactoryTest : public ContextTestBase { |
void EstablishAndWait() { |
base::RunLoop run_loop; |
- GetFactory()->EstablishGpuChannel( |
- CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, |
- run_loop.QuitClosure()); |
+ GetFactory()->EstablishGpuChannel(kInitCause, run_loop.QuitClosure()); |
run_loop.Run(); |
} |
@@ -150,9 +149,7 @@ IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, |
DCHECK(!IsChannelEstablished()); |
base::RunLoop run_loop; |
- GetFactory()->EstablishGpuChannel( |
- CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, |
- run_loop.QuitClosure()); |
+ GetFactory()->EstablishGpuChannel(kInitCause, run_loop.QuitClosure()); |
GetFactory()->Terminate(); |
// The callback should still trigger. |
@@ -165,13 +162,12 @@ IN_PROC_BROWSER_TEST_F(BrowserGpuChannelHostFactoryTest, AlreadyEstablished) { |
DCHECK(!IsChannelEstablished()); |
scoped_refptr<GpuChannelHost> gpu_channel = |
- GetFactory()->EstablishGpuChannelSync( |
- CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); |
+ GetFactory()->EstablishGpuChannelSync(kInitCause); |
// Expect established callback immediately. |
bool event = false; |
GetFactory()->EstablishGpuChannel( |
- CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE, |
+ kInitCause, |
base::Bind(&BrowserGpuChannelHostFactoryTest::Signal, &event)); |
EXPECT_TRUE(event); |
EXPECT_EQ(gpu_channel, GetGpuChannel()); |