| 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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 758 |
| 759 // Set up the fake delegate that forces the download to be malicious. | 759 // Set up the fake delegate that forces the download to be malicious. |
| 760 scoped_ptr<TestDownloadManagerDelegate> test_delegate( | 760 scoped_ptr<TestDownloadManagerDelegate> test_delegate( |
| 761 new TestDownloadManagerDelegate(browser()->profile())); | 761 new TestDownloadManagerDelegate(browser()->profile())); |
| 762 DownloadServiceFactory::GetForBrowserContext(browser()->profile()) | 762 DownloadServiceFactory::GetForBrowserContext(browser()->profile()) |
| 763 ->SetDownloadManagerDelegateForTesting(test_delegate.Pass()); | 763 ->SetDownloadManagerDelegateForTesting(test_delegate.Pass()); |
| 764 | 764 |
| 765 // Run a dangerous download, but the user doesn't make a decision. | 765 // Run a dangerous download, but the user doesn't make a decision. |
| 766 // This .swf normally would be categorized as DANGEROUS_FILE, but | 766 // This .swf normally would be categorized as DANGEROUS_FILE, but |
| 767 // TestDownloadManagerDelegate turns it into DANGEROUS_URL. | 767 // TestDownloadManagerDelegate turns it into DANGEROUS_URL. |
| 768 base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf")); | 768 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl( |
| 769 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(file)); | 769 "downloads/dangerous/dangerous.swf")); |
| 770 content::DownloadTestObserverInterrupted observer( | 770 content::DownloadTestObserverInterrupted observer( |
| 771 content::BrowserContext::GetDownloadManager(browser()->profile()), | 771 content::BrowserContext::GetDownloadManager(browser()->profile()), |
| 772 1, | 772 1, |
| 773 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT); | 773 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT); |
| 774 ui_test_utils::NavigateToURLWithDisposition( | 774 ui_test_utils::NavigateToURLWithDisposition( |
| 775 browser(), | 775 browser(), |
| 776 GURL(download_url), | 776 GURL(download_url), |
| 777 NEW_BACKGROUND_TAB, | 777 NEW_BACKGROUND_TAB, |
| 778 ui_test_utils::BROWSER_TEST_NONE); | 778 ui_test_utils::BROWSER_TEST_NONE); |
| 779 observer.WaitForFinished(); | 779 observer.WaitForFinished(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 | 1032 |
| 1033 chrome::CloseAllBrowsers(); | 1033 chrome::CloseAllBrowsers(); |
| 1034 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 1034 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
| 1035 EXPECT_TRUE(chrome::BrowserIterator().done()); | 1035 EXPECT_TRUE(chrome::BrowserIterator().done()); |
| 1036 EXPECT_TRUE(IsBackgroundModeSuspended()); | 1036 EXPECT_TRUE(IsBackgroundModeSuspended()); |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 1039 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 1040 BrowserCloseManagerWithBackgroundModeBrowserTest, | 1040 BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 1041 testing::Bool()); | 1041 testing::Bool()); |
| OLD | NEW |