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

Unified Diff: chrome/browser/safe_browsing/download_protection_service_unittest.cc

Issue 19863005: Warn users about potentially unwanted downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a "Learn more" URL for unwanted downloads. Created 7 years, 5 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/safe_browsing/download_protection_service_unittest.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
index 6d5bfee84426e623c9cb7ceb590592a7fa8a86d9..91cf222b7e4a1029336f995f5d7d7a8710e1c580 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -455,8 +455,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
std::string hash = "hash";
content::MockDownloadItem item;
- EXPECT_CALL(item, AddObserver(_)).Times(5);
- EXPECT_CALL(item, RemoveObserver(_)).Times(5);
+ EXPECT_CALL(item, AddObserver(_)).Times(6);
+ EXPECT_CALL(item, RemoveObserver(_)).Times(6);
EXPECT_CALL(item, GetFullPath()).WillRepeatedly(ReturnRef(a_tmp));
EXPECT_CALL(item, GetTargetFilePath()).WillRepeatedly(ReturnRef(a_exe));
EXPECT_CALL(item, GetUrlChain()).WillRepeatedly(ReturnRef(url_chain));
@@ -469,7 +469,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
EXPECT_CALL(*sb_service_->mock_database_manager(),
MatchDownloadWhitelistUrl(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*signature_util_.get(), CheckSignature(a_tmp, _)).Times(5);
+ EXPECT_CALL(*signature_util_.get(), CheckSignature(a_tmp, _)).Times(6);
download_service_->CheckClientDownload(
&item,
@@ -561,6 +561,25 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
#else
EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
#endif
+
+ // If the response is POTENTIALLY_UNWANTED the result should also be marked as
+ // POTENTIALLY_UNWANTED.
+ response.set_verdict(ClientDownloadResponse::POTENTIALLY_UNWANTED);
+ factory.SetFakeResponse(
+ DownloadProtectionService::GetDownloadRequestUrl(),
+ response.SerializeAsString(),
+ true);
+
+ download_service_->CheckClientDownload(
+ &item,
+ base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
+ base::Unretained(this)));
+ MessageLoop::current()->Run();
+#if defined(OS_WIN)
+ EXPECT_TRUE(IsResult(DownloadProtectionService::POTENTIALLY_UNWANTED));
+#else
+ EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE));
+#endif
}
TEST_F(DownloadProtectionServiceTest, CheckClientDownloadHTTPS) {
« no previous file with comments | « chrome/browser/safe_browsing/download_protection_service.cc ('k') | chrome/browser/ui/views/download/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698