Commit 1ab71d1f authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Rename X-GoogleUpdate headers to X-Goog-Update.

Bug: 813193
Change-Id: I939aee748e638ae6fc3e5171a27491d83df151c3
Reviewed-on: https://chromium-review.googlesource.com/957484Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542541}
parent 12b5bb46
...@@ -135,11 +135,11 @@ TEST_F(PingManagerTest, SendPing) { ...@@ -135,11 +135,11 @@ TEST_F(PingManagerTest, SendPing) {
// Check the ping request does not carry the specific extra request headers. // Check the ping request does not carry the specific extra request headers.
EXPECT_FALSE(interceptor->GetRequests()[0].second.HasHeader( EXPECT_FALSE(interceptor->GetRequests()[0].second.HasHeader(
"X-GoogleUpdate-Interactivity")); "X-Goog-Update-Interactivity"));
EXPECT_FALSE(interceptor->GetRequests()[0].second.HasHeader( EXPECT_FALSE(interceptor->GetRequests()[0].second.HasHeader(
"X-GoogleUpdate-Updater")); "X-Goog-Update-Updater"));
EXPECT_FALSE( EXPECT_FALSE(
interceptor->GetRequests()[0].second.HasHeader("X-GoogleUpdate-AppId")); interceptor->GetRequests()[0].second.HasHeader("X-Goog-Update-AppId"));
interceptor->Reset(); interceptor->Reset();
} }
......
...@@ -312,11 +312,11 @@ std::map<std::string, std::string> BuildUpdateCheckExtraRequestHeaders( ...@@ -312,11 +312,11 @@ std::map<std::string, std::string> BuildUpdateCheckExtraRequestHeaders(
: std::vector<std::string>(ids.cbegin(), : std::vector<std::string>(ids.cbegin(),
ids.cbegin() + maxExtensionCount); ids.cbegin() + maxExtensionCount);
return std::map<std::string, std::string>{ return std::map<std::string, std::string>{
{"X-GoogleUpdate-Updater", {"X-Goog-Update-Updater",
base::StringPrintf("%s-%s", config->GetProdId().c_str(), base::StringPrintf("%s-%s", config->GetProdId().c_str(),
config->GetBrowserVersion().GetString().c_str())}, config->GetBrowserVersion().GetString().c_str())},
{"X-GoogleUpdate-Interactivity", is_foreground ? "fg" : "bg"}, {"X-Goog-Update-Interactivity", is_foreground ? "fg" : "bg"},
{"X-GoogleUpdate-AppId", base::JoinString(app_ids, ",")}, {"X-Goog-Update-AppId", base::JoinString(app_ids, ",")},
}; };
} }
......
...@@ -20,8 +20,8 @@ class Configurator; ...@@ -20,8 +20,8 @@ class Configurator;
class PersistedData; class PersistedData;
// Creates the values for the DDOS extra request headers sent with the update // Creates the values for the DDOS extra request headers sent with the update
// check. These headers include "X-GoogleUpdate-Updater", // check. These headers include "X-Goog-Update-Updater",
// "X-GoogleUpdate-AppId", and "X-GoogleUpdate-Interactivity". // "X-Goog-Update-AppId", and "X-Goog-Update-Interactivity".
std::map<std::string, std::string> BuildUpdateCheckExtraRequestHeaders( std::map<std::string, std::string> BuildUpdateCheckExtraRequestHeaders(
scoped_refptr<Configurator> config, scoped_refptr<Configurator> config,
const std::vector<std::string>& ids_checked, const std::vector<std::string>& ids_checked,
......
...@@ -81,31 +81,31 @@ TEST(BuildProtocolRequest, BuildUpdateCheckExtraRequestHeaders) { ...@@ -81,31 +81,31 @@ TEST(BuildProtocolRequest, BuildUpdateCheckExtraRequestHeaders) {
auto config = base::MakeRefCounted<TestConfigurator>(); auto config = base::MakeRefCounted<TestConfigurator>();
auto headers = BuildUpdateCheckExtraRequestHeaders(config, {}, true); auto headers = BuildUpdateCheckExtraRequestHeaders(config, {}, true);
EXPECT_STREQ("fake_prodid-30.0", headers["X-GoogleUpdate-Updater"].c_str()); EXPECT_STREQ("fake_prodid-30.0", headers["X-Goog-Update-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-GoogleUpdate-Interactivity"].c_str()); EXPECT_STREQ("fg", headers["X-Goog-Update-Interactivity"].c_str());
EXPECT_EQ("", headers["X-GoogleUpdate-AppId"]); EXPECT_EQ("", headers["X-Goog-Update-AppId"]);
headers = BuildUpdateCheckExtraRequestHeaders(config, {}, false); headers = BuildUpdateCheckExtraRequestHeaders(config, {}, false);
EXPECT_STREQ("fake_prodid-30.0", headers["X-GoogleUpdate-Updater"].c_str()); EXPECT_STREQ("fake_prodid-30.0", headers["X-Goog-Update-Updater"].c_str());
EXPECT_STREQ("bg", headers["X-GoogleUpdate-Interactivity"].c_str()); EXPECT_STREQ("bg", headers["X-Goog-Update-Interactivity"].c_str());
EXPECT_EQ("", headers["X-GoogleUpdate-AppId"]); EXPECT_EQ("", headers["X-Goog-Update-AppId"]);
headers = BuildUpdateCheckExtraRequestHeaders( headers = BuildUpdateCheckExtraRequestHeaders(
config, {"jebgalgnebhfojomionfpkfelancnnkf"}, true); config, {"jebgalgnebhfojomionfpkfelancnnkf"}, true);
EXPECT_STREQ("fake_prodid-30.0", headers["X-GoogleUpdate-Updater"].c_str()); EXPECT_STREQ("fake_prodid-30.0", headers["X-Goog-Update-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-GoogleUpdate-Interactivity"].c_str()); EXPECT_STREQ("fg", headers["X-Goog-Update-Interactivity"].c_str());
EXPECT_STREQ("jebgalgnebhfojomionfpkfelancnnkf", EXPECT_STREQ("jebgalgnebhfojomionfpkfelancnnkf",
headers["X-GoogleUpdate-AppId"].c_str()); headers["X-Goog-Update-AppId"].c_str());
headers = BuildUpdateCheckExtraRequestHeaders( headers = BuildUpdateCheckExtraRequestHeaders(
config, config,
{"jebgalgnebhfojomionfpkfelancnnkf", "ihfokbkgjpifbbojhneepfflplebdkc"}, {"jebgalgnebhfojomionfpkfelancnnkf", "ihfokbkgjpifbbojhneepfflplebdkc"},
true); true);
EXPECT_STREQ("fake_prodid-30.0", headers["X-GoogleUpdate-Updater"].c_str()); EXPECT_STREQ("fake_prodid-30.0", headers["X-Goog-Update-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-GoogleUpdate-Interactivity"].c_str()); EXPECT_STREQ("fg", headers["X-Goog-Update-Interactivity"].c_str());
EXPECT_STREQ( EXPECT_STREQ(
"jebgalgnebhfojomionfpkfelancnnkf,ihfokbkgjpifbbojhneepfflplebdkc", "jebgalgnebhfojomionfpkfelancnnkf,ihfokbkgjpifbbojhneepfflplebdkc",
headers["X-GoogleUpdate-AppId"].c_str()); headers["X-Goog-Update-AppId"].c_str());
headers = BuildUpdateCheckExtraRequestHeaders( headers = BuildUpdateCheckExtraRequestHeaders(
config, std::vector<std::string>(40, "jebgalgnebhfojomionfpkfelancnnkf"), config, std::vector<std::string>(40, "jebgalgnebhfojomionfpkfelancnnkf"),
...@@ -114,7 +114,7 @@ TEST(BuildProtocolRequest, BuildUpdateCheckExtraRequestHeaders) { ...@@ -114,7 +114,7 @@ TEST(BuildProtocolRequest, BuildUpdateCheckExtraRequestHeaders) {
base::JoinString( base::JoinString(
std::vector<std::string>(30, "jebgalgnebhfojomionfpkfelancnnkf"), ",") std::vector<std::string>(30, "jebgalgnebhfojomionfpkfelancnnkf"), ",")
.c_str(), .c_str(),
headers["X-GoogleUpdate-AppId"].c_str()); headers["X-Goog-Update-AppId"].c_str());
} }
} // namespace update_client } // namespace update_client
...@@ -144,7 +144,7 @@ TEST_P(RequestSenderTest, RequestSendSuccess) { ...@@ -144,7 +144,7 @@ TEST_P(RequestSenderTest, RequestSendSuccess) {
const bool is_foreground = GetParam(); const bool is_foreground = GetParam();
request_sender_ = std::make_unique<RequestSender>(config_); request_sender_ = std::make_unique<RequestSender>(config_);
request_sender_->Send( request_sender_->Send(
urls, {{"X-GoogleUpdate-Interactivity", is_foreground ? "fg" : "bg"}}, urls, {{"X-Goog-Update-Interactivity", is_foreground ? "fg" : "bg"}},
"test", false, "test", false,
base::BindOnce(&RequestSenderTest::RequestSenderComplete, base::BindOnce(&RequestSenderTest::RequestSenderComplete,
base::Unretained(this))); base::Unretained(this)));
...@@ -173,9 +173,9 @@ TEST_P(RequestSenderTest, RequestSendSuccess) { ...@@ -173,9 +173,9 @@ TEST_P(RequestSenderTest, RequestSendSuccess) {
// Check the interactivity header value. // Check the interactivity header value.
const auto extra_request_headers = const auto extra_request_headers =
post_interceptor_1_->GetRequests()[0].second; post_interceptor_1_->GetRequests()[0].second;
EXPECT_TRUE(extra_request_headers.HasHeader("X-GoogleUpdate-Interactivity")); EXPECT_TRUE(extra_request_headers.HasHeader("X-Goog-Update-Interactivity"));
std::string header; std::string header;
extra_request_headers.GetHeader("X-GoogleUpdate-Interactivity", &header); extra_request_headers.GetHeader("X-Goog-Update-Interactivity", &header);
EXPECT_STREQ(is_foreground ? "fg" : "bg", header.c_str()); EXPECT_STREQ(is_foreground ? "fg" : "bg", header.c_str());
interceptor_factory_ = nullptr; interceptor_factory_ = nullptr;
......
...@@ -35,7 +35,7 @@ class UpdateChecker { ...@@ -35,7 +35,7 @@ class UpdateChecker {
// |additional_attributes| provides a way to customize the <request> element. // |additional_attributes| provides a way to customize the <request> element.
// This value is inserted as-is, therefore it must be well-formed as an // This value is inserted as-is, therefore it must be well-formed as an
// XML attribute string. // XML attribute string.
// |is_foreground| controls the value of "X-GoogleUpdate-Interactivity" // |is_foreground| controls the value of "X-Goog-Update-Interactivity"
// header which is sent with the update check. // header which is sent with the update check.
// On completion, the state of |components| is mutated as required by the // On completion, the state of |components| is mutated as required by the
// server response received. // server response received.
......
...@@ -300,13 +300,13 @@ TEST_P(UpdateCheckerTest, UpdateCheckSuccess) { ...@@ -300,13 +300,13 @@ TEST_P(UpdateCheckerTest, UpdateCheckSuccess) {
// Check the DDOS protection header values. // Check the DDOS protection header values.
const auto extra_request_headers = post_interceptor_->GetRequests()[0].second; const auto extra_request_headers = post_interceptor_->GetRequests()[0].second;
EXPECT_TRUE(extra_request_headers.HasHeader("X-GoogleUpdate-Interactivity")); EXPECT_TRUE(extra_request_headers.HasHeader("X-Goog-Update-Interactivity"));
std::string header; std::string header;
extra_request_headers.GetHeader("X-GoogleUpdate-Interactivity", &header); extra_request_headers.GetHeader("X-Goog-Update-Interactivity", &header);
EXPECT_STREQ(GetParam() ? "fg" : "bg", header.c_str()); EXPECT_STREQ(GetParam() ? "fg" : "bg", header.c_str());
extra_request_headers.GetHeader("X-GoogleUpdate-Updater", &header); extra_request_headers.GetHeader("X-Goog-Update-Updater", &header);
EXPECT_STREQ("fake_prodid-30.0", header.c_str()); EXPECT_STREQ("fake_prodid-30.0", header.c_str());
extra_request_headers.GetHeader("X-GoogleUpdate-AppId", &header); extra_request_headers.GetHeader("X-Goog-Update-AppId", &header);
EXPECT_STREQ("jebgalgnebhfojomionfpkfelancnnkf", header.c_str()); EXPECT_STREQ("jebgalgnebhfojomionfpkfelancnnkf", header.c_str());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment