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

Unified Diff: ui/compositor/test/context_factories_for_test.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: ui/compositor/test/context_factories_for_test.cc
diff --git a/ui/compositor/test/context_factories_for_test.cc b/ui/compositor/test/context_factories_for_test.cc
index b03fa347ced7bf51327f32596330e911ced78540..1c35df32a9df3a791b0d280362503e8378e8dd5c 100644
--- a/ui/compositor/test/context_factories_for_test.cc
+++ b/ui/compositor/test/context_factories_for_test.cc
@@ -8,43 +8,26 @@
#include "base/sys_info.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_switches.h"
-#include "ui/compositor/test/default_context_factory.h"
-#include "ui/compositor/test/test_context_factory.h"
+#include "ui/compositor/test/in_process_context_factory.h"
#include "ui/gl/gl_implementation.h"
namespace ui {
static ContextFactory* g_implicit_factory = NULL;
+static gfx::DisableNullDrawGLBindings* g_disable_null_draw = NULL;
// static
-void InitializeContextFactoryForTests(bool allow_test_contexts) {
+void InitializeContextFactoryForTests(bool enable_pixel_output) {
DCHECK(!g_implicit_factory) <<
"ContextFactory for tests already initialized.";
- bool use_test_contexts = true;
-
- // Always use test contexts unless the disable command line flag is used.
CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kDisableTestCompositor))
- use_test_contexts = false;
-
-#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())
- use_test_contexts = false;
-#endif
-
- if (!allow_test_contexts)
- use_test_contexts = false;
-
- if (use_test_contexts) {
- g_implicit_factory = new ui::TestContextFactory;
- } else {
- DCHECK_NE(gfx::kGLImplementationNone, gfx::GetGLImplementation());
- DVLOG(1) << "Using DefaultContextFactory";
- g_implicit_factory = new ui::DefaultContextFactory();
- }
+ if (command_line->HasSwitch(switches::kEnablePixelOutputInTests))
+ enable_pixel_output = true;
+ if (enable_pixel_output)
+ g_disable_null_draw = new gfx::DisableNullDrawGLBindings;
+
+ g_implicit_factory = new InProcessContextFactory();
ContextFactory::SetInstance(g_implicit_factory);
}
@@ -52,6 +35,8 @@ void TerminateContextFactoryForTests() {
ContextFactory::SetInstance(NULL);
delete g_implicit_factory;
g_implicit_factory = NULL;
+ delete g_disable_null_draw;
+ g_disable_null_draw = NULL;
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698