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) {
// Check the ping request does not carry the specific extra request headers.
EXPECT_FALSE(interceptor->GetRequests()[0].second.HasHeader(
"X-GoogleUpdate-Interactivity"));
"X-Goog-Update-Interactivity"));
EXPECT_FALSE(interceptor->GetRequests()[0].second.HasHeader(
"X-GoogleUpdate-Updater"));
"X-Goog-Update-Updater"));
EXPECT_FALSE(
interceptor->GetRequests()[0].second.HasHeader("X-GoogleUpdate-AppId"));
interceptor->GetRequests()[0].second.HasHeader("X-Goog-Update-AppId"));
interceptor->Reset();
}
......
......@@ -312,11 +312,11 @@ std::map<std::string, std::string> BuildUpdateCheckExtraRequestHeaders(
: std::vector<std::string>(ids.cbegin(),
ids.cbegin() + maxExtensionCount);
return std::map<std::string, std::string>{
{"X-GoogleUpdate-Updater",
{"X-Goog-Update-Updater",
base::StringPrintf("%s-%s", config->GetProdId().c_str(),
config->GetBrowserVersion().GetString().c_str())},
{"X-GoogleUpdate-Interactivity", is_foreground ? "fg" : "bg"},
{"X-GoogleUpdate-AppId", base::JoinString(app_ids, ",")},
{"X-Goog-Update-Interactivity", is_foreground ? "fg" : "bg"},
{"X-Goog-Update-AppId", base::JoinString(app_ids, ",")},
};
}
......
......@@ -20,8 +20,8 @@ class Configurator;
class PersistedData;
// Creates the values for the DDOS extra request headers sent with the update
// check. These headers include "X-GoogleUpdate-Updater",
// "X-GoogleUpdate-AppId", and "X-GoogleUpdate-Interactivity".
// check. These headers include "X-Goog-Update-Updater",
// "X-Goog-Update-AppId", and "X-Goog-Update-Interactivity".
std::map<std::string, std::string> BuildUpdateCheckExtraRequestHeaders(
scoped_refptr<Configurator> config,
const std::vector<std::string>& ids_checked,
......
......@@ -81,31 +81,31 @@ TEST(BuildProtocolRequest, BuildUpdateCheckExtraRequestHeaders) {
auto config = base::MakeRefCounted<TestConfigurator>();
auto headers = BuildUpdateCheckExtraRequestHeaders(config, {}, true);
EXPECT_STREQ("fake_prodid-30.0", headers["X-GoogleUpdate-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-GoogleUpdate-Interactivity"].c_str());
EXPECT_EQ("", headers["X-GoogleUpdate-AppId"]);
EXPECT_STREQ("fake_prodid-30.0", headers["X-Goog-Update-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-Goog-Update-Interactivity"].c_str());
EXPECT_EQ("", headers["X-Goog-Update-AppId"]);
headers = BuildUpdateCheckExtraRequestHeaders(config, {}, false);
EXPECT_STREQ("fake_prodid-30.0", headers["X-GoogleUpdate-Updater"].c_str());
EXPECT_STREQ("bg", headers["X-GoogleUpdate-Interactivity"].c_str());
EXPECT_EQ("", headers["X-GoogleUpdate-AppId"]);
EXPECT_STREQ("fake_prodid-30.0", headers["X-Goog-Update-Updater"].c_str());
EXPECT_STREQ("bg", headers["X-Goog-Update-Interactivity"].c_str());
EXPECT_EQ("", headers["X-Goog-Update-AppId"]);
headers = BuildUpdateCheckExtraRequestHeaders(
config, {"jebgalgnebhfojomionfpkfelancnnkf"}, true);
EXPECT_STREQ("fake_prodid-30.0", headers["X-GoogleUpdate-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-GoogleUpdate-Interactivity"].c_str());
EXPECT_STREQ("fake_prodid-30.0", headers["X-Goog-Update-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-Goog-Update-Interactivity"].c_str());
EXPECT_STREQ("jebgalgnebhfojomionfpkfelancnnkf",
headers["X-GoogleUpdate-AppId"].c_str());
headers["X-Goog-Update-AppId"].c_str());
headers = BuildUpdateCheckExtraRequestHeaders(
config,
{"jebgalgnebhfojomionfpkfelancnnkf", "ihfokbkgjpifbbojhneepfflplebdkc"},
true);
EXPECT_STREQ("fake_prodid-30.0", headers["X-GoogleUpdate-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-GoogleUpdate-Interactivity"].c_str());
EXPECT_STREQ("fake_prodid-30.0", headers["X-Goog-Update-Updater"].c_str());
EXPECT_STREQ("fg", headers["X-Goog-Update-Interactivity"].c_str());
EXPECT_STREQ(
"jebgalgnebhfojomionfpkfelancnnkf,ihfokbkgjpifbbojhneepfflplebdkc",
headers["X-GoogleUpdate-AppId"].c_str());
headers["X-Goog-Update-AppId"].c_str());
headers = BuildUpdateCheckExtraRequestHeaders(
config, std::vector<std::string>(40, "jebgalgnebhfojomionfpkfelancnnkf"),
......@@ -114,7 +114,7 @@ TEST(BuildProtocolRequest, BuildUpdateCheckExtraRequestHeaders) {
base::JoinString(
std::vector<std::string>(30, "jebgalgnebhfojomionfpkfelancnnkf"), ",")
.c_str(),
headers["X-GoogleUpdate-AppId"].c_str());
headers["X-Goog-Update-AppId"].c_str());
}
} // namespace update_client
......@@ -144,7 +144,7 @@ TEST_P(RequestSenderTest, RequestSendSuccess) {
const bool is_foreground = GetParam();
request_sender_ = std::make_unique<RequestSender>(config_);
request_sender_->Send(
urls, {{"X-GoogleUpdate-Interactivity", is_foreground ? "fg" : "bg"}},
urls, {{"X-Goog-Update-Interactivity", is_foreground ? "fg" : "bg"}},
"test", false,
base::BindOnce(&RequestSenderTest::RequestSenderComplete,
base::Unretained(this)));
......@@ -173,9 +173,9 @@ TEST_P(RequestSenderTest, RequestSendSuccess) {
// Check the interactivity header value.
const auto extra_request_headers =
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;
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());
interceptor_factory_ = nullptr;
......
......@@ -35,7 +35,7 @@ class UpdateChecker {
// |additional_attributes| provides a way to customize the <request> element.
// This value is inserted as-is, therefore it must be well-formed as an
// 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.
// On completion, the state of |components| is mutated as required by the
// server response received.
......
......@@ -300,13 +300,13 @@ TEST_P(UpdateCheckerTest, UpdateCheckSuccess) {
// Check the DDOS protection header values.
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;
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());
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());
extra_request_headers.GetHeader("X-GoogleUpdate-AppId", &header);
extra_request_headers.GetHeader("X-Goog-Update-AppId", &header);
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