| OLD | NEW |
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
| 10 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 use_osmesa = false; | 210 use_osmesa = false; |
| 211 #endif | 211 #endif |
| 212 | 212 |
| 213 #if defined(OS_CHROMEOS) | 213 #if defined(OS_CHROMEOS) |
| 214 // If the test is running on the chromeos envrionment (such as | 214 // If the test is running on the chromeos envrionment (such as |
| 215 // device or vm bots), we use hardware GL. | 215 // device or vm bots), we use hardware GL. |
| 216 if (base::SysInfo::IsRunningOnChromeOS()) | 216 if (base::SysInfo::IsRunningOnChromeOS()) |
| 217 use_osmesa = false; | 217 use_osmesa = false; |
| 218 #endif | 218 #endif |
| 219 | 219 |
| 220 if (command_line->HasSwitch(switches::kUseGL)) { | 220 if (use_osmesa && !use_software_compositing_) |
| 221 NOTREACHED() << | 221 command_line->AppendSwitch(switches::kOverrideUseGLWithOSMesaForTests); |
| 222 "kUseGL should not be used with tests. Try kUseGpuInTests instead."; | |
| 223 } | |
| 224 | |
| 225 if (use_osmesa && !use_software_compositing_) { | |
| 226 command_line->AppendSwitchASCII( | |
| 227 switches::kUseGL, gfx::kGLImplementationOSMesaName); | |
| 228 } | |
| 229 | 222 |
| 230 scoped_refptr<net::HostResolverProc> local_resolver = | 223 scoped_refptr<net::HostResolverProc> local_resolver = |
| 231 new LocalHostResolverProc(); | 224 new LocalHostResolverProc(); |
| 232 rule_based_resolver_ = | 225 rule_based_resolver_ = |
| 233 new net::RuleBasedHostResolverProc(local_resolver.get()); | 226 new net::RuleBasedHostResolverProc(local_resolver.get()); |
| 234 rule_based_resolver_->AddSimulatedFailure("wpad"); | 227 rule_based_resolver_->AddSimulatedFailure("wpad"); |
| 235 net::ScopedDefaultHostResolverProc scoped_local_host_resolver_proc( | 228 net::ScopedDefaultHostResolverProc scoped_local_host_resolver_proc( |
| 236 rule_based_resolver_.get()); | 229 rule_based_resolver_.get()); |
| 237 SetUpInProcessBrowserTestFixture(); | 230 SetUpInProcessBrowserTestFixture(); |
| 238 | 231 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 use_software_compositing_ = true; | 298 use_software_compositing_ = true; |
| 306 } | 299 } |
| 307 | 300 |
| 308 bool BrowserTestBase::UsingOSMesa() const { | 301 bool BrowserTestBase::UsingOSMesa() const { |
| 309 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 302 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 310 return cmd->GetSwitchValueASCII(switches::kUseGL) == | 303 return cmd->GetSwitchValueASCII(switches::kUseGL) == |
| 311 gfx::kGLImplementationOSMesaName; | 304 gfx::kGLImplementationOSMesaName; |
| 312 } | 305 } |
| 313 | 306 |
| 314 } // namespace content | 307 } // namespace content |
| OLD | NEW |