| 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 "chrome/browser/lifetime/browser_close_manager.h" | 5 #include "chrome/browser/lifetime/browser_close_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 bool DetermineDownloadTarget( | 168 bool DetermineDownloadTarget( |
| 169 content::DownloadItem* item, | 169 content::DownloadItem* item, |
| 170 const content::DownloadTargetCallback& callback) override { | 170 const content::DownloadTargetCallback& callback) override { |
| 171 content::DownloadTargetCallback dangerous_callback = | 171 content::DownloadTargetCallback dangerous_callback = |
| 172 base::Bind(&TestDownloadManagerDelegate::SetDangerous, callback); | 172 base::Bind(&TestDownloadManagerDelegate::SetDangerous, callback); |
| 173 return ChromeDownloadManagerDelegate::DetermineDownloadTarget( | 173 return ChromeDownloadManagerDelegate::DetermineDownloadTarget( |
| 174 item, dangerous_callback); | 174 item, dangerous_callback); |
| 175 } | 175 } |
| 176 | 176 |
| 177 static void SetDangerous( | 177 static void SetDangerous(const content::DownloadTargetCallback& callback, |
| 178 const content::DownloadTargetCallback& callback, | 178 const base::FilePath& target_path, |
| 179 const base::FilePath& target_path, | 179 content::DownloadItem::TargetDisposition disp, |
| 180 content::DownloadItem::TargetDisposition disp, | 180 content::DownloadDangerType danger_type, |
| 181 content::DownloadDangerType danger_type, | 181 const base::FilePath& intermediate_path, |
| 182 const base::FilePath& intermediate_path) { | 182 content::DownloadInterruptReason interrupt_reason) { |
| 183 callback.Run(target_path, | 183 callback.Run(target_path, disp, content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL, |
| 184 disp, | 184 intermediate_path, interrupt_reason); |
| 185 content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL, | |
| 186 intermediate_path); | |
| 187 } | 185 } |
| 188 }; | 186 }; |
| 189 | 187 |
| 190 class FakeBackgroundModeManager : public BackgroundModeManager { | 188 class FakeBackgroundModeManager : public BackgroundModeManager { |
| 191 public: | 189 public: |
| 192 FakeBackgroundModeManager() | 190 FakeBackgroundModeManager() |
| 193 : BackgroundModeManager(*base::CommandLine::ForCurrentProcess(), | 191 : BackgroundModeManager(*base::CommandLine::ForCurrentProcess(), |
| 194 &g_browser_process->profile_manager() | 192 &g_browser_process->profile_manager() |
| 195 ->GetProfileAttributesStorage()), | 193 ->GetProfileAttributesStorage()), |
| 196 suspended_(false) {} | 194 suspended_(false) {} |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 | 1145 |
| 1148 chrome::CloseAllBrowsers(); | 1146 chrome::CloseAllBrowsers(); |
| 1149 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 1147 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
| 1150 EXPECT_TRUE(BrowserList::GetInstance()->empty()); | 1148 EXPECT_TRUE(BrowserList::GetInstance()->empty()); |
| 1151 EXPECT_TRUE(IsBackgroundModeSuspended()); | 1149 EXPECT_TRUE(IsBackgroundModeSuspended()); |
| 1152 } | 1150 } |
| 1153 | 1151 |
| 1154 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 1152 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 1155 BrowserCloseManagerWithBackgroundModeBrowserTest, | 1153 BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 1156 testing::Bool()); | 1154 testing::Bool()); |
| OLD | NEW |