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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 | 732 |
733 // Test shutdown with a DANGEROUS_URL download undecided. | 733 // Test shutdown with a DANGEROUS_URL download undecided. |
734 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest, | 734 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest, |
735 TestWithDangerousUrlDownload) { | 735 TestWithDangerousUrlDownload) { |
736 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 736 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
737 SetDownloadPathForProfile(browser()->profile()); | 737 SetDownloadPathForProfile(browser()->profile()); |
738 | 738 |
739 // Set up the fake delegate that forces the download to be malicious. | 739 // Set up the fake delegate that forces the download to be malicious. |
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(test_delegate.Pass()); |
744 test_delegate.PassAs<ChromeDownloadManagerDelegate>()); | |
745 | 744 |
746 // Run a dangerous download, but the user doesn't make a decision. | 745 // Run a dangerous download, but the user doesn't make a decision. |
747 // This .swf normally would be categorized as DANGEROUS_FILE, but | 746 // This .swf normally would be categorized as DANGEROUS_FILE, but |
748 // TestDownloadManagerDelegate turns it into DANGEROUS_URL. | 747 // TestDownloadManagerDelegate turns it into DANGEROUS_URL. |
749 base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf")); | 748 base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf")); |
750 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(file)); | 749 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(file)); |
751 content::DownloadTestObserverInterrupted observer( | 750 content::DownloadTestObserverInterrupted observer( |
752 content::BrowserContext::GetDownloadManager(browser()->profile()), | 751 content::BrowserContext::GetDownloadManager(browser()->profile()), |
753 1, | 752 1, |
754 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT); | 753 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 | 976 |
978 chrome::CloseAllBrowsers(); | 977 chrome::CloseAllBrowsers(); |
979 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 978 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
980 EXPECT_TRUE(chrome::BrowserIterator().done()); | 979 EXPECT_TRUE(chrome::BrowserIterator().done()); |
981 EXPECT_TRUE(IsBackgroundModeSuspended()); | 980 EXPECT_TRUE(IsBackgroundModeSuspended()); |
982 } | 981 } |
983 | 982 |
984 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 983 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
985 BrowserCloseManagerWithBackgroundModeBrowserTest, | 984 BrowserCloseManagerWithBackgroundModeBrowserTest, |
986 testing::Bool()); | 985 testing::Bool()); |
OLD | NEW |