| 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" | |
| 21 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 22 #include "content/browser/renderer_host/render_process_host_impl.h" | 21 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 23 #include "content/browser/tracing/tracing_controller_impl.h" | 22 #include "content/browser/tracing/tracing_controller_impl.h" |
| 24 #include "content/public/app/content_main.h" | 23 #include "content/public/app/content_main.h" |
| 25 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 27 #include "content/public/common/main_function_params.h" | 26 #include "content/public/common/main_function_params.h" |
| 28 #include "content/public/test/test_launcher.h" | 27 #include "content/public/test/test_launcher.h" |
| 29 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
| 30 #include "content/test/content_browser_sanity_checker.h" | 29 #include "content/test/content_browser_sanity_checker.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 #if defined(OS_POSIX) | 158 #if defined(OS_POSIX) |
| 160 handle_sigterm_ = true; | 159 handle_sigterm_ = true; |
| 161 #endif | 160 #endif |
| 162 | 161 |
| 163 // This is called through base::TestSuite initially. It'll also be called | 162 // This is called through base::TestSuite initially. It'll also be called |
| 164 // inside BrowserMain, so tell the code to ignore the check that it's being | 163 // inside BrowserMain, so tell the code to ignore the check that it's being |
| 165 // called more than once | 164 // called more than once |
| 166 base::i18n::AllowMultipleInitializeCallsForTesting(); | 165 base::i18n::AllowMultipleInitializeCallsForTesting(); |
| 167 | 166 |
| 168 embedded_test_server_.reset(new net::EmbeddedTestServer); | 167 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(); | |
| 176 } | 168 } |
| 177 | 169 |
| 178 BrowserTestBase::~BrowserTestBase() { | 170 BrowserTestBase::~BrowserTestBase() { |
| 179 #if defined(OS_ANDROID) | 171 #if defined(OS_ANDROID) |
| 180 // RemoteTestServer can cause wait on the UI thread. | 172 // RemoteTestServer can cause wait on the UI thread. |
| 181 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 173 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 182 spawned_test_server_.reset(NULL); | 174 spawned_test_server_.reset(NULL); |
| 183 #endif | 175 #endif |
| 184 | 176 |
| 185 CHECK(set_up_called_) << "SetUp was not called. This probably means that the " | 177 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... |
| 396 use_software_compositing_ = true; | 388 use_software_compositing_ = true; |
| 397 } | 389 } |
| 398 | 390 |
| 399 bool BrowserTestBase::UsingOSMesa() const { | 391 bool BrowserTestBase::UsingOSMesa() const { |
| 400 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 392 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 401 return cmd->GetSwitchValueASCII(switches::kUseGL) == | 393 return cmd->GetSwitchValueASCII(switches::kUseGL) == |
| 402 gl::kGLImplementationOSMesaName; | 394 gl::kGLImplementationOSMesaName; |
| 403 } | 395 } |
| 404 | 396 |
| 405 } // namespace content | 397 } // namespace content |
| OLD | NEW |