summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrajendrant <rajendrant@chromium.org>2016-02-04 15:28:16 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-04 23:30:21 +0000
commit640a478afb2d60c248b793a1d45c7a2400aaa764 (patch)
tree3118a987910907306f44f76601d0fcf99cbdb2d0
parent3f59410718b10864ebb27cc1e73ce98afc7ebc08 (diff)
downloadchromium_src-640a478afb2d60c248b793a1d45c7a2400aaa764.zip
chromium_src-640a478afb2d60c248b793a1d45c7a2400aaa764.tar.gz
chromium_src-640a478afb2d60c248b793a1d45c7a2400aaa764.tar.bz2
Add X-Client-Data to requests to googleweblight.com requests
Requests to googleweblight.com should receive an X-Client-Data header containing the experimental group for the DataCompressionProxyLoFi experiment. Tested with desktop chrome which is part of DataCompressionProxyLoFi experiment and the experiment ID is picked in VariationsHttpHeaderProvider::UpdateVariationIDsHeaderValue (To be landed in M49) BUG=582600 Review URL: https://codereview.chromium.org/1662553002 Cr-Commit-Position: refs/heads/master@{#373658}
-rw-r--r--components/variations/net/variations_http_headers.cc9
-rw-r--r--components/variations/net/variations_http_headers_unittest.cc5
2 files changed, 14 insertions, 0 deletions
diff --git a/components/variations/net/variations_http_headers.cc b/components/variations/net/variations_http_headers.cc
index 2507cbb..48e84eb 100644
--- a/components/variations/net/variations_http_headers.cc
+++ b/components/variations/net/variations_http_headers.cc
@@ -31,6 +31,11 @@ const char* kSuffixesToSetHeadersFor[] = {
".ytimg.com",
};
+// Exact hostnames in lowercase to set headers for.
+const char* kHostsToSetHeadersFor[] = {
+ "googleweblight.com",
+};
+
const char kChromeUMAEnabled[] = "X-Chrome-UMA-Enabled";
const char kClientData[] = "X-Client-Data";
@@ -91,6 +96,10 @@ bool ShouldAppendVariationHeaders(const GURL& url) {
base::CompareCase::INSENSITIVE_ASCII))
return true;
}
+ for (size_t i = 0; i < arraysize(kHostsToSetHeadersFor); ++i) {
+ if (base::LowerCaseEqualsASCII(host, kHostsToSetHeadersFor[i]))
+ return true;
+ }
return google_util::IsYoutubeDomainUrl(url, google_util::ALLOW_SUBDOMAIN,
google_util::ALLOW_NON_STANDARD_PORTS);
diff --git a/components/variations/net/variations_http_headers_unittest.cc b/components/variations/net/variations_http_headers_unittest.cc
index 6b06953..6421cc7 100644
--- a/components/variations/net/variations_http_headers_unittest.cc
+++ b/components/variations/net/variations_http_headers_unittest.cc
@@ -100,6 +100,11 @@ TEST(VariationsHttpHeadersTest, ShouldAppendHeaders) {
{"http://ssl.gstatic.com", true},
{"http://a.b.gstatic.com", true},
{"http://a.b.ytimg.com", true},
+ {"http://googleweblight.com", true},
+ {"https://googleweblight.com", true},
+ {"http://wwwgoogleweblight.com", false},
+ {"http://www.googleweblight.com", false},
+ {"http://a.b.googleweblight.com", false},
};
for (size_t i = 0; i < arraysize(cases); ++i) {