| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 virtual ~LocalHostResolverProc() {} | 118 virtual ~LocalHostResolverProc() {} |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 extern int BrowserMain(const MainFunctionParams&); | 123 extern int BrowserMain(const MainFunctionParams&); |
| 124 | 124 |
| 125 BrowserTestBase::BrowserTestBase() | 125 BrowserTestBase::BrowserTestBase() |
| 126 : enable_pixel_output_(false), use_software_compositing_(false) { | 126 : expected_exit_code_(0), |
| 127 enable_pixel_output_(false), |
| 128 use_software_compositing_(false) { |
| 127 #if defined(OS_MACOSX) | 129 #if defined(OS_MACOSX) |
| 128 base::mac::SetOverrideAmIBundled(true); | 130 base::mac::SetOverrideAmIBundled(true); |
| 129 #endif | 131 #endif |
| 130 | 132 |
| 131 #if defined(USE_AURA) && defined(USE_X11) | 133 #if defined(USE_AURA) && defined(USE_X11) |
| 132 aura::test::SetUseOverrideRedirectWindowByDefault(true); | 134 aura::test::SetUseOverrideRedirectWindowByDefault(true); |
| 133 #endif | 135 #endif |
| 134 | 136 |
| 135 #if defined(OS_POSIX) | 137 #if defined(OS_POSIX) |
| 136 handle_sigterm_ = true; | 138 handle_sigterm_ = true; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 rule_based_resolver_.get()); | 231 rule_based_resolver_.get()); |
| 230 SetUpInProcessBrowserTestFixture(); | 232 SetUpInProcessBrowserTestFixture(); |
| 231 | 233 |
| 232 base::Closure* ui_task = | 234 base::Closure* ui_task = |
| 233 new base::Closure( | 235 new base::Closure( |
| 234 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); | 236 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); |
| 235 | 237 |
| 236 #if defined(OS_ANDROID) | 238 #if defined(OS_ANDROID) |
| 237 MainFunctionParams params(*command_line); | 239 MainFunctionParams params(*command_line); |
| 238 params.ui_task = ui_task; | 240 params.ui_task = ui_task; |
| 241 // TODO(phajdan.jr): Check return code, http://crbug.com/374738 . |
| 239 BrowserMainRunner::Create()->Initialize(params); | 242 BrowserMainRunner::Create()->Initialize(params); |
| 240 // We are done running the test by now. During teardown we | 243 // We are done running the test by now. During teardown we |
| 241 // need to be able to perform IO. | 244 // need to be able to perform IO. |
| 242 base::ThreadRestrictions::SetIOAllowed(true); | 245 base::ThreadRestrictions::SetIOAllowed(true); |
| 243 BrowserThread::PostTask( | 246 BrowserThread::PostTask( |
| 244 BrowserThread::IO, FROM_HERE, | 247 BrowserThread::IO, FROM_HERE, |
| 245 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), | 248 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), |
| 246 true)); | 249 true)); |
| 247 #else | 250 #else |
| 248 GetContentMainParams()->ui_task = ui_task; | 251 GetContentMainParams()->ui_task = ui_task; |
| 249 ContentMain(*GetContentMainParams()); | 252 EXPECT_EQ(expected_exit_code_, ContentMain(*GetContentMainParams())); |
| 250 #endif | 253 #endif |
| 251 TearDownInProcessBrowserTestFixture(); | 254 TearDownInProcessBrowserTestFixture(); |
| 252 } | 255 } |
| 253 | 256 |
| 254 void BrowserTestBase::TearDown() { | 257 void BrowserTestBase::TearDown() { |
| 255 } | 258 } |
| 256 | 259 |
| 257 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { | 260 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { |
| 258 #if defined(OS_POSIX) | 261 #if defined(OS_POSIX) |
| 259 if (handle_sigterm_) { | 262 if (handle_sigterm_) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 use_software_compositing_ = true; | 301 use_software_compositing_ = true; |
| 299 } | 302 } |
| 300 | 303 |
| 301 bool BrowserTestBase::UsingOSMesa() const { | 304 bool BrowserTestBase::UsingOSMesa() const { |
| 302 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 305 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 303 return cmd->GetSwitchValueASCII(switches::kUseGL) == | 306 return cmd->GetSwitchValueASCII(switches::kUseGL) == |
| 304 gfx::kGLImplementationOSMesaName; | 307 gfx::kGLImplementationOSMesaName; |
| 305 } | 308 } |
| 306 | 309 |
| 307 } // namespace content | 310 } // namespace content |
| OLD | NEW |