Index: chrome/browser/download/download_danger_prompt_browsertest.cc |
diff --git a/chrome/browser/download/download_danger_prompt_browsertest.cc b/chrome/browser/download/download_danger_prompt_browsertest.cc |
index bbdddfedb34021e58fccef6883e39a31b8504712..ada1a24c920a63243686e5ccc223dd98db16ae72 100644 |
--- a/chrome/browser/download/download_danger_prompt_browsertest.cc |
+++ b/chrome/browser/download/download_danger_prompt_browsertest.cc |
@@ -122,22 +122,30 @@ IN_PROC_BROWSER_TEST_F(DownloadDangerPromptTest, TestAll) { |
SimulatePromptAction(DownloadDangerPrompt::CANCEL); |
VerifyExpectations(); |
- // If the download is no longer in-progress, the dialog should dismiss itself. |
+ // If the download is no longer dangerous (because it was accepted), the |
+ // dialog should dismiss itself. |
SetUpExpectations(DownloadDangerPrompt::CANCEL); |
- EXPECT_CALL(download(), GetState()).WillOnce( |
- Return(content::DownloadItem::CANCELLED)); |
+ EXPECT_CALL(download(), IsDangerous()).WillOnce(Return(false)); |
download_observer()->OnDownloadUpdated(&download()); |
VerifyExpectations(); |
- // If the download is no longer dangerous (because it was accepted), the |
- // dialog should dismiss itself. |
+ // If the download is interrupted, and can't be resumed, then the dialog |
+ // should dismiss itself. |
SetUpExpectations(DownloadDangerPrompt::CANCEL); |
- EXPECT_CALL(download(), GetState()).WillOnce( |
- Return(content::DownloadItem::IN_PROGRESS)); |
- EXPECT_CALL(download(), IsDangerous()).WillOnce(Return(false)); |
+ EXPECT_CALL(download(), IsDangerous()).WillOnce(Return(true)); |
+ EXPECT_CALL(download(), IsPartialDownload()).WillOnce(Return(false)); |
download_observer()->OnDownloadUpdated(&download()); |
VerifyExpectations(); |
+ // If the download is dangerous and is a partial download, don't dismiss the |
+ // dialog. |
+ SetUpExpectations(DownloadDangerPrompt::ACCEPT); |
+ EXPECT_CALL(download(), IsDangerous()).WillOnce(Return(true)); |
+ EXPECT_CALL(download(), IsPartialDownload()).WillOnce(Return(true)); |
+ download_observer()->OnDownloadUpdated(&download()); |
+ SimulatePromptAction(DownloadDangerPrompt::ACCEPT); |
+ VerifyExpectations(); |
+ |
// If the containing tab is closed, the dialog should be canceled. |
OpenNewTab(); |
SetUpExpectations(DownloadDangerPrompt::CANCEL); |