| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/download/download_prefs.h" | 7 #include "chrome/browser/download/download_prefs.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/safe_browsing/download_protection_service.h" | 9 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Set up default download path. | 130 // Set up default download path. |
| 131 browser()->profile()->GetPrefs()->SetFilePath( | 131 browser()->profile()->GetPrefs()->SetFilePath( |
| 132 prefs::kDownloadDefaultDirectory, downloads_directory_.GetPath()); | 132 prefs::kDownloadDefaultDirectory, downloads_directory_.GetPath()); |
| 133 browser()->profile()->GetPrefs()->SetFilePath( | 133 browser()->profile()->GetPrefs()->SetFilePath( |
| 134 prefs::kSaveFileDefaultDirectory, downloads_directory_.GetPath()); | 134 prefs::kSaveFileDefaultDirectory, downloads_directory_.GetPath()); |
| 135 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPromptForDownload, | 135 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPromptForDownload, |
| 136 false); | 136 false); |
| 137 content::DownloadManager* manager = | 137 content::DownloadManager* manager = |
| 138 content::BrowserContext::GetDownloadManager(browser()->profile()); | 138 content::BrowserContext::GetDownloadManager(browser()->profile()); |
| 139 DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen(); | 139 DownloadPrefs::FromDownloadManager(manager)->ResetAutoOpen(); |
| 140 manager->RemoveAllDownloads(); | |
| 141 | 140 |
| 142 return true; | 141 return true; |
| 143 } | 142 } |
| 144 | 143 |
| 145 void TearDownOnMainThread() override { | 144 void TearDownOnMainThread() override { |
| 146 // Cancel unfinished download if any. | 145 // Cancel unfinished download if any. |
| 147 CancelDownloads(); | 146 CancelDownloads(); |
| 148 delete observer_; | 147 delete observer_; |
| 149 } | 148 } |
| 150 | 149 |
| (...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 yesterday, embedded_test_server()->host_port_pair().host())); | 1490 yesterday, embedded_test_server()->host_port_pair().host())); |
| 1492 ASSERT_EQ(1U, ip_map->at(test_server_host).size()); | 1491 ASSERT_EQ(1U, ip_map->at(test_server_host).size()); |
| 1493 ClickTestLink("direct_download", 1, initial_url); | 1492 ClickTestLink("direct_download", 1, initial_url); |
| 1494 EXPECT_EQ(1U, ip_map->at(test_server_host).size()); | 1493 EXPECT_EQ(1U, ip_map->at(test_server_host).size()); |
| 1495 EXPECT_EQ(embedded_test_server()->host_port_pair().host(), | 1494 EXPECT_EQ(embedded_test_server()->host_port_pair().host(), |
| 1496 ip_map->at(test_server_host).back().ip); | 1495 ip_map->at(test_server_host).back().ip); |
| 1497 EXPECT_NE(yesterday, ip_map->at(test_server_host).front().timestamp); | 1496 EXPECT_NE(yesterday, ip_map->at(test_server_host).front().timestamp); |
| 1498 } | 1497 } |
| 1499 | 1498 |
| 1500 } // namespace safe_browsing | 1499 } // namespace safe_browsing |
| OLD | NEW |