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

Unified Diff: ui/compositor/test/context_factories_for_test.cc

Issue 175093004: ui: Allow individual test suites to opt-out of the TestCompositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nulldrawdisable: Created 6 years, 10 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
« no previous file with comments | « no previous file | ui/gl/gl_bindings.h » ('j') | ui/gl/gl_surface.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0c452c529e4b2ff56f257b3cfd209530a953557c..d13782ac061013f361a083eda048a860811cc840 100644
--- a/ui/compositor/test/context_factories_for_test.cc
+++ b/ui/compositor/test/context_factories_for_test.cc
@@ -15,16 +15,22 @@
namespace ui {
static ContextFactory* g_implicit_factory = NULL;
+static gfx::DisableNullDrawGLBindings* g_disable_null_draw = NULL;
no sievers 2014/02/21 19:51:49 nit: Shouldn't these statics be in an anonymous na
danakj 2014/02/21 19:56:58 Sure!
// static
void InitializeContextFactoryForTests(bool enable_pixel_output) {
DCHECK(!g_implicit_factory) <<
"ContextFactory for tests already initialized.";
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kEnablePixelOutputInTests))
+ enable_pixel_output = true;
bool use_test_contexts = true;
+ if (gfx::HasInitializedNullDrawGLBindings())
+ use_test_contexts = false;
no sievers 2014/02/21 19:51:49 Is that ok even if enable_pixel_output == true?
danakj 2014/02/21 19:56:58 Ya, the gfx::DisableNullDrawGLBindings down below
+
// 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;
@@ -43,6 +49,8 @@ void InitializeContextFactoryForTests(bool enable_pixel_output) {
} else {
DCHECK_NE(gfx::kGLImplementationNone, gfx::GetGLImplementation());
DVLOG(1) << "Using InProcessContextFactory";
+ if (enable_pixel_output && gfx::HasInitializedNullDrawGLBindings())
+ g_disable_null_draw = new gfx::DisableNullDrawGLBindings;
g_implicit_factory = new ui::InProcessContextFactory();
}
ContextFactory::SetInstance(g_implicit_factory);
@@ -52,6 +60,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
« no previous file with comments | « no previous file | ui/gl/gl_bindings.h » ('j') | ui/gl/gl_surface.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698