| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "chrome/browser/background/background_mode_manager.h" | 9 #include "chrome/browser/background/background_mode_manager.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "content/public/browser/download_item.h" | 36 #include "content/public/browser/download_item.h" |
| 37 #include "content/public/browser/download_manager.h" | 37 #include "content/public/browser/download_manager.h" |
| 38 #include "content/public/browser/notification_service.h" | 38 #include "content/public/browser/notification_service.h" |
| 39 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 40 #include "content/public/test/download_test_observer.h" | 40 #include "content/public/test/download_test_observer.h" |
| 41 #include "content/public/test/test_navigation_observer.h" | 41 #include "content/public/test/test_navigation_observer.h" |
| 42 #include "content/test/net/url_request_mock_http_job.h" | 42 #include "content/test/net/url_request_mock_http_job.h" |
| 43 #include "content/test/net/url_request_slow_download_job.h" | 43 #include "content/test/net/url_request_slow_download_job.h" |
| 44 #include "net/test/embedded_test_server/embedded_test_server.h" | 44 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 45 | 45 |
| 46 #if defined(OS_CHROMEOS) |
| 47 #include "chromeos/chromeos_switches.h" |
| 48 #endif |
| 49 |
| 46 namespace { | 50 namespace { |
| 47 | 51 |
| 48 class AppModalDialogObserver { | 52 class AppModalDialogObserver { |
| 49 public: | 53 public: |
| 50 AppModalDialogObserver() {} | 54 AppModalDialogObserver() {} |
| 51 | 55 |
| 52 void Start() { | 56 void Start() { |
| 53 observer_.reset(new content::WindowedNotificationObserver( | 57 observer_.reset(new content::WindowedNotificationObserver( |
| 54 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, | 58 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, |
| 55 content::NotificationService::AllSources())); | 59 content::NotificationService::AllSources())); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 dialogs_.Start(); | 245 dialogs_.Start(); |
| 242 content::BrowserThread::PostTask( | 246 content::BrowserThread::PostTask( |
| 243 content::BrowserThread::IO, | 247 content::BrowserThread::IO, |
| 244 FROM_HERE, | 248 FROM_HERE, |
| 245 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 249 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
| 246 } | 250 } |
| 247 | 251 |
| 248 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 252 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 249 if (GetParam()) | 253 if (GetParam()) |
| 250 command_line->AppendSwitch(switches::kEnableFastUnload); | 254 command_line->AppendSwitch(switches::kEnableFastUnload); |
| 255 #if defined(OS_CHROMEOS) |
| 256 command_line->AppendSwitch( |
| 257 chromeos::switches::kIgnoreUserProfileMappingForTests); |
| 258 #endif |
| 251 } | 259 } |
| 252 | 260 |
| 253 void CreateStalledDownload(Browser* browser) { | 261 void CreateStalledDownload(Browser* browser) { |
| 254 content::DownloadTestObserverInProgress observer( | 262 content::DownloadTestObserverInProgress observer( |
| 255 content::BrowserContext::GetDownloadManager(browser->profile()), 1); | 263 content::BrowserContext::GetDownloadManager(browser->profile()), 1); |
| 256 ui_test_utils::NavigateToURLWithDisposition( | 264 ui_test_utils::NavigateToURLWithDisposition( |
| 257 browser, | 265 browser, |
| 258 GURL(content::URLRequestSlowDownloadJob::kKnownSizeUrl), | 266 GURL(content::URLRequestSlowDownloadJob::kKnownSizeUrl), |
| 259 NEW_BACKGROUND_TAB, | 267 NEW_BACKGROUND_TAB, |
| 260 ui_test_utils::BROWSER_TEST_NONE); | 268 ui_test_utils::BROWSER_TEST_NONE); |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 | 977 |
| 970 chrome::CloseAllBrowsers(); | 978 chrome::CloseAllBrowsers(); |
| 971 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 979 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
| 972 EXPECT_TRUE(chrome::BrowserIterator().done()); | 980 EXPECT_TRUE(chrome::BrowserIterator().done()); |
| 973 EXPECT_TRUE(IsBackgroundModeSuspended()); | 981 EXPECT_TRUE(IsBackgroundModeSuspended()); |
| 974 } | 982 } |
| 975 | 983 |
| 976 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 984 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 977 BrowserCloseManagerWithBackgroundModeBrowserTest, | 985 BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 978 testing::Bool()); | 986 testing::Bool()); |
| OLD | NEW |