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

Unified Diff: chrome/test/base/chrome_test_suite.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: chrome/test/base/chrome_test_suite.cc
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc
index fa02aa99ee185727bf3d304d00d2f64b66c6320d..9f9ff4d7be42b2d5be4c64610527cdcf8b6268c5 100644
--- a/chrome/test/base/chrome_test_suite.cc
+++ b/chrome/test/base/chrome_test_suite.cc
@@ -28,10 +28,19 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h"
+#if defined(VIEWS_COMPOSITOR)
+#include "ui/gfx/compositor/compositor.h"
+#include "ui/gfx/compositor/test_compositor.h"
+#endif
+
#if defined(TOOLKIT_VIEWS)
#include "views/view.h"
#endif
+#if defined(OS_LINUX)
+#include "ui/gfx/gl/gl_switches.h"
+#endif
+
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
#include "content/common/chrome_application_mac.h"
@@ -163,6 +172,12 @@ void ChromeTestSuite::Initialize() {
#if defined(OS_MACOSX)
chrome_application_mac::RegisterCrApp();
#endif
+#if defined(OS_LINUX)
sky 2011/10/14 20:52:41 #elif
danakj 2011/10/17 14:52:13 Done.
+ // trybots don't have DesktopGL
+ EXPECT_TRUE(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL));
+ CommandLine::ForCurrentProcess()->AppendSwitchASCII(
+ switches::kUseGL, gfx::kGLImplementationOSMesaName);
+#endif
base::mac::ScopedNSAutoreleasePool autorelease_pool;
@@ -187,6 +202,12 @@ void ChromeTestSuite::Initialize() {
base::mac::SetOverrideAppBundlePath(path);
#endif
+#if defined(VIEWS_COMPOSITOR)
+ // Use a mock compositor that noops draws.
+ ui::Compositor::set_compositor_factory_for_testing(
+ ui::TestCompositor::Create);
+#endif
+
// Force unittests to run using en-US so if we test against string
// output, it'll pass regardless of the system language.
ResourceBundle::InitSharedInstance("en-US");
@@ -196,11 +217,6 @@ void ChromeTestSuite::Initialize() {
resources_pack_path.Append(FILE_PATH_LITERAL("resources.pak"));
ResourceBundle::AddDataPackToSharedInstance(resources_pack_path);
-#if defined(TOOLKIT_VIEWS) && defined(OS_LINUX)
- // Turn of GPU compositing in browser during unit tests.
- views::View::set_use_acceleration_when_possible(false);
-#endif
-
stats_filename_ = base::StringPrintf("unit_tests-%d",
base::GetCurrentProcId());
RemoveSharedMemoryFile(stats_filename_);

Powered by Google App Engine
This is Rietveld 408576698