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" |
11 #include "base/debug/stack_trace.h" | 11 #include "base/debug/stack_trace.h" |
12 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
13 #include "base/i18n/icu_util.h" | 13 #include "base/i18n/icu_util.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
18 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
19 #include "base/test/test_timeouts.h" | 19 #include "base/test/test_timeouts.h" |
| 20 #include "base/threading/sequenced_worker_pool.h" |
20 #include "build/build_config.h" | 21 #include "build/build_config.h" |
21 #include "content/browser/renderer_host/render_process_host_impl.h" | 22 #include "content/browser/renderer_host/render_process_host_impl.h" |
22 #include "content/browser/tracing/tracing_controller_impl.h" | 23 #include "content/browser/tracing/tracing_controller_impl.h" |
23 #include "content/public/app/content_main.h" | 24 #include "content/public/app/content_main.h" |
24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
26 #include "content/public/common/main_function_params.h" | 27 #include "content/public/common/main_function_params.h" |
27 #include "content/public/test/test_launcher.h" | 28 #include "content/public/test/test_launcher.h" |
28 #include "content/public/test/test_utils.h" | 29 #include "content/public/test/test_utils.h" |
29 #include "content/test/content_browser_sanity_checker.h" | 30 #include "content/test/content_browser_sanity_checker.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 #if defined(OS_POSIX) | 159 #if defined(OS_POSIX) |
159 handle_sigterm_ = true; | 160 handle_sigterm_ = true; |
160 #endif | 161 #endif |
161 | 162 |
162 // This is called through base::TestSuite initially. It'll also be called | 163 // This is called through base::TestSuite initially. It'll also be called |
163 // inside BrowserMain, so tell the code to ignore the check that it's being | 164 // inside BrowserMain, so tell the code to ignore the check that it's being |
164 // called more than once | 165 // called more than once |
165 base::i18n::AllowMultipleInitializeCallsForTesting(); | 166 base::i18n::AllowMultipleInitializeCallsForTesting(); |
166 | 167 |
167 embedded_test_server_.reset(new net::EmbeddedTestServer); | 168 embedded_test_server_.reset(new net::EmbeddedTestServer); |
| 169 |
| 170 // SequencedWorkerPool is enabled by default in tests (see |
| 171 // base::TestSuite::Initialize). In browser tests, disable it and expect it |
| 172 // to be re-enabled as part of BrowserMainLoop::PreCreateThreads(). |
| 173 // TODO(fdoray): Remove this once the SequencedWorkerPool to TaskScheduler |
| 174 // redirection experiment concludes https://crbug.com/622400. |
| 175 base::SequencedWorkerPool::DisableForProcessForTesting(); |
168 } | 176 } |
169 | 177 |
170 BrowserTestBase::~BrowserTestBase() { | 178 BrowserTestBase::~BrowserTestBase() { |
171 #if defined(OS_ANDROID) | 179 #if defined(OS_ANDROID) |
172 // RemoteTestServer can cause wait on the UI thread. | 180 // RemoteTestServer can cause wait on the UI thread. |
173 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 181 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
174 spawned_test_server_.reset(NULL); | 182 spawned_test_server_.reset(NULL); |
175 #endif | 183 #endif |
176 | 184 |
177 CHECK(set_up_called_) << "SetUp was not called. This probably means that the " | 185 CHECK(set_up_called_) << "SetUp was not called. This probably means that the " |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 use_software_compositing_ = true; | 396 use_software_compositing_ = true; |
389 } | 397 } |
390 | 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 |