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

Unified Diff: content/browser/compositor/image_transport_factory.cc

Issue 145293007: ui: No more TestCompositor. Use NullDraw contexts in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testsnulldraw: Created 6 years, 11 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/browser/compositor/image_transport_factory.cc
diff --git a/content/browser/compositor/image_transport_factory.cc b/content/browser/compositor/image_transport_factory.cc
index becdc68b73e62e66f31c68f00858475182d9efd9..c0b739d9af99ffe227eb8e22a6f1a830db986f8b 100644
--- a/content/browser/compositor/image_transport_factory.cc
+++ b/content/browser/compositor/image_transport_factory.cc
@@ -4,15 +4,19 @@
#include "content/browser/compositor/image_transport_factory.h"
+#include "base/command_line.h"
#include "content/browser/compositor/gpu_process_transport_factory.h"
#include "content/browser/compositor/no_transport_image_transport_factory.h"
#include "ui/compositor/compositor.h"
+#include "ui/compositor/compositor_switches.h"
+#include "ui/gl/gl_implementation.h"
namespace content {
namespace {
ImageTransportFactory* g_factory = NULL;
bool g_initialized_for_unit_tests = false;
+static gfx::DisableNullDrawGLBindings* g_disable_null_draw = NULL;
}
// static
@@ -29,6 +33,11 @@ void ImageTransportFactory::InitializeForUnitTests(
DCHECK(!g_factory);
DCHECK(!g_initialized_for_unit_tests);
g_initialized_for_unit_tests = true;
+
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kEnablePixelOutputInTests))
+ g_disable_null_draw = new gfx::DisableNullDrawGLBindings;
danakj 2014/01/29 01:28:21 This is duplicated with the InitializeContextFacto
+
g_factory = new NoTransportImageTransportFactory(test_factory.Pass());
ui::ContextFactory::SetInstance(g_factory->AsContextFactory());
}
@@ -38,6 +47,8 @@ void ImageTransportFactory::Terminate() {
ui::ContextFactory::SetInstance(NULL);
delete g_factory;
g_factory = NULL;
+ delete g_disable_null_draw;
+ g_disable_null_draw = NULL;
g_initialized_for_unit_tests = false;
}

Powered by Google App Engine
This is Rietveld 408576698