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

Side by Side Diff: ui/compositor/test/context_factories_for_test.cc

Issue 2009693002: Create SurfaceManager with ui::InitializeContextFactoryForTests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/test/context_factories_for_test.h" 5 #include "ui/compositor/test/context_factories_for_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "cc/surfaces/surface_manager.h"
9 #include "ui/compositor/compositor.h" 10 #include "ui/compositor/compositor.h"
10 #include "ui/compositor/compositor_switches.h" 11 #include "ui/compositor/compositor_switches.h"
11 #include "ui/compositor/test/in_process_context_factory.h" 12 #include "ui/compositor/test/in_process_context_factory.h"
12 #include "ui/gl/gl_implementation.h" 13 #include "ui/gl/gl_implementation.h"
13 14
14 namespace { 15 namespace {
15 16
17 static cc::SurfaceManager* g_surface_manager = nullptr;
16 static ui::ContextFactory* g_implicit_factory = NULL; 18 static ui::ContextFactory* g_implicit_factory = NULL;
17 static gfx::DisableNullDrawGLBindings* g_disable_null_draw = NULL; 19 static gfx::DisableNullDrawGLBindings* g_disable_null_draw = NULL;
18 20
19 } // namespace 21 } // namespace
20 22
21 namespace ui { 23 namespace ui {
22 24
23 // static 25 // static
24 ui::ContextFactory* InitializeContextFactoryForTests(bool enable_pixel_output) { 26 ui::ContextFactory* InitializeContextFactoryForTests(bool enable_pixel_output) {
25 DCHECK(!g_implicit_factory) << 27 DCHECK(!g_implicit_factory) <<
26 "ContextFactory for tests already initialized."; 28 "ContextFactory for tests already initialized.";
27 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 29 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
28 if (command_line->HasSwitch(switches::kEnablePixelOutputInTests)) 30 if (command_line->HasSwitch(switches::kEnablePixelOutputInTests))
29 enable_pixel_output = true; 31 enable_pixel_output = true;
30 if (enable_pixel_output) 32 if (enable_pixel_output)
31 g_disable_null_draw = new gfx::DisableNullDrawGLBindings; 33 g_disable_null_draw = new gfx::DisableNullDrawGLBindings;
32 bool context_factory_for_test = true; 34 bool context_factory_for_test = true;
35 g_surface_manager = new cc::SurfaceManager;
33 g_implicit_factory = 36 g_implicit_factory =
34 new InProcessContextFactory(context_factory_for_test, nullptr); 37 new InProcessContextFactory(context_factory_for_test, g_surface_manager);
35 return g_implicit_factory; 38 return g_implicit_factory;
36 } 39 }
37 40
38 void TerminateContextFactoryForTests() { 41 void TerminateContextFactoryForTests() {
39 delete g_implicit_factory; 42 delete g_implicit_factory;
40 g_implicit_factory = NULL; 43 g_implicit_factory = NULL;
44 delete g_surface_manager;
45 g_surface_manager = nullptr;
41 delete g_disable_null_draw; 46 delete g_disable_null_draw;
42 g_disable_null_draw = NULL; 47 g_disable_null_draw = NULL;
43 } 48 }
44 49
45 } // namespace ui 50 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698