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

Side by Side Diff: content/public/test/browser_test_base.cc

Issue 2690113010: Abstract OSMesa from the Layout tests (Closed)
Patch Set: Fixed test code 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/public/test/browser_test_base.h" 5 #include "content/public/test/browser_test_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 229 }
230 230
231 // Don't enable pixel output for browser tests unless they override and force 231 // Don't enable pixel output for browser tests unless they override and force
232 // us to, or it's requested on the command line. 232 // us to, or it's requested on the command line.
233 if (!enable_pixel_output_ && !use_software_compositing_) 233 if (!enable_pixel_output_ && !use_software_compositing_)
234 command_line->AppendSwitch(switches::kDisableGLDrawingForTests); 234 command_line->AppendSwitch(switches::kDisableGLDrawingForTests);
235 235
236 aura::test::InitializeAuraEventGeneratorDelegate(); 236 aura::test::InitializeAuraEventGeneratorDelegate();
237 #endif 237 #endif
238 238
239 bool use_osmesa = true; 239 bool use_software_renderer = true;
Ken Russell (switch to Gerrit) 2017/02/15 02:32:15 Let's call this use_software_gl.
240 240
241 // We usually use OSMesa as this works on all bots. The command line can 241 // We usually use a software renderer as this works on all bots. The command
242 // override this behaviour to use hardware GL. 242 // line can override this behaviour to use hardware GL.
243 if (command_line->HasSwitch(switches::kUseGpuInTests)) 243 if (command_line->HasSwitch(switches::kUseGpuInTests))
244 use_osmesa = false; 244 use_software_renderer = false;
245 245
246 // Some bots pass this flag when they want to use hardware GL. 246 // Some bots pass this flag when they want to use hardware GL.
247 if (command_line->HasSwitch("enable-gpu")) 247 if (command_line->HasSwitch("enable-gpu"))
248 use_osmesa = false; 248 use_software_renderer = false;
249 249
250 #if defined(OS_MACOSX) 250 #if defined(OS_MACOSX)
251 // On Mac we always use hardware GL. 251 // On Mac we always use hardware GL.
252 use_osmesa = false; 252 use_software_renderer = false;
253 #endif 253 #endif
254 254
255 #if defined(OS_ANDROID) 255 #if defined(OS_ANDROID)
256 // On Android we always use hardware GL. 256 // On Android we always use hardware GL.
257 use_osmesa = false; 257 use_software_renderer = false;
258 #endif 258 #endif
259 259
260 #if defined(OS_CHROMEOS) 260 #if defined(OS_CHROMEOS)
261 // If the test is running on the chromeos envrionment (such as 261 // If the test is running on the chromeos envrionment (such as
262 // device or vm bots), we use hardware GL. 262 // device or vm bots), we use hardware GL.
263 if (base::SysInfo::IsRunningOnChromeOS()) 263 if (base::SysInfo::IsRunningOnChromeOS())
264 use_osmesa = false; 264 use_software_renderer = false;
265 #endif 265 #endif
266 266
267 if (use_osmesa && !use_software_compositing_) 267 if (use_software_renderer && !use_software_compositing_)
268 command_line->AppendSwitch(switches::kOverrideUseGLWithOSMesaForTests); 268 command_line->AppendSwitch(switches::kOverrideUseSoftwareGLForTests);
269 269
270 scoped_refptr<net::HostResolverProc> local_resolver = 270 scoped_refptr<net::HostResolverProc> local_resolver =
271 new LocalHostResolverProc(); 271 new LocalHostResolverProc();
272 rule_based_resolver_ = 272 rule_based_resolver_ =
273 new net::RuleBasedHostResolverProc(local_resolver.get()); 273 new net::RuleBasedHostResolverProc(local_resolver.get());
274 rule_based_resolver_->AddSimulatedFailure("wpad"); 274 rule_based_resolver_->AddSimulatedFailure("wpad");
275 net::ScopedDefaultHostResolverProc scoped_local_host_resolver_proc( 275 net::ScopedDefaultHostResolverProc scoped_local_host_resolver_proc(
276 rule_based_resolver_.get()); 276 rule_based_resolver_.get());
277 277
278 ContentBrowserSanityChecker scoped_enable_sanity_checks; 278 ContentBrowserSanityChecker scoped_enable_sanity_checks;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); 392 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure()));
393 runner->Run(); 393 runner->Run();
394 } 394 }
395 395
396 void BrowserTestBase::EnablePixelOutput() { enable_pixel_output_ = true; } 396 void BrowserTestBase::EnablePixelOutput() { enable_pixel_output_ = true; }
397 397
398 void BrowserTestBase::UseSoftwareCompositing() { 398 void BrowserTestBase::UseSoftwareCompositing() {
399 use_software_compositing_ = true; 399 use_software_compositing_ = true;
400 } 400 }
401 401
402 bool BrowserTestBase::UsingOSMesa() const { 402 bool BrowserTestBase::UsingSoftwareRenderer() const {
403 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 403 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
404 return cmd->GetSwitchValueASCII(switches::kUseGL) == 404 return cmd->GetSwitchValueASCII(switches::kUseGL) ==
405 gl::kGLImplementationOSMesaName; 405 gl::GetGLImplementationName(gl::GetSoftwareGLImplementation());
406 } 406 }
407 407
408 } // namespace content 408 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698