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

Unified Diff: content/public/test/browser_test_base.cc

Issue 45963003: Move test-only ContextFactory implementations out of production targets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert bad ui/base changes Created 7 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: content/public/test/browser_test_base.cc
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc
index c0617c44d2845a56e1da038b42930368f5525588..871c271f91c11567666b7088d4bf53351033a988 100644
--- a/content/public/test/browser_test_base.cc
+++ b/content/public/test/browser_test_base.cc
@@ -36,6 +36,11 @@
#include "content/public/browser/browser_thread.h"
#endif
+#if defined(USE_AURA)
+#include "content/browser/aura/image_transport_factory.h"
+#include "ui/compositor/test/test_context_factory.h"
+#endif
+
namespace content {
namespace {
@@ -148,11 +153,23 @@ void BrowserTestBase::SetUp() {
// GPU blacklisting decisions were made.
command_line->AppendSwitch(switches::kLogGpuControlListDecisions);
+#if defined(OS_CHROMEOS)
+ // If the test is running on the chromeos envrionment (such as
+ // device or vm bots), always use real contexts.
+ if (base::SysInfo::IsRunningOnChromeOS())
+ allow_test_contexts_ = false;
+#endif
+
#if defined(USE_AURA)
+ if (command_line->HasSwitch(switches::kDisableTestCompositor))
+ allow_test_contexts_ = false;
+
// Use test contexts for browser tests unless they override and force us to
// use a real context.
- if (allow_test_contexts_)
- command_line->AppendSwitch(switches::kTestCompositor);
+ if (allow_test_contexts_) {
+ content::ImageTransportFactory::InitializeForUnitTests(
+ scoped_ptr<ui::ContextFactory>(new ui::TestContextFactory));
+ }
#endif
// When using real GL contexts, we usually use OSMesa as this works on all

Powered by Google App Engine
This is Rietveld 408576698