| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/test/test_file_util.h" | 19 #include "base/test/test_file_util.h" |
| 20 #include "base/threading/thread_task_runner_handle.h" | 20 #include "base/threading/thread_task_runner_handle.h" |
| 21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
| 22 #include "chrome/browser/after_startup_task_utils.h" | 22 #include "chrome/browser/after_startup_task_utils.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/chrome_content_browser_client.h" | 24 #include "chrome/browser/chrome_content_browser_client.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/devtools/devtools_window.h" | 26 #include "chrome/browser/devtools/devtools_window.h" |
| 27 #include "chrome/browser/lifetime/application_lifetime.h" | 27 #include "chrome/browser/lifetime/application_lifetime.h" |
| 28 #include "chrome/browser/lifetime/termination_notification.h" | 28 #include "chrome/browser/lifetime/termination_notification.h" |
| 29 #include "chrome/browser/net/chrome_network_delegate.h" |
| 29 #include "chrome/browser/net/net_error_tab_helper.h" | 30 #include "chrome/browser/net/net_error_tab_helper.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
| 32 #include "chrome/browser/ui/browser.h" | 33 #include "chrome/browser/ui/browser.h" |
| 33 #include "chrome/browser/ui/browser_commands.h" | 34 #include "chrome/browser/ui/browser_commands.h" |
| 34 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
| 35 #include "chrome/browser/ui/browser_list.h" | 36 #include "chrome/browser/ui/browser_list.h" |
| 36 #include "chrome/browser/ui/browser_list_observer.h" | 37 #include "chrome/browser/ui/browser_list_observer.h" |
| 37 #include "chrome/browser/ui/browser_navigator.h" | 38 #include "chrome/browser/ui/browser_navigator.h" |
| 38 #include "chrome/browser/ui/browser_navigator_params.h" | 39 #include "chrome/browser/ui/browser_navigator_params.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 248 |
| 248 chrome_browser_net::NetErrorTabHelper::set_state_for_testing( | 249 chrome_browser_net::NetErrorTabHelper::set_state_for_testing( |
| 249 chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED); | 250 chrome_browser_net::NetErrorTabHelper::TESTING_FORCE_DISABLED); |
| 250 | 251 |
| 251 google_util::SetMockLinkDoctorBaseURLForTesting(); | 252 google_util::SetMockLinkDoctorBaseURLForTesting(); |
| 252 | 253 |
| 253 #if defined(OS_CHROMEOS) | 254 #if defined(OS_CHROMEOS) |
| 254 // Polymer Elements are used for quick unlock configuration in options page, | 255 // Polymer Elements are used for quick unlock configuration in options page, |
| 255 // which is chromeos specific feature. | 256 // which is chromeos specific feature. |
| 256 options::BrowserOptionsHandler::DisablePolymerPreloadForTesting(); | 257 options::BrowserOptionsHandler::DisablePolymerPreloadForTesting(); |
| 258 // On Chrome OS, access to files via file: scheme is restricted. Enable |
| 259 // access to all files here since browser_tests and interactive_ui_tests |
| 260 // rely on the ability to open any files via file: scheme. |
| 261 ChromeNetworkDelegate::EnableAccessToAllFilesForTesting(true); |
| 257 #endif // defined(OS_CHROMEOS) | 262 #endif // defined(OS_CHROMEOS) |
| 258 | 263 |
| 259 // Use hardcoded quota settings to have a consistent testing environment. | 264 // Use hardcoded quota settings to have a consistent testing environment. |
| 260 const int kQuota = 5 * 1024 * 1024; | 265 const int kQuota = 5 * 1024 * 1024; |
| 261 quota_settings_ = storage::QuotaSettings(kQuota * 5, kQuota, 0, 0); | 266 quota_settings_ = storage::QuotaSettings(kQuota * 5, kQuota, 0, 0); |
| 262 ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 267 ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
| 263 "a_settings_); | 268 "a_settings_); |
| 264 | 269 |
| 265 BrowserTestBase::SetUp(); | 270 BrowserTestBase::SetUp(); |
| 266 } | 271 } |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 // On the Mac, this eventually reaches | 627 // On the Mac, this eventually reaches |
| 623 // -[BrowserWindowController windowWillClose:], which will post a deferred | 628 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 624 // -autorelease on itself to ultimately destroy the Browser object. The line | 629 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 625 // below is necessary to pump these pending messages to ensure all Browsers | 630 // below is necessary to pump these pending messages to ensure all Browsers |
| 626 // get deleted. | 631 // get deleted. |
| 627 content::RunAllPendingInMessageLoop(); | 632 content::RunAllPendingInMessageLoop(); |
| 628 delete autorelease_pool_; | 633 delete autorelease_pool_; |
| 629 autorelease_pool_ = NULL; | 634 autorelease_pool_ = NULL; |
| 630 #endif | 635 #endif |
| 631 } | 636 } |
| OLD | NEW |