| 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 <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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace | 141 } // namespace |
| 142 | 142 |
| 143 extern int BrowserMain(const MainFunctionParams&); | 143 extern int BrowserMain(const MainFunctionParams&); |
| 144 | 144 |
| 145 BrowserTestBase::BrowserTestBase() | 145 BrowserTestBase::BrowserTestBase() |
| 146 : expected_exit_code_(0), | 146 : expected_exit_code_(0), |
| 147 enable_pixel_output_(false), | 147 enable_pixel_output_(false), |
| 148 use_software_compositing_(false), | 148 use_software_compositing_(false), |
| 149 allow_file_access_from_files_(true), |
| 149 set_up_called_(false) { | 150 set_up_called_(false) { |
| 150 #if defined(OS_MACOSX) | 151 #if defined(OS_MACOSX) |
| 151 base::mac::SetOverrideAmIBundled(true); | 152 base::mac::SetOverrideAmIBundled(true); |
| 152 #endif | 153 #endif |
| 153 | 154 |
| 154 #if defined(USE_AURA) && defined(USE_X11) | 155 #if defined(USE_AURA) && defined(USE_X11) |
| 155 aura::test::SetUseOverrideRedirectWindowByDefault(true); | 156 aura::test::SetUseOverrideRedirectWindowByDefault(true); |
| 156 #endif | 157 #endif |
| 157 | 158 |
| 158 #if defined(OS_POSIX) | 159 #if defined(OS_POSIX) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 188 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); | 189 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); |
| 189 | 190 |
| 190 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 191 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 191 | 192 |
| 192 // Override the child process connection timeout since tests can exceed that | 193 // Override the child process connection timeout since tests can exceed that |
| 193 // when sharded. | 194 // when sharded. |
| 194 command_line->AppendSwitchASCII( | 195 command_line->AppendSwitchASCII( |
| 195 switches::kIPCConnectionTimeout, | 196 switches::kIPCConnectionTimeout, |
| 196 base::Int64ToString(TestTimeouts::action_max_timeout().InSeconds())); | 197 base::Int64ToString(TestTimeouts::action_max_timeout().InSeconds())); |
| 197 | 198 |
| 198 // The tests assume that file:// URIs can freely access other file:// URIs. | 199 // Many tests load their pages via file://, so we enable it by default, unless |
| 199 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); | 200 // the test called RevokeFileAccessFromFiles() to return to the normal |
| 201 // behavior. |
| 202 if (allow_file_access_from_files_) |
| 203 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); |
| 200 | 204 |
| 201 command_line->AppendSwitch(switches::kDomAutomationController); | 205 command_line->AppendSwitch(switches::kDomAutomationController); |
| 202 | 206 |
| 203 // It is sometimes useful when looking at browser test failures to know which | 207 // It is sometimes useful when looking at browser test failures to know which |
| 204 // GPU blacklisting decisions were made. | 208 // GPU blacklisting decisions were made. |
| 205 command_line->AppendSwitch(switches::kLogGpuControlListDecisions); | 209 command_line->AppendSwitch(switches::kLogGpuControlListDecisions); |
| 206 | 210 |
| 207 if (use_software_compositing_) | 211 if (use_software_compositing_) |
| 208 command_line->AppendSwitch(switches::kDisableGpu); | 212 command_line->AppendSwitch(switches::kDisableGpu); |
| 209 | 213 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); | 385 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); |
| 382 runner->Run(); | 386 runner->Run(); |
| 383 } | 387 } |
| 384 | 388 |
| 385 void BrowserTestBase::EnablePixelOutput() { enable_pixel_output_ = true; } | 389 void BrowserTestBase::EnablePixelOutput() { enable_pixel_output_ = true; } |
| 386 | 390 |
| 387 void BrowserTestBase::UseSoftwareCompositing() { | 391 void BrowserTestBase::UseSoftwareCompositing() { |
| 388 use_software_compositing_ = true; | 392 use_software_compositing_ = true; |
| 389 } | 393 } |
| 390 | 394 |
| 395 void BrowserTestBase::RevokeFileAccessFromFiles() { |
| 396 allow_file_access_from_files_ = false; |
| 397 } |
| 398 |
| 391 bool BrowserTestBase::UsingOSMesa() const { | 399 bool BrowserTestBase::UsingOSMesa() const { |
| 392 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 400 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 393 return cmd->GetSwitchValueASCII(switches::kUseGL) == | 401 return cmd->GetSwitchValueASCII(switches::kUseGL) == |
| 394 gl::kGLImplementationOSMesaName; | 402 gl::kGLImplementationOSMesaName; |
| 395 } | 403 } |
| 396 | 404 |
| 397 } // namespace content | 405 } // namespace content |
| OLD | NEW |