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

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

Issue 9639003: Handle uncommon download verdict for safebrowsing download protection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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/safe_browsing/download_protection_service.cc ('k') | chrome/common/safe_browsing/csd.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8bc60d7d39b39a8aefad1b1581d76a97235752db..f0ded308d87122c558eed48c34f6731d7bb07f35 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -386,7 +386,7 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
EXPECT_CALL(*sb_service_, MatchDownloadWhitelistUrl(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*signature_util_, CheckSignature(info.local_file, _)).Times(3);
+ EXPECT_CALL(*signature_util_, CheckSignature(info.local_file, _)).Times(4);
download_service_->CheckClientDownload(
info,
@@ -426,6 +426,24 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadSuccess) {
#else
ExpectResult(DownloadProtectionService::SAFE);
#endif
+
+ // If the response is uncommon the result should also be marked as uncommon.
+ response.set_verdict(ClientDownloadResponse::UNCOMMON);
+ factory.SetFakeResponse(
+ DownloadProtectionService::kDownloadRequestUrl,
+ response.SerializeAsString(),
+ true);
+
+ download_service_->CheckClientDownload(
+ info,
+ base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
+ base::Unretained(this)));
+ msg_loop_.Run();
+#if defined(OS_WIN)
+ ExpectResult(DownloadProtectionService::UNCOMMON);
+#else
+ ExpectResult(DownloadProtectionService::SAFE);
+#endif
}
TEST_F(DownloadProtectionServiceTest, CheckClientDownloadValidateRequest) {
« no previous file with comments | « chrome/browser/safe_browsing/download_protection_service.cc ('k') | chrome/common/safe_browsing/csd.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698