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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc

Issue 2224003004: Add Accept-Encoding: br for secure data reduction proxy requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add Accept-Encoding: br for secure data reduction proxy requests Created 4 years, 4 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/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
index d7de09c41d34fd4ed30f33bab1e939c8feddd856..92aec764993b92483dfb5c36c51cbdb9d6f3321e 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate_unittest.cc
@@ -810,6 +810,45 @@ TEST_F(DataReductionProxyNetworkDelegateTest,
1);
}
+TEST_F(DataReductionProxyNetworkDelegateTest, TestAcceptEncodingBrotli) {
+ const struct {
+ net::ProxyServer proxy;
+ bool brotli_enabled;
+ std::string expected_accept_encoding;
+ } tests[] = {
+ {net::ProxyServer(net::ProxyServer::SCHEME_HTTPS,
+ net::HostPortPair("origin.net", 80)),
+ true, "gzip, br"},
+ {net::ProxyServer(net::ProxyServer::SCHEME_QUIC,
+ net::HostPortPair("origin.net", 80)),
+ true, "gzip, br"},
+ {net::ProxyServer(net::ProxyServer::SCHEME_HTTPS,
+ net::HostPortPair("origin.net", 80)),
+ false, "gzip"},
+ {net::ProxyServer(net::ProxyServer::SCHEME_HTTP,
+ net::HostPortPair("origin.net", 80)),
+ true, "gzip"},
+ };
+ for (auto test : tests) {
+ net::ProxyInfo data_reduction_proxy_info;
+ data_reduction_proxy_info.UseProxyServer(test.proxy);
+ net::HttpRequestHeaders headers;
+ headers.SetHeader(net::HttpRequestHeaders::kAcceptEncoding, "gzip");
+ context()->set_enable_brotli(test.brotli_enabled);
+ std::unique_ptr<net::URLRequest> request = context()->CreateRequest(
+ GURL("http://www.google.com/"), net::RequestPriority::IDLE, nullptr);
+
+ network_delegate()->NotifyBeforeSendHeaders(
+ request.get(), data_reduction_proxy_info, net::ProxyRetryInfoMap(),
+ &headers);
+
+ std::string got_accept_encoding;
+ EXPECT_TRUE(headers.GetHeader(net::HttpRequestHeaders::kAcceptEncoding,
+ &got_accept_encoding));
+ EXPECT_EQ(test.expected_accept_encoding, got_accept_encoding);
+ }
+}
+
} // namespace
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698