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

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

Issue 7065015: For downloads requiring a user gesture, also require... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_state_info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_manager_unittest.cc
===================================================================
--- chrome/browser/download/download_manager_unittest.cc (revision 86341)
+++ chrome/browser/download/download_manager_unittest.cc (working copy)
@@ -172,29 +172,21 @@
// Safe download, download finishes BEFORE file name determined.
// Renamed twice (linear path through UI). Crdownload file does not need
// to be deleted.
- { FILE_PATH_LITERAL("foo.zip"),
- false, false, true, 2, },
+ { FILE_PATH_LITERAL("foo.zip"), false, false, true, 2, },
// Dangerous download (file is dangerous or download URL is not safe or both),
// download finishes BEFORE file name determined. Needs to be renamed only
// once.
- { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"),
- true, false, true, 1, },
- { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"),
- false, true, true, 1, },
- { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"),
- true, true, true, 1, },
+ { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), true, false, true, 1, },
+ { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), false, true, true, 1, },
+ { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), true, true, true, 1, },
// Safe download, download finishes AFTER file name determined.
// Needs to be renamed twice.
- { FILE_PATH_LITERAL("foo.zip"),
- false, false, false, 2, },
+ { FILE_PATH_LITERAL("foo.zip"), false, false, false, 2, },
// Dangerous download, download finishes AFTER file name determined.
// Needs to be renamed only once.
- { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"),
- true, false, false, 1, },
- { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"),
- false, true, false, 1, },
- { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"),
- true, true, false, 1, },
+ { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), true, false, false, 1, },
+ { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), false, true, false, 1, },
+ { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), true, true, false, 1, },
};
class MockDownloadFile : public DownloadFile {
@@ -345,8 +337,6 @@
info->download_id = static_cast<int>(i);
info->prompt_user_for_save_location = false;
info->url_chain.push_back(GURL());
- info->is_dangerous_file = kDownloadRenameCases[i].is_dangerous_file;
- info->is_dangerous_url = kDownloadRenameCases[i].is_dangerous_url;
const FilePath new_path(kDownloadRenameCases[i].suggested_path);
MockDownloadFile* download_file(
@@ -371,6 +361,12 @@
2, new_path))));
}
download_manager_->CreateDownloadItem(info);
+ DownloadItem* download = GetActiveDownloadItem(i);
+ ASSERT_TRUE(download != NULL);
+ if (kDownloadRenameCases[i].is_dangerous_file)
+ download->MarkFileDangerous();
+ if (kDownloadRenameCases[i].is_dangerous_url)
+ download->MarkUrlDangerous();
int32* id_ptr = new int32;
*id_ptr = i; // Deleted in FileSelected().
@@ -402,8 +398,6 @@
info->download_id = static_cast<int>(0);
info->prompt_user_for_save_location = false;
info->url_chain.push_back(GURL());
- info->is_dangerous_file = false;
- info->is_dangerous_url = false;
const FilePath new_path(FILE_PATH_LITERAL("foo.zip"));
const FilePath cr_path(download_util::GetCrDownloadPath(new_path));
@@ -467,8 +461,6 @@
info->download_id = static_cast<int>(0);
info->prompt_user_for_save_location = false;
info->url_chain.push_back(GURL());
- info->is_dangerous_file = false;
- info->is_dangerous_url = false;
const FilePath new_path(FILE_PATH_LITERAL("foo.zip"));
const FilePath cr_path(download_util::GetCrDownloadPath(new_path));
@@ -545,8 +537,6 @@
info->download_id = static_cast<int>(0);
info->prompt_user_for_save_location = true;
info->url_chain.push_back(GURL());
- info->is_dangerous_file = false;
- info->is_dangerous_url = false;
download_manager_->CreateDownloadItem(info);
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/download/download_state_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698