Index: content/browser/aura/image_transport_factory.cc |
diff --git a/content/browser/aura/image_transport_factory.cc b/content/browser/aura/image_transport_factory.cc |
index 2e92dd05111c9285ad8cbb21f72a322918f31987..de09e8391bbe2a5ccc73c9250a4eff7907130e4e 100644 |
--- a/content/browser/aura/image_transport_factory.cc |
+++ b/content/browser/aura/image_transport_factory.cc |
@@ -8,7 +8,12 @@ |
#include "content/browser/aura/gpu_process_transport_factory.h" |
#include "content/browser/aura/no_transport_image_transport_factory.h" |
#include "content/public/common/content_switches.h" |
-#include "ui/compositor/compositor_setup.h" |
+#include "ui/compositor/compositor.h" |
+#include "ui/compositor/compositor_switches.h" |
+ |
+#if defined(OS_CHROMEOS) |
+#include "base/chromeos/chromeos_version.h" |
+#endif |
namespace content { |
@@ -16,15 +21,34 @@ namespace { |
ImageTransportFactory* g_factory; |
} |
+ |
+static bool UseTestContextAndTransportFactory() { |
+#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::chromeos::IsRunningOnChromeOS()) |
+ return false; |
+#endif |
+ |
+ // Only used if the enable command line flag is used. |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ if (!command_line->HasSwitch(switches::kTestCompositor)) |
+ return false; |
+ |
+ // The disable command line flag preempts the enable flag. |
+ if (!command_line->HasSwitch(switches::kDisableTestCompositor)) |
+ return true; |
+ |
+ return false; |
+} |
+ |
// static |
void ImageTransportFactory::Initialize() { |
- CommandLine* command_line = CommandLine::ForCurrentProcess(); |
- if (command_line->HasSwitch(switches::kTestCompositor)) { |
- ui::SetupTestCompositor(); |
- } |
- if (ui::IsTestCompositorEnabled()) { |
- g_factory = new NoTransportImageTransportFactory( |
- new ui::TestContextFactory); |
+ bool use_test_contexts = UseTestContextAndTransportFactory(); |
+ |
+ if (use_test_contexts) { |
sky
2013/08/05 16:50:58
nit: no need for local variable here.
danakj
2013/08/05 16:53:34
Done.
|
+ g_factory = |
+ new NoTransportImageTransportFactory(new ui::TestContextFactory); |
} else { |
g_factory = new GpuProcessTransportFactory; |
} |