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

Side by Side Diff: ui/gl/test/gl_surface_test_support.cc

Issue 2690113010: Abstract OSMesa from the Layout tests (Closed)
Patch Set: Renamed "Renderer" to "GL" Created 3 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 unified diff | Download patch
« no previous file with comments | « ui/gl/init/gl_factory.cc ('k') | ui/views/mus/views_mus_test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 16 matching lines...) Expand all
27 27
28 // static 28 // static
29 void GLSurfaceTestSupport::InitializeOneOff() { 29 void GLSurfaceTestSupport::InitializeOneOff() {
30 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); 30 DCHECK_EQ(kGLImplementationNone, GetGLImplementation());
31 31
32 #if defined(USE_X11) 32 #if defined(USE_X11)
33 XInitThreads(); 33 XInitThreads();
34 #endif 34 #endif
35 ui::test::EnableTestConfigForPlatformWindows(); 35 ui::test::EnableTestConfigForPlatformWindows();
36 36
37 bool use_osmesa = true; 37 bool use_software_gl = true;
38 38
39 // We usually use OSMesa as this works on all bots. The command line can 39 // We usually use software GL as this works on all bots. The
40 // override this behaviour to use hardware GL. 40 // command line can override this behaviour to use hardware GL.
41 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 41 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kUseGpuInTests)) { 42 switches::kUseGpuInTests)) {
43 use_osmesa = false; 43 use_software_gl = false;
44 } 44 }
45 45
46 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
47 // On Android we always use hardware GL. 47 // On Android we always use hardware GL.
48 use_osmesa = false; 48 use_software_gl = false;
49 #endif 49 #endif
50 50
51 std::vector<GLImplementation> allowed_impls = 51 std::vector<GLImplementation> allowed_impls =
52 init::GetAllowedGLImplementations(); 52 init::GetAllowedGLImplementations();
53 DCHECK(!allowed_impls.empty()); 53 DCHECK(!allowed_impls.empty());
54 54
55 GLImplementation impl = allowed_impls[0]; 55 GLImplementation impl = allowed_impls[0];
56 if (use_osmesa) 56 if (use_software_gl)
57 impl = kGLImplementationOSMesaGL; 57 impl = gl::GetSoftwareGLImplementation();
58 58
59 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) 59 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL))
60 << "kUseGL has not effect in tests"; 60 << "kUseGL has not effect in tests";
61 61
62 bool fallback_to_osmesa = false; 62 bool fallback_to_software_gl = false;
63 bool gpu_service_logging = false; 63 bool gpu_service_logging = false;
64 bool disable_gl_drawing = true; 64 bool disable_gl_drawing = true;
65 65
66 CHECK(init::InitializeGLOneOffImplementation( 66 CHECK(init::InitializeGLOneOffImplementation(
67 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); 67 impl, fallback_to_software_gl, gpu_service_logging, disable_gl_drawing));
68 } 68 }
69 69
70 // static 70 // static
71 void GLSurfaceTestSupport::InitializeOneOffImplementation( 71 void GLSurfaceTestSupport::InitializeOneOffImplementation(
72 GLImplementation impl, 72 GLImplementation impl,
73 bool fallback_to_osmesa) { 73 bool fallback_to_software_gl) {
74 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)) 74 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL))
75 << "kUseGL has not effect in tests"; 75 << "kUseGL has not effect in tests";
76 76
77 // This method may be called multiple times in the same process to set up 77 // This method may be called multiple times in the same process to set up
78 // bindings in different ways. 78 // bindings in different ways.
79 init::ShutdownGL(); 79 init::ShutdownGL();
80 80
81 bool gpu_service_logging = false; 81 bool gpu_service_logging = false;
82 bool disable_gl_drawing = false; 82 bool disable_gl_drawing = false;
83 83
84 CHECK(init::InitializeGLOneOffImplementation( 84 CHECK(init::InitializeGLOneOffImplementation(
85 impl, fallback_to_osmesa, gpu_service_logging, disable_gl_drawing)); 85 impl, fallback_to_software_gl, gpu_service_logging, disable_gl_drawing));
86 } 86 }
87 87
88 // static 88 // static
89 void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() { 89 void GLSurfaceTestSupport::InitializeOneOffWithMockBindings() {
90 #if defined(USE_OZONE) 90 #if defined(USE_OZONE)
91 // This function skips where Ozone is otherwise initialized. 91 // This function skips where Ozone is otherwise initialized.
92 ui::OzonePlatform::InitializeForGPU(); 92 ui::OzonePlatform::InitializeForGPU();
93 #endif 93 #endif
94 InitializeOneOffImplementation(kGLImplementationMockGL, false); 94 InitializeOneOffImplementation(kGLImplementationMockGL, false);
95 } 95 }
96 96
97 void GLSurfaceTestSupport::InitializeOneOffWithStubBindings() { 97 void GLSurfaceTestSupport::InitializeOneOffWithStubBindings() {
98 #if defined(USE_OZONE) 98 #if defined(USE_OZONE)
99 // This function skips where Ozone is otherwise initialized. 99 // This function skips where Ozone is otherwise initialized.
100 ui::OzonePlatform::InitializeForGPU(); 100 ui::OzonePlatform::InitializeForGPU();
101 #endif 101 #endif
102 InitializeOneOffImplementation(kGLImplementationStubGL, false); 102 InitializeOneOffImplementation(kGLImplementationStubGL, false);
103 } 103 }
104 104
105 } // namespace gl 105 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_factory.cc ('k') | ui/views/mus/views_mus_test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698