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

Unified Diff: chrome/test/base/in_process_browser_test.cc

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 9 years, 2 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: chrome/test/base/in_process_browser_test.cc
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index b351355fafbc7dc76dcb3304f373f1195fff8bcb..822e959e6c6778dc5d07926e9fdbe8f8e166b345 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -36,6 +36,12 @@
#include "content/renderer/mock_content_renderer_client.h"
#include "net/base/mock_host_resolver.h"
#include "net/test/test_server.h"
+#include "ui/gfx/gl/gl_switches.h"
+
+#if defined(VIEWS_COMPOSITOR)
+#include "ui/gfx/compositor/test_compositor.h"
+#include "views/widget/widget.h"
+#endif
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/audio_handler.h"
@@ -44,6 +50,12 @@
// Passed as value of kTestType.
static const char kBrowserTestType[] = "browser";
+#if defined(VIEWS_COMPOSITOR)
+static ui::Compositor* TestCreateCompositor(ui::CompositorDelegate* owner) {
+ return new ui::TestCompositor(owner);
+}
+#endif
+
InProcessBrowserTest::InProcessBrowserTest()
: browser_(NULL),
show_window_(false),
@@ -128,6 +140,17 @@ void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) {
// Propagate commandline settings from test_launcher_utils.
test_launcher_utils::PrepareBrowserCommandLineForTests(command_line);
+ // Use MesaGL as the GL implementation, as desktopgl/egl is not present on
+ // test bots yet.
+ EXPECT_TRUE(
+ test_launcher_utils::OverrideGLImplementation(
Paweł Hajdan Jr. 2011/10/13 20:08:13 Do you also want things to apply to content? If so
danakj 2011/10/14 15:15:13 Yes I should, thanks !
+ command_line, gfx::kGLImplementationOSMesaName));
+
+#if defined(VIEWS_COMPOSITOR)
+ // Use a mock compositor that noops draws.
+ views::Widget::set_compositor_factory_for_testing(&TestCreateCompositor);
+#endif
+
if (dom_automation_enabled_)
command_line->AppendSwitch(switches::kDomAutomationController);

Powered by Google App Engine
This is Rietveld 408576698