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

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: Merge with r204343 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..5a7c9e8b9b5e45a5c4903c5b262421d062f3b71f 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 in a terminal state 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(), IsDone()).WillOnce(Return(true));
download_observer()->OnDownloadUpdated(&download());
VerifyExpectations();
+ // If the download is dangerous and is not in a terminal state, don't dismiss
+ // the dialog.
+ SetUpExpectations(DownloadDangerPrompt::ACCEPT);
+ EXPECT_CALL(download(), IsDangerous()).WillOnce(Return(true));
+ EXPECT_CALL(download(), IsDone()).WillOnce(Return(false));
+ download_observer()->OnDownloadUpdated(&download());
+ SimulatePromptAction(DownloadDangerPrompt::ACCEPT);
+ VerifyExpectations();
+
// If the containing tab is closed, the dialog should be canceled.
OpenNewTab();
SetUpExpectations(DownloadDangerPrompt::CANCEL);
« no previous file with comments | « chrome/browser/download/download_danger_prompt.cc ('k') | chrome/browser/download/download_shelf_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698