Index: content/test/browser_test_base.cc |
diff --git a/content/test/browser_test_base.cc b/content/test/browser_test_base.cc |
index 57ca1428c3bfc3a386fac1d1ad08fa127d166f7e..1e9441f3c706f088ac7e1a390ca2156650833f4b 100644 |
--- a/content/test/browser_test_base.cc |
+++ b/content/test/browser_test_base.cc |
@@ -8,14 +8,26 @@ |
#include "base/task.h" |
#include "content/common/main_function_params.h" |
#include "sandbox/src/dep.h" |
+#include "ui/gfx/gl/gl_switches.h" |
#if defined(OS_MACOSX) |
#include "base/mac/mac_util.h" |
#include "base/system_monitor/system_monitor.h" |
#endif |
+#if defined(VIEWS_COMPOSITOR) |
+#include "ui/gfx/compositor/compositor.h" |
+#include "ui/gfx/compositor/test_compositor.h" |
+#endif |
+ |
extern int BrowserMain(const MainFunctionParams&); |
+#if defined(VIEWS_COMPOSITOR) |
+static ui::Compositor* TestCreateCompositor(ui::CompositorDelegate* owner) { |
+ return new ui::TestCompositor(owner); |
+} |
+#endif |
+ |
BrowserTestBase::BrowserTestBase() { |
#if defined(OS_MACOSX) |
base::mac::SetOverrideAmIBundled(true); |
@@ -27,19 +39,33 @@ BrowserTestBase::~BrowserTestBase() { |
} |
void BrowserTestBase::SetUp() { |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ |
+ // Use MesaGL as the GL implementation, as desktopgl/egl is not present on |
+ // test bots yet. |
+ EXPECT_TRUE(!command_line->HasSwitch(switches::kUseGL)); |
+ command_line->AppendSwitchASCII(switches::kUseGL, |
+ gfx::kGLImplementationOSMesaName); |
+ |
SandboxInitWrapper sandbox_wrapper; |
- MainFunctionParams params(*CommandLine::ForCurrentProcess(), |
- sandbox_wrapper, |
- NULL); |
+ MainFunctionParams params(*command_line, sandbox_wrapper, NULL); |
params.ui_task = |
NewRunnableMethod(this, &BrowserTestBase::ProxyRunTestOnMainThreadLoop); |
+#if defined(VIEWS_COMPOSITOR) |
+ // Use a mock compositor that noops draws. |
+ ui::Compositor::set_compositor_factory_for_testing(&TestCreateCompositor); |
+#endif |
+ |
SetUpInProcessBrowserTestFixture(); |
BrowserMain(params); |
TearDownInProcessBrowserTestFixture(); |
} |
void BrowserTestBase::TearDown() { |
+#if defined(VIEWS_COMPOSITOR) |
+ ui::Compositor::set_compositor_factory_for_testing(NULL); |
+#endif |
} |
void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { |