From 2c43aa6abc22315875dc1ebf5de63ca8b1b3b791 Mon Sep 17 00:00:00 2001 From: jialiul Date: Wed, 20 Apr 2016 13:57:58 -0700 Subject: [PATCH] Bug fix in sampling whitelisted download. BUG=553674 Review URL: https://codereview.chromium.org/1911543002 Cr-Commit-Position: refs/heads/master@{#388575} --- chrome/browser/safe_browsing/download_protection_service.cc | 4 ++-- .../safe_browsing/download_protection_service_unittest.cc | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc index 081d32ae6734f..766bbd15bbe60 100644 --- a/chrome/browser/safe_browsing/download_protection_service.cc +++ b/chrome/browser/safe_browsing/download_protection_service.cc @@ -887,8 +887,8 @@ class DownloadProtectionService::CheckClientDownloadRequest request.set_url(SanitizeUrl(item_->GetUrlChain().back())); request.mutable_digests()->set_sha256(item_->GetHash()); request.set_length(item_->GetReceivedBytes()); - request.set_skipped_url_whitelist(true); - request.set_skipped_certificate_whitelist(true); + request.set_skipped_url_whitelist(skipped_url_whitelist_); + request.set_skipped_certificate_whitelist(skipped_certificate_whitelist_); for (size_t i = 0; i < item_->GetUrlChain().size(); ++i) { ClientDownloadRequest::Resource* resource = request.add_resources(); resource->set_url(SanitizeUrl(item_->GetUrlChain()[i])); diff --git a/chrome/browser/safe_browsing/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection_service_unittest.cc index e5bc6825a0557..cb6e9404043ad 100644 --- a/chrome/browser/safe_browsing/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection_service_unittest.cc @@ -662,6 +662,8 @@ TEST_F(DownloadProtectionServiceTest, EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); EXPECT_TRUE(HasClientDownloadRequest()); + EXPECT_FALSE(GetClientDownloadRequest()->skipped_url_whitelist()); + EXPECT_FALSE(GetClientDownloadRequest()->skipped_certificate_whitelist()); ClearClientDownloadRequest(); // Check that the referrer is not matched against the whitelist. @@ -674,6 +676,8 @@ TEST_F(DownloadProtectionServiceTest, EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); EXPECT_TRUE(HasClientDownloadRequest()); + EXPECT_FALSE(GetClientDownloadRequest()->skipped_url_whitelist()); + EXPECT_FALSE(GetClientDownloadRequest()->skipped_certificate_whitelist()); ClearClientDownloadRequest(); // Redirect from a site shouldn't be checked either. @@ -686,6 +690,8 @@ TEST_F(DownloadProtectionServiceTest, EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); EXPECT_TRUE(HasClientDownloadRequest()); + EXPECT_FALSE(GetClientDownloadRequest()->skipped_url_whitelist()); + EXPECT_FALSE(GetClientDownloadRequest()->skipped_certificate_whitelist()); ClearClientDownloadRequest(); // Only if the final url is whitelisted should it be SAFE.