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

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

Issue 8572037: Whitelist executables that are trusted in the SafeBrowsing download protection. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Address Matt's comments 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
« no previous file with comments | « chrome/browser/safe_browsing/download_protection_service.cc ('k') | no next file » | 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 f2e99eab0ebb90b28d4a50d2019fffe1560acec2..96e64b5d741537fcdf2dee3cb4e286a20d1c81bf 100644
--- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc
+++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc
@@ -66,6 +66,10 @@ ACTION_P(SetCertificateContents, contents) {
arg1->add_certificate_chain()->add_element()->set_certificate(contents);
}
+ACTION(TrustSignature) {
+ arg1->set_trusted(true);
+}
+
// We can't call OnSafeBrowsingResult directly because SafeBrowsingCheck does
// not have any copy constructor which means it can't be stored in a callback
// easily. Note: check will be deleted automatically when the callback is
@@ -552,6 +556,24 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadDigestList) {
base::Unretained(this)));
msg_loop_.Run();
EXPECT_EQ(DownloadProtectionService::SAFE, result_);
+ Mock::VerifyAndClearExpectations(sb_service_);
+
+ // If the binary is a trusted executable we will not ping the server but
+ // we will still lookup the digest list.
+ EXPECT_CALL(*sb_service_, MatchDownloadWhitelistUrl(_))
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(*signature_util_, CheckSignature(info.local_file, _))
+ .WillOnce(TrustSignature());
+ EXPECT_CALL(*sb_service_,
+ CheckDownloadHash(info.sha256_hash, NotNull()))
+ .WillOnce(DoAll(CheckDownloadHashDone(SafeBrowsingService::SAFE),
+ Return(false)));
+ download_service_->CheckClientDownload(
+ info,
+ base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
+ base::Unretained(this)));
+ msg_loop_.Run();
+ EXPECT_EQ(DownloadProtectionService::SAFE, result_);
}
TEST_F(DownloadProtectionServiceTest, TestCheckDownloadUrl) {
« no previous file with comments | « chrome/browser/safe_browsing/download_protection_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698