summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-21 20:33:33 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-21 20:33:33 +0000
commit27b8516d551c6b8c5d216e6ed1375b39ccc5f7da (patch)
tree036d0f88becbc930daa17a028b3822d366fc6301 /chrome/browser
parent61aa961dc4642eff319c07012a9bded349bb1baf (diff)
downloadchromium_src-27b8516d551c6b8c5d216e6ed1375b39ccc5f7da.zip
chromium_src-27b8516d551c6b8c5d216e6ed1375b39ccc5f7da.tar.gz
chromium_src-27b8516d551c6b8c5d216e6ed1375b39ccc5f7da.tar.bz2
safebrowsing: Set threat_list for BINARY_MALWARE_HASH ping.
BUG=80098 TEST=official debug build shouldn't hit DCHECK. pingback content verified with tcpdump. Review URL: http://codereview.chromium.org/6889001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82547 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.cc6
-rw-r--r--chrome/browser/safe_browsing/protocol_manager_unittest.cc20
2 files changed, 24 insertions, 2 deletions
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 342b9d6..127bf5c 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -763,7 +763,8 @@ GURL SafeBrowsingProtocolManager::SafeBrowsingHitUrl(
SafeBrowsingService::UrlCheckResult threat_type) const {
DCHECK(threat_type == SafeBrowsingService::URL_MALWARE ||
threat_type == SafeBrowsingService::URL_PHISHING ||
- threat_type == SafeBrowsingService::BINARY_MALWARE_URL);
+ threat_type == SafeBrowsingService::BINARY_MALWARE_URL ||
+ threat_type == SafeBrowsingService::BINARY_MALWARE_HASH);
// The malware and phishing hits go over HTTP.
std::string url = ComposeUrl(http_url_prefix_, "report", client_name_,
version_, additional_query_);
@@ -778,6 +779,9 @@ GURL SafeBrowsingProtocolManager::SafeBrowsingHitUrl(
case SafeBrowsingService::BINARY_MALWARE_URL:
threat_list = "binurlhit";
break;
+ case SafeBrowsingService::BINARY_MALWARE_HASH:
+ threat_list = "binhashhit";
+ break;
default:
NOTREACHED();
}
diff --git a/chrome/browser/safe_browsing/protocol_manager_unittest.cc b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
index fc119ff..69bff62 100644
--- a/chrome/browser/safe_browsing/protocol_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -218,6 +218,24 @@ TEST_F(SafeBrowsingProtocolManagerTest, TestSafeBrowsingHitUrl) {
pm.SafeBrowsingHitUrl(
malicious_url, page_url, referrer_url,
false, SafeBrowsingService::URL_PHISHING).spec());
+
+ EXPECT_EQ("http://info.prefix.com/foo/report?client=unittest&appver=1.0&"
+ "pver=2.2&additional_query&evts=binurlhit&"
+ "evtd=http%3A%2F%2Fmalicious.url.com%2F&"
+ "evtr=http%3A%2F%2Fpage.url.com%2F&evhr=http%3A%2F%2Freferrer."
+ "url.com%2F&evtb=0",
+ pm.SafeBrowsingHitUrl(
+ malicious_url, page_url, referrer_url,
+ false, SafeBrowsingService::BINARY_MALWARE_URL).spec());
+
+ EXPECT_EQ("http://info.prefix.com/foo/report?client=unittest&appver=1.0&"
+ "pver=2.2&additional_query&evts=binhashhit&"
+ "evtd=http%3A%2F%2Fmalicious.url.com%2F&"
+ "evtr=http%3A%2F%2Fpage.url.com%2F&evhr=http%3A%2F%2Freferrer."
+ "url.com%2F&evtb=0",
+ pm.SafeBrowsingHitUrl(
+ malicious_url, page_url, referrer_url,
+ false, SafeBrowsingService::BINARY_MALWARE_HASH).spec());
}
TEST_F(SafeBrowsingProtocolManagerTest, TestMalwareDetailsUrl) {