| 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
|
|
|