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

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

Issue 8536041: This CL integrates the new SafeBrowsing download service class (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix unit-tests Created 9 years, 1 month 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 82054eabc3364eec9c4900ef407f905347f7b92e..2898059f60131d05ace862ffb3d23a2a689ae1cd 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -214,7 +214,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) {
msg_loop_.Run();
EXPECT_EQ(DownloadProtectionService::SAFE, result_);
- // Only http is supported for now.
+ // Only https is not supported for now for privacy reasons.
info.local_file = FilePath(FILE_PATH_LITERAL("a.exe"));
info.download_url_chain.push_back(GURL("https://www.google.com/"));
download_service_->CheckClientDownload(
@@ -223,14 +223,6 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) {
base::Unretained(this)));
msg_loop_.Run();
EXPECT_EQ(DownloadProtectionService::SAFE, result_);
-
- info.download_url_chain[0] = GURL("ftp://www.google.com/");
- download_service_->CheckClientDownload(
- info,
- base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
- base::Unretained(this)));
- msg_loop_.Run();
- EXPECT_EQ(DownloadProtectionService::SAFE, result_);
}
TEST_F(DownloadProtectionServiceTest, CheckClientDownloadWhitelistedUrl) {
@@ -498,7 +490,8 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadDigestList) {
EXPECT_EQ(DownloadProtectionService::SAFE, result_);
Mock::VerifyAndClearExpectations(sb_service_);
- // A match is found with the bad binary digest list.
+ // A match is found with the bad binary digest list. We currently do not
+ // warn based on the digest list. Hence we should always return SAFE.
EXPECT_CALL(*sb_service_,
CheckDownloadHash(info.sha256_hash, NotNull()))
.WillOnce(DoAll(
@@ -509,7 +502,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadDigestList) {
base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
base::Unretained(this)));
msg_loop_.Run();
- EXPECT_EQ(DownloadProtectionService::DANGEROUS, result_);
+ EXPECT_EQ(DownloadProtectionService::SAFE, result_);
Mock::VerifyAndClearExpectations(sb_service_);
// If the download is not an executable we do not send a server ping but we
@@ -526,7 +519,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadDigestList) {
base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
base::Unretained(this)));
msg_loop_.Run();
- EXPECT_EQ(DownloadProtectionService::DANGEROUS, result_);
+ EXPECT_EQ(DownloadProtectionService::SAFE, result_);
Mock::VerifyAndClearExpectations(sb_service_);
// If the URL or the referrer matches the download whitelist we cannot send
@@ -547,7 +540,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadDigestList) {
base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
base::Unretained(this)));
msg_loop_.Run();
- EXPECT_EQ(DownloadProtectionService::DANGEROUS, result_);
+ EXPECT_EQ(DownloadProtectionService::SAFE, result_);
}
TEST_F(DownloadProtectionServiceTest, TestCheckDownloadUrl) {

Powered by Google App Engine
This is Rietveld 408576698