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

Unified Diff: components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc

Issue 2356443002: Set client_id and client_version in requests sent to SafeBrowsing (Closed)
Patch Set: Make GetBase64SerializedUpdateRequestProto non static Created 4 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: 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 0c6b2a15855ad292908f030128cfb437ed9311bc..baa42a7a07d1991fa5f4cb707a54b53f76a0ccde 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
@@ -282,29 +282,31 @@ TEST_F(V4GetHashProtocolManagerTest,
}
TEST_F(V4GetHashProtocolManagerTest, TestGetHashRequest) {
- HashPrefix one = "hashone";
- HashPrefix two = "hashtwo";
- std::vector<HashPrefix> prefixes_to_request = {one, two};
-
FindFullHashesRequest req;
ThreatInfo* info = req.mutable_threat_info();
- info->add_threat_types(MALWARE_THREAT);
- info->add_threat_types(API_ABUSE);
-
info->add_platform_types(GetCurrentPlatformType());
info->add_platform_types(CHROME_PLATFORM);
info->add_threat_entry_types(URL);
+ info->add_threat_types(MALWARE_THREAT);
+ info->add_threat_types(API_ABUSE);
+
+ HashPrefix one = "hashone";
+ HashPrefix two = "hashtwo";
info->add_threat_entries()->set_hash(one);
info->add_threat_entries()->set_hash(two);
+ std::unique_ptr<V4GetHashProtocolManager> pm(CreateProtocolManager());
+ req.mutable_client()->set_client_id(pm->config_.client_name);
+ req.mutable_client()->set_client_version(pm->config_.version);
+
// Serialize and Base64 encode.
std::string req_data, req_base64;
req.SerializeToString(&req_data);
base::Base64Encode(req_data, &req_base64);
- std::unique_ptr<V4GetHashProtocolManager> pm(CreateProtocolManager());
+ std::vector<HashPrefix> prefixes_to_request = {one, two};
EXPECT_EQ(req_base64, pm->GetHashRequest(prefixes_to_request));
}
« no previous file with comments | « components/safe_browsing_db/v4_get_hash_protocol_manager.cc ('k') | components/safe_browsing_db/v4_protocol_manager_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698