Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: chrome/browser/download/download_danger_prompt_browsertest.cc

Issue 16007017: [Resumption 10/12] Use DI::IsDone to check for terminal downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698