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

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: 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 f2e99eab0ebb90b28d4a50d2019fffe1560acec2..3705569910e1df248fc4240f7befbe7a36ac41e7 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,23 @@ TEST_F(DownloadProtectionServiceTest, CheckClientDownloadDigestList) {
base::Unretained(this)));
msg_loop_.Run();
EXPECT_EQ(DownloadProtectionService::SAFE, result_);
mattm 2011/11/16 01:38:01 add VerifyAndClearExpectations call
noelutz 2011/11/16 01:57:18 Done.
+
+ // 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) {

Powered by Google App Engine
This is Rietveld 408576698