| 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 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "chrome/test/base/in_process_browser_test.h" | 33 #include "chrome/test/base/in_process_browser_test.h" |
| 34 #include "chrome/test/base/ui_test_utils.h" | 34 #include "chrome/test/base/ui_test_utils.h" |
| 35 #include "content/public/browser/browser_context.h" | 35 #include "content/public/browser/browser_context.h" |
| 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" | |
| 43 #include "content/test/net/url_request_slow_download_job.h" | 42 #include "content/test/net/url_request_slow_download_job.h" |
| 44 #include "net/test/embedded_test_server/embedded_test_server.h" | 43 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 44 #include "net/test/url_request/url_request_mock_http_job.h" |
| 45 | 45 |
| 46 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
| 47 #include "chromeos/chromeos_switches.h" | 47 #include "chromeos/chromeos_switches.h" |
| 48 #endif | 48 #endif |
| 49 | 49 |
| 50 namespace { | 50 namespace { |
| 51 | 51 |
| 52 class AppModalDialogObserver { | 52 class AppModalDialogObserver { |
| 53 public: | 53 public: |
| 54 AppModalDialogObserver() {} | 54 AppModalDialogObserver() {} |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 scoped_ptr<TestDownloadManagerDelegate> test_delegate( | 740 scoped_ptr<TestDownloadManagerDelegate> test_delegate( |
| 741 new TestDownloadManagerDelegate(browser()->profile())); | 741 new TestDownloadManagerDelegate(browser()->profile())); |
| 742 DownloadServiceFactory::GetForBrowserContext(browser()->profile())-> | 742 DownloadServiceFactory::GetForBrowserContext(browser()->profile())-> |
| 743 SetDownloadManagerDelegateForTesting( | 743 SetDownloadManagerDelegateForTesting( |
| 744 test_delegate.PassAs<ChromeDownloadManagerDelegate>()); | 744 test_delegate.PassAs<ChromeDownloadManagerDelegate>()); |
| 745 | 745 |
| 746 // Run a dangerous download, but the user doesn't make a decision. | 746 // Run a dangerous download, but the user doesn't make a decision. |
| 747 // This .swf normally would be categorized as DANGEROUS_FILE, but | 747 // This .swf normally would be categorized as DANGEROUS_FILE, but |
| 748 // TestDownloadManagerDelegate turns it into DANGEROUS_URL. | 748 // TestDownloadManagerDelegate turns it into DANGEROUS_URL. |
| 749 base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf")); | 749 base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf")); |
| 750 GURL download_url(content::URLRequestMockHTTPJob::GetMockUrl(file)); | 750 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(file)); |
| 751 content::DownloadTestObserverInterrupted observer( | 751 content::DownloadTestObserverInterrupted observer( |
| 752 content::BrowserContext::GetDownloadManager(browser()->profile()), | 752 content::BrowserContext::GetDownloadManager(browser()->profile()), |
| 753 1, | 753 1, |
| 754 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT); | 754 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT); |
| 755 ui_test_utils::NavigateToURLWithDisposition( | 755 ui_test_utils::NavigateToURLWithDisposition( |
| 756 browser(), | 756 browser(), |
| 757 GURL(download_url), | 757 GURL(download_url), |
| 758 NEW_BACKGROUND_TAB, | 758 NEW_BACKGROUND_TAB, |
| 759 ui_test_utils::BROWSER_TEST_NONE); | 759 ui_test_utils::BROWSER_TEST_NONE); |
| 760 observer.WaitForFinished(); | 760 observer.WaitForFinished(); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 | 977 |
| 978 chrome::CloseAllBrowsers(); | 978 chrome::CloseAllBrowsers(); |
| 979 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 979 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
| 980 EXPECT_TRUE(chrome::BrowserIterator().done()); | 980 EXPECT_TRUE(chrome::BrowserIterator().done()); |
| 981 EXPECT_TRUE(IsBackgroundModeSuspended()); | 981 EXPECT_TRUE(IsBackgroundModeSuspended()); |
| 982 } | 982 } |
| 983 | 983 |
| 984 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 984 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 985 BrowserCloseManagerWithBackgroundModeBrowserTest, | 985 BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 986 testing::Bool()); | 986 testing::Bool()); |
| OLD | NEW |