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

Unified Diff: components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc

Issue 1726403006: Switch Safe Browsing's metadata from string to struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ParseJson in test Created 4 years, 10 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
« no previous file with comments | « components/safe_browsing_db/v4_get_hash_protocol_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc
diff --git a/components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc b/components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc
index 0a177ffb49e39bcc269cd3f2f059951b46e88c26..ba766378d1d4433c6c8f33ffe0c1c1e2ec566a09 100644
--- a/components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc
+++ b/components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc
@@ -9,6 +9,7 @@
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "components/safe_browsing_db/safebrowsing.pb.h"
+#include "components/safe_browsing_db/testing_util.h"
#include "components/safe_browsing_db/util.h"
#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h"
#include "net/base/escape.h"
@@ -142,7 +143,7 @@ TEST_F(SafeBrowsingV4GetHashProtocolManagerTest, TestGetHashErrorHandlingOK) {
std::vector<SBFullHashResult> expected_full_hashes;
SBFullHashResult hash_result;
hash_result.hash = SBFullHashForString("Everything's shiny, Cap'n.");
- hash_result.metadata = "NOTIFICATIONS,";
+ hash_result.metadata.api_permissions.push_back("NOTIFICATIONS");
hash_result.cache_duration = base::TimeDelta::FromSeconds(300);
expected_full_hashes.push_back(hash_result);
base::TimeDelta expected_cache_duration = base::TimeDelta::FromSeconds(600);
@@ -229,7 +230,8 @@ TEST_F(SafeBrowsingV4GetHashProtocolManagerTest, TestParseHashResponse) {
EXPECT_EQ(1ul, full_hashes.size());
EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("Everything's shiny, Cap'n."),
full_hashes[0].hash));
- EXPECT_EQ("NOTIFICATIONS,", full_hashes[0].metadata);
+ EXPECT_EQ(1ul, full_hashes[0].metadata.api_permissions.size());
+ EXPECT_EQ("NOTIFICATIONS", full_hashes[0].metadata.api_permissions[0]);
EXPECT_EQ(base::TimeDelta::FromSeconds(300), full_hashes[0].cache_duration);
EXPECT_LE(now + base::TimeDelta::FromSeconds(400), pm->next_gethash_time_);
}
@@ -318,7 +320,7 @@ TEST_F(SafeBrowsingV4GetHashProtocolManagerTest,
EXPECT_TRUE(SBFullHashEqual(SBFullHashForString("Not to fret."),
full_hashes[0].hash));
// Metadata should be empty.
- EXPECT_EQ("", full_hashes[0].metadata);
+ EXPECT_EQ(0ul, full_hashes[0].metadata.api_permissions.size());
EXPECT_EQ(base::TimeDelta::FromSeconds(0), full_hashes[0].cache_duration);
}
« no previous file with comments | « components/safe_browsing_db/v4_get_hash_protocol_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698