| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
|
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
|
| index 147a283d317332a3016e72c3320f26aec1478a50..00ca8f5f5d3bfa06c5837c0709d9b2ec579e90cc 100644
|
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
|
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc
|
| @@ -343,63 +343,72 @@ TEST_F(DataReductionProxyDelegateTest, OnResolveProxyHandler) {
|
| net::ProxyRetryInfo retry_info;
|
| retry_info.current_delay = base::TimeDelta::FromSeconds(1000);
|
| retry_info.bad_until = base::TimeTicks().Now() + retry_info.current_delay;
|
| retry_info.try_while_bad = false;
|
| data_reduction_proxy_retry_info[data_reduction_proxy_info.proxy_server()
|
| .ToURI()] = retry_info;
|
|
|
| net::ProxyInfo result;
|
| // Another proxy is used. It should be used afterwards.
|
| result.Use(other_proxy_info);
|
| - OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
|
| + OnResolveProxyHandler(url, "GET", load_flags, data_reduction_proxy_config,
|
| empty_proxy_retry_info, config(), &result);
|
| EXPECT_EQ(other_proxy_info.proxy_server(), result.proxy_server());
|
|
|
| // A direct connection is used. The data reduction proxy should be used
|
| // afterwards.
|
| // Another proxy is used. It should be used afterwards.
|
| result.Use(direct_proxy_info);
|
| net::ProxyConfig::ID prev_id = result.config_id();
|
| - OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
|
| + OnResolveProxyHandler(url, "GET", load_flags, data_reduction_proxy_config,
|
| empty_proxy_retry_info, config(), &result);
|
| EXPECT_EQ(data_reduction_proxy_info.proxy_server(), result.proxy_server());
|
| // Only the proxy list should be updated, not he proxy info.
|
| EXPECT_EQ(result.config_id(), prev_id);
|
|
|
| // A direct connection is used, but the data reduction proxy is on the retry
|
| // list. A direct connection should be used afterwards.
|
| result.Use(direct_proxy_info);
|
| prev_id = result.config_id();
|
| - OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
|
| + OnResolveProxyHandler(GURL("ws://echo.websocket.org/"), "GET", load_flags,
|
| + data_reduction_proxy_config,
|
| data_reduction_proxy_retry_info, config(), &result);
|
| EXPECT_TRUE(result.proxy_server().is_direct());
|
| EXPECT_EQ(result.config_id(), prev_id);
|
|
|
| // Test that ws:// and wss:// URLs bypass the data reduction proxy.
|
| result.UseDirect();
|
| - OnResolveProxyHandler(GURL("ws://echo.websocket.org/"), load_flags,
|
| + OnResolveProxyHandler(GURL("wss://echo.websocket.org/"), "GET", load_flags,
|
| data_reduction_proxy_config, empty_proxy_retry_info,
|
| config(), &result);
|
| EXPECT_TRUE(result.is_direct());
|
|
|
| - OnResolveProxyHandler(GURL("wss://echo.websocket.org/"), load_flags,
|
| + result.UseDirect();
|
| + OnResolveProxyHandler(GURL("wss://echo.websocket.org/"), "GET", load_flags,
|
| data_reduction_proxy_config, empty_proxy_retry_info,
|
| config(), &result);
|
| EXPECT_TRUE(result.is_direct());
|
|
|
| + // POST methods go direct.
|
| + result.UseDirect();
|
| + OnResolveProxyHandler(url, "POST", load_flags, data_reduction_proxy_config,
|
| + empty_proxy_retry_info, config(), &result);
|
| + EXPECT_TRUE(result.is_direct());
|
| +
|
| // Without DataCompressionProxyCriticalBypass Finch trial set, the
|
| // BYPASS_DATA_REDUCTION_PROXY load flag should be ignored.
|
| - OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
|
| + result.UseDirect();
|
| + OnResolveProxyHandler(url, "GET", load_flags, data_reduction_proxy_config,
|
| empty_proxy_retry_info, config(), &result);
|
| EXPECT_FALSE(result.is_direct());
|
|
|
| - OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config,
|
| + OnResolveProxyHandler(url, "GET", load_flags, data_reduction_proxy_config,
|
| empty_proxy_retry_info, config(), &other_proxy_info);
|
| EXPECT_FALSE(other_proxy_info.is_direct());
|
| }
|
|
|
| // Verifies that requests that were not proxied through data saver proxy due to
|
| // missing config are recorded properly.
|
| TEST_F(DataReductionProxyDelegateTest, HTTPRequests) {
|
| const struct {
|
| std::string url;
|
| bool enabled_by_user;
|
| @@ -467,22 +476,23 @@ TEST_F(DataReductionProxyDelegateTest, HTTPRequests) {
|
| false /* at_startup */);
|
|
|
| net::ProxyRetryInfoMap empty_proxy_retry_info;
|
|
|
| net::ProxyInfo direct_proxy_info;
|
| direct_proxy_info.UseDirect();
|
| EXPECT_TRUE(direct_proxy_info.is_direct());
|
|
|
| net::ProxyInfo result;
|
| result.Use(direct_proxy_info);
|
| - OnResolveProxyHandler(url, net::LOAD_NORMAL, data_reduction_proxy_config,
|
| - empty_proxy_retry_info, config(), &result);
|
| + OnResolveProxyHandler(url, "GET", net::LOAD_NORMAL,
|
| + data_reduction_proxy_config, empty_proxy_retry_info,
|
| + config(), &result);
|
| histogram_tester.ExpectTotalCount(
|
| "DataReductionProxy.ConfigService.HTTPRequests",
|
| tests[i].expect_histogram ? 1 : 0);
|
|
|
| if (tests[i].expect_histogram) {
|
| histogram_tester.ExpectUniqueSample(
|
| "DataReductionProxy.ConfigService.HTTPRequests",
|
| tests[i].use_direct_proxy ? 0 : 1, 1);
|
| }
|
| }
|
|
|