| Index: net/proxy/proxy_service_unittest.cc
|
| diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
|
| index 609067145b5ac42e39026c7f284dd5a6fb32aee1..67e8ba15a172d066cec8b0c21c4b10acc5d3b3db 100644
|
| --- a/net/proxy/proxy_service_unittest.cc
|
| +++ b/net/proxy/proxy_service_unittest.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "net/proxy/proxy_service.h"
|
|
|
| +#include <string>
|
| #include <vector>
|
|
|
| #include "base/format_macros.h"
|
| @@ -239,6 +240,22 @@ class TestProxyFallbackNetworkDelegate : public NetworkDelegateImpl {
|
| int proxy_fallback_net_error_;
|
| };
|
|
|
| +void CheckResolvedProxyMatches(ProxyService* service,
|
| + const GURL& url,
|
| + const std::string& result_string) {
|
| + ProxyInfo expected_result;
|
| + expected_result.UseNamedProxy(result_string);
|
| +
|
| + ProxyInfo result;
|
| + BoundTestNetLog log;
|
| + EXPECT_TRUE(service->TryResolveProxySynchronously(url, LOAD_NORMAL, &result,
|
| + nullptr, log.bound()));
|
| +
|
| + EXPECT_TRUE(expected_result.proxy_list().Equals(result.proxy_list()))
|
| + << "expected: " << expected_result.proxy_list().ToPacString()
|
| + << "\nactual: " << result.proxy_list().ToPacString();
|
| +}
|
| +
|
| } // namespace
|
|
|
| TEST_F(ProxyServiceTest, Direct) {
|
| @@ -3246,4 +3263,53 @@ TEST_F(ProxyServiceTest, SynchronousWithFixedConfiguration) {
|
| EXPECT_EQ(0u, factory->pending_requests().size());
|
| }
|
|
|
| +TEST_F(ProxyServiceTest, ExcludeGooglezipDataReductionProxiesFromRules) {
|
| + const std::string kDataReductionProxies =
|
| + "https://proxy.googlezip.net:443,compress.googlezip.net,"
|
| + "https://proxy-dev.googlezip.net:443,proxy-dev.googlezip.net,"
|
| + "quic://proxy.googlezip.net";
|
| +
|
| + struct {
|
| + std::string initial_proxy_rules;
|
| + const char* http_proxy_info;
|
| + const char* https_proxy_info;
|
| + const char* ftp_proxy_info;
|
| + } test_cases[] = {
|
| + {"http=foopyhttp," + kDataReductionProxies +
|
| + ",direct://;https=foopyhttps," + kDataReductionProxies +
|
| + ",direct://;ftp=foopyftp," + kDataReductionProxies + ",direct://",
|
| + "foopyhttp;direct://",
|
| + "foopyhttps;direct://",
|
| + "foopyftp;direct://"},
|
| +
|
| + {"foopy," + kDataReductionProxies + ",direct://",
|
| + "foopy;direct://",
|
| + "foopy;direct://",
|
| + "foopy;direct://"},
|
| +
|
| + {"http=" + kDataReductionProxies + ";https=" + kDataReductionProxies +
|
| + ";ftp=" + kDataReductionProxies,
|
| + "direct://",
|
| + "direct://",
|
| + "direct://"},
|
| +
|
| + {"http=" + kDataReductionProxies + ",foopy,direct://",
|
| + "foopy;direct://",
|
| + "direct://",
|
| + "direct://"},
|
| + };
|
| +
|
| + for (const auto& test : test_cases) {
|
| + scoped_ptr<ProxyService> service(
|
| + ProxyService::CreateFixed(test.initial_proxy_rules));
|
| +
|
| + CheckResolvedProxyMatches(service.get(), GURL("http://google.com"),
|
| + test.http_proxy_info);
|
| + CheckResolvedProxyMatches(service.get(), GURL("https://google.com"),
|
| + test.https_proxy_info);
|
| + CheckResolvedProxyMatches(service.get(), GURL("ftp://google.com"),
|
| + test.ftp_proxy_info);
|
| + }
|
| +}
|
| +
|
| } // namespace net
|
|
|