OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gl/test/gl_surface_test_support.h" | 5 #include "ui/gl/test/gl_surface_test_support.h" |
6 | 6 |
| 7 #include <vector> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "build/build_config.h" | 11 #include "build/build_config.h" |
10 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
11 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
12 #include "ui/gl/gl_surface.h" | |
13 #include "ui/gl/gl_switches.h" | 14 #include "ui/gl/gl_switches.h" |
| 15 #include "ui/gl/init/gl_initializer.h" |
14 | 16 |
15 #if defined(USE_X11) | 17 #if defined(USE_X11) |
16 #include <X11/Xlib.h> | 18 #include <X11/Xlib.h> |
17 #include "ui/platform_window/x11/x11_window.h" | 19 #include "ui/platform_window/x11/x11_window.h" |
18 #endif | 20 #endif |
19 | 21 |
20 namespace gl { | 22 namespace gl { |
21 | 23 |
22 // static | 24 // static |
23 void GLSurfaceTestSupport::InitializeOneOff() { | 25 void GLSurfaceTestSupport::InitializeOneOff() { |
(...skipping 26 matching lines...) Expand all Loading... |
50 if (use_osmesa) | 52 if (use_osmesa) |
51 impl = kGLImplementationOSMesaGL; | 53 impl = kGLImplementationOSMesaGL; |
52 | 54 |
53 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) | 55 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) |
54 << "kUseGL has not effect in tests"; | 56 << "kUseGL has not effect in tests"; |
55 | 57 |
56 bool fallback_to_osmesa = false; | 58 bool fallback_to_osmesa = false; |
57 bool gpu_service_logging = false; | 59 bool gpu_service_logging = false; |
58 bool disable_gl_drawing = true; | 60 bool disable_gl_drawing = true; |
59 | 61 |
60 CHECK(GLSurface::InitializeOneOffImplementation( | 62 CHECK(init::GLInitializer::InitializeOneOffImplementation( |
61 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); | 63 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); |
62 } | 64 } |
63 | 65 |
64 // static | 66 // static |
65 void GLSurfaceTestSupport::InitializeOneOffImplementation( | 67 void GLSurfaceTestSupport::InitializeOneOffImplementation( |
66 GLImplementation impl, | 68 GLImplementation impl, |
67 bool fallback_to_osmesa) { | 69 bool fallback_to_osmesa) { |
68 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) | 70 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) |
69 << "kUseGL has not effect in tests"; | 71 << "kUseGL has not effect in tests"; |
70 | 72 |
71 // This method may be called multiple times in the same process to set up | 73 // This method may be called multiple times in the same process to set up |
72 // bindings in different ways. | 74 // bindings in different ways. |
73 ClearGLBindings(); | 75 ClearGLBindings(); |
74 | 76 |
75 bool gpu_service_logging = false; | 77 bool gpu_service_logging = false; |
76 bool disable_gl_drawing = false; | 78 bool disable_gl_drawing = false; |
77 | 79 |
78 CHECK(GLSurface::InitializeOneOffImplementation( | 80 CHECK(init::GLInitializer::InitializeOneOffImplementation( |
79 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); | 81 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); |
80 } | 82 } |
81 | 83 |
82 // static | 84 // static |
83 void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() { | 85 void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() { |
84 InitializeOneOffImplementation(kGLImplementationMockGL, false); | 86 InitializeOneOffImplementation(kGLImplementationMockGL, false); |
85 } | 87 } |
86 | 88 |
87 // static | 89 // static |
88 void GLSurfaceTestSupport::InitializeDynamicMockBindings(GLContext* context) { | 90 void GLSurfaceTestSupport::InitializeDynamicMockBindings(GLContext* context) { |
89 CHECK(InitializeDynamicGLBindings(kGLImplementationMockGL, context)); | 91 CHECK(InitializeDynamicGLBindings(kGLImplementationMockGL, context)); |
90 } | 92 } |
91 | 93 |
92 } // namespace gl | 94 } // namespace gl |
OLD | NEW |