#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"
using content::WebGraphicsContext3DCommandBufferImpl;
+const content::CauseForGpuLaunch kInitCause =
+ content::
+ CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
+
class ContextTestBase : public content::ContentBrowserTest {
public:
virtual void SetUpOnMainThread() OVERRIDE {
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(),
}
protected:
- scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context_;
+ scoped_ptr<content::WebGraphicsContext3DCommandBufferImpl> context_;
gpu::ContextSupport* context_support_;
};
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());
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();
}
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.
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());