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

Unified Diff: views/run_all_unittests.cc

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testsuite subclasses 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: views/run_all_unittests.cc
diff --git a/views/run_all_unittests.cc b/views/run_all_unittests.cc
index 90fd4dda1307d6c72bff14705c284856a692c29c..84012e08853215aa46a55ca5f6bdf50109ddb03d 100644
--- a/views/run_all_unittests.cc
+++ b/views/run_all_unittests.cc
@@ -7,6 +7,16 @@
#include "ui/base/ui_base_paths.h"
#include "views/view.h"
+#if defined(OS_LINUX)
+#include "base/command_line.h"
+#include "ui/gfx/gl/gl_switches.h"
+#endif
+
+#if defined(VIEWS_COMPOSITOR)
+#include "ui/gfx/compositor/compositor.h"
+#include "ui/gfx/compositor/test_compositor.h"
+#endif
+
class ViewTestSuite : public base::TestSuite {
public:
ViewTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
@@ -19,8 +29,15 @@ class ViewTestSuite : public base::TestSuite {
ui::ResourceBundle::InitSharedInstance("en-US");
#if defined(OS_LINUX)
- // Disable GPU browser compositor during unit tests.
- views::View::set_use_acceleration_when_possible(false);
+ EXPECT_TRUE(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL));
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kUseGL, gfx::kGLImplementationOSMesaName);
+#endif
+
+#if defined(VIEWS_COMPOSITOR)
+ // Use a mock compositor that noops draws.
+ ui::Compositor::set_compositor_factory_for_testing(
+ ui::TestCompositor::Create);
#endif
}
};

Powered by Google App Engine
This is Rietveld 408576698