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

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

Issue 586793003: Safebrowsing: Honor the metadata from malware fullhash results in SB API 3.0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes for sky Created 6 years, 3 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
Index: chrome/browser/safe_browsing/protocol_parser_unittest.cc
diff --git a/chrome/browser/safe_browsing/protocol_parser_unittest.cc b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
index cf8cd7b59e4af09d1a4c603eda73c5745e893bd6..f3679e22cc3fa0cbbfb722cd9b541ee85b25a157 100644
--- a/chrome/browser/safe_browsing/protocol_parser_unittest.cc
+++ b/chrome/browser/safe_browsing/protocol_parser_unittest.cc
@@ -439,8 +439,6 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHash) {
EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[2].list_id);
// Test metadata parsing.
- // TODO(shess): Currently the code doesn't actually put the metadata anywhere,
- // this is just testing that metadata doesn't break parsing.
const std::string get_hash3(base::StringPrintf(
"45\n"
"%s:32:2:m\n"
@@ -459,14 +457,17 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHash) {
"zzzzyyyyxxxxwwwwvvvvuuuuttttssss",
sizeof(SBFullHash)), 0);
EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[0].list_id);
+ EXPECT_EQ(std::string("ab"), full_hashes[0].metadata);
EXPECT_EQ(memcmp(&full_hashes[1].hash,
"00112233445566778899aabbccddeeff",
sizeof(SBFullHash)), 0);
EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[1].list_id);
+ EXPECT_EQ(std::string("xy"), full_hashes[1].metadata);
EXPECT_EQ(memcmp(&full_hashes[2].hash,
"cafebeefcafebeefdeaddeaddeaddead",
sizeof(SBFullHash)), 0);
EXPECT_EQ(safe_browsing_util::PHISH, full_hashes[2].list_id);
+ EXPECT_EQ(std::string(), full_hashes[2].metadata);
}
TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithUnknownList) {
@@ -528,6 +529,7 @@ TEST(SafeBrowsingProtocolParsingTest, TestGetHashWithUnknownListAndMetadata) {
"0123456789hashhashhashhashhashha",
sizeof(SBFullHash)), 0);
EXPECT_EQ(safe_browsing_util::MALWARE, full_hashes[0].list_id);
+ EXPECT_EQ(std::string(), full_hashes[0].metadata);
}
TEST(SafeBrowsingProtocolParsingTest, TestFormatHash) {
« no previous file with comments | « chrome/browser/safe_browsing/protocol_parser.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698