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( | 64 void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() { |
65 GLImplementation impl, | |
66 bool fallback_to_osmesa) { | |
67 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) | 65 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) |
68 << "kUseGL has not effect in tests"; | 66 << "kUseGL has not effect in tests"; |
69 | 67 |
70 // This method may be called multiple times in the same process to set up | 68 // This method may be called multiple times in the same process to set up |
71 // bindings in different ways. | 69 // mock bindings in different ways. |
72 ClearGLBindings(); | 70 ClearGLBindings(); |
73 | 71 |
| 72 bool fallback_to_osmesa = false; |
74 bool gpu_service_logging = false; | 73 bool gpu_service_logging = false; |
75 bool disable_gl_drawing = false; | 74 bool disable_gl_drawing = false; |
76 | 75 |
77 CHECK(GLSurface::InitializeOneOffImplementation( | 76 CHECK(GLSurface::InitializeOneOffImplementation( |
78 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); | 77 kGLImplementationMockGL, fallback_to_osmesa, gpu_service_logging, |
| 78 disable_gl_drawing)); |
79 } | 79 } |
80 | 80 |
81 // static | 81 // static |
82 void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() { | |
83 InitializeOneOffImplementation(kGLImplementationMockGL, false); | |
84 } | |
85 | |
86 // static | |
87 void GLSurfaceTestSupport::InitializeDynamicMockBindings(GLContext* context) { | 82 void GLSurfaceTestSupport::InitializeDynamicMockBindings(GLContext* context) { |
88 CHECK(InitializeDynamicGLBindings(kGLImplementationMockGL, context)); | 83 CHECK(InitializeDynamicGLBindings(kGLImplementationMockGL, context)); |
89 } | 84 } |
90 | 85 |
91 } // namespace gfx | 86 } // namespace gfx |
OLD | NEW |