| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 65 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 66 #include "chrome/browser/captive_portal/captive_portal_service.h" | 66 #include "chrome/browser/captive_portal/captive_portal_service.h" |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 69 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 70 #include "components/storage_monitor/test_storage_monitor.h" | 70 #include "components/storage_monitor/test_storage_monitor.h" |
| 71 #endif | 71 #endif |
| 72 | 72 |
| 73 #if defined(OS_CHROMEOS) |
| 74 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 75 #endif |
| 76 |
| 73 namespace { | 77 namespace { |
| 74 | 78 |
| 75 // Passed as value of kTestType. | 79 // Passed as value of kTestType. |
| 76 const char kBrowserTestType[] = "browser"; | 80 const char kBrowserTestType[] = "browser"; |
| 77 | 81 |
| 78 // A BrowserListObserver that makes sure that all browsers created are on the | 82 // A BrowserListObserver that makes sure that all browsers created are on the |
| 79 // |allowed_desktop_|. | 83 // |allowed_desktop_|. |
| 80 class SingleDesktopTestObserver : public chrome::BrowserListObserver, | 84 class SingleDesktopTestObserver : public chrome::BrowserListObserver, |
| 81 public base::NonThreadSafe { | 85 public base::NonThreadSafe { |
| 82 public: | 86 public: |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 173 |
| 170 // Allow subclasses the opportunity to make changes to the default user data | 174 // Allow subclasses the opportunity to make changes to the default user data |
| 171 // dir before running any tests. | 175 // dir before running any tests. |
| 172 ASSERT_TRUE(SetUpUserDataDirectory()) | 176 ASSERT_TRUE(SetUpUserDataDirectory()) |
| 173 << "Could not set up user data directory."; | 177 << "Could not set up user data directory."; |
| 174 | 178 |
| 175 #if defined(OS_CHROMEOS) | 179 #if defined(OS_CHROMEOS) |
| 176 // Make sure that the log directory exists. | 180 // Make sure that the log directory exists. |
| 177 base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); | 181 base::FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); |
| 178 base::CreateDirectory(log_dir); | 182 base::CreateDirectory(log_dir); |
| 183 // Disable IME extension loading to avoid many browser tests failures. |
| 184 chromeos::input_method::DisableExtensionLoading(); |
| 179 #endif // defined(OS_CHROMEOS) | 185 #endif // defined(OS_CHROMEOS) |
| 180 | 186 |
| 181 #if defined(OS_MACOSX) | 187 #if defined(OS_MACOSX) |
| 182 // Always use the MockKeychain if OS encription is used (which is when | 188 // Always use the MockKeychain if OS encription is used (which is when |
| 183 // anything sensitive gets stored, including Cookies). Without this, | 189 // anything sensitive gets stored, including Cookies). Without this, |
| 184 // many tests will hang waiting for a user to approve KeyChain access. | 190 // many tests will hang waiting for a user to approve KeyChain access. |
| 185 OSCrypt::UseMockKeychain(true); | 191 OSCrypt::UseMockKeychain(true); |
| 186 #endif | 192 #endif |
| 187 | 193 |
| 188 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 194 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 // On the Mac, this eventually reaches | 479 // On the Mac, this eventually reaches |
| 474 // -[BrowserWindowController windowWillClose:], which will post a deferred | 480 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 475 // -autorelease on itself to ultimately destroy the Browser object. The line | 481 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 476 // below is necessary to pump these pending messages to ensure all Browsers | 482 // below is necessary to pump these pending messages to ensure all Browsers |
| 477 // get deleted. | 483 // get deleted. |
| 478 content::RunAllPendingInMessageLoop(); | 484 content::RunAllPendingInMessageLoop(); |
| 479 delete autorelease_pool_; | 485 delete autorelease_pool_; |
| 480 autorelease_pool_ = NULL; | 486 autorelease_pool_ = NULL; |
| 481 #endif | 487 #endif |
| 482 } | 488 } |
| OLD | NEW |