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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/gl/gl_context.h" | 9 #include "ui/gl/gl_context.h" |
10 #include "ui/gl/gl_implementation.h" | 10 #include "ui/gl/gl_implementation.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 bool fallback_to_osmesa = false; | 55 bool fallback_to_osmesa = false; |
56 bool gpu_service_logging = false; | 56 bool gpu_service_logging = false; |
57 bool disable_gl_drawing = true; | 57 bool disable_gl_drawing = true; |
58 | 58 |
59 CHECK(GLSurface::InitializeOneOffImplementation( | 59 CHECK(GLSurface::InitializeOneOffImplementation( |
60 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); | 60 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); |
61 } | 61 } |
62 | 62 |
63 // static | 63 // static |
| 64 void GLSurfaceTestSupport::InitializeOneOffImplementation( |
| 65 GLImplementation impl, |
| 66 bool fallback_to_osmesa) { |
| 67 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) |
| 68 << "kUseGL has not effect in tests"; |
| 69 |
| 70 // This method may be called multiple times in the same process to set up |
| 71 // bindings in different ways. |
| 72 ClearGLBindings(); |
| 73 |
| 74 bool gpu_service_logging = false; |
| 75 bool disable_gl_drawing = false; |
| 76 |
| 77 CHECK(GLSurface::InitializeOneOffImplementation( |
| 78 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); |
| 79 } |
| 80 |
| 81 // static |
64 void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() { | 82 void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() { |
65 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) | 83 InitializeOneOffImplementation(kGLImplementationMockGL, false); |
66 << "kUseGL has not effect in tests"; | |
67 | |
68 // This method may be called multiple times in the same process to set up | |
69 // mock bindings in different ways. | |
70 ClearGLBindings(); | |
71 | |
72 bool fallback_to_osmesa = false; | |
73 bool gpu_service_logging = false; | |
74 bool disable_gl_drawing = false; | |
75 | |
76 CHECK(GLSurface::InitializeOneOffImplementation( | |
77 kGLImplementationMockGL, fallback_to_osmesa, gpu_service_logging, | |
78 disable_gl_drawing)); | |
79 } | 84 } |
80 | 85 |
81 // static | 86 // static |
82 void GLSurfaceTestSupport::InitializeDynamicMockBindings(GLContext* context) { | 87 void GLSurfaceTestSupport::InitializeDynamicMockBindings(GLContext* context) { |
83 CHECK(InitializeDynamicGLBindings(kGLImplementationMockGL, context)); | 88 CHECK(InitializeDynamicGLBindings(kGLImplementationMockGL, context)); |
84 } | 89 } |
85 | 90 |
86 } // namespace gfx | 91 } // namespace gfx |
OLD | NEW |