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

Unified Diff: components/safe_browsing_db/v4_protocol_manager_util_unittest.cc

Issue 2057433002: Replace the old URL format for PVer4 requests with the new format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move #include to *.cc and use forward declaration in .h Created 4 years, 6 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_protocol_manager_util_unittest.cc
diff --git a/components/safe_browsing_db/v4_protocol_manager_util_unittest.cc b/components/safe_browsing_db/v4_protocol_manager_util_unittest.cc
index 0a997b645ae84f0c5ac3cf6a80704553cec9cabc..480dafd4a8df7a38badde7b7e7622c22d1ffd7f8 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util_unittest.cc
+++ b/components/safe_browsing_db/v4_protocol_manager_util_unittest.cc
@@ -9,6 +9,7 @@
#include "base/base64.h"
#include "base/time/time.h"
#include "net/base/escape.h"
+#include "net/http/http_request_headers.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::Time;
@@ -107,16 +108,21 @@ TEST_F(SafeBrowsingV4ProtocolManagerUtilTest, TestBackOffLogic) {
EXPECT_EQ(TimeDelta::FromHours(24), next);
}
-TEST_F(SafeBrowsingV4ProtocolManagerUtilTest, TestGetRequestUrl) {
+TEST_F(SafeBrowsingV4ProtocolManagerUtilTest,
+ TestGetRequestUrlAndUpdateHeaders) {
V4ProtocolConfig config;
PopulateV4ProtocolConfig(&config);
std::string expectedUrl =
- "https://safebrowsing.googleapis.com/v4/someMethod/request_base64?"
- "alt=proto&client_id=unittest&client_version=1.0&key=test_key_param";
- EXPECT_EQ(expectedUrl, V4ProtocolManagerUtil::GetRequestUrl(
- "request_base64", "someMethod", config)
+ "https://safebrowsing.googleapis.com/v4/someMethod?"
+ "$req=request_base64&$ct=application/x-protobuf&key=test_key_param";
+ net::HttpRequestHeaders headers;
+ EXPECT_EQ(expectedUrl, V4ProtocolManagerUtil::GetRequestUrlAndUpdateHeaders(
+ "request_base64", "someMethod", config, &headers)
.spec());
+ std::string header_value;
+ EXPECT_TRUE(headers.GetHeader("X-HTTP-Method-Override", &header_value));
+ EXPECT_EQ("POST", header_value);
}
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698