Chromium Code Reviews| 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 9bba71559543bee418bc89c011928d828eb31859..16690f99f7aa428d437deabb16fe14cc832f0b00 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,76 @@ TEST_F(DataReductionProxyDelegateTest, OnResolveProxyHandler) { |
| 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, |
| - empty_proxy_retry_info, config(), &result); |
| + empty_proxy_retry_info, config(), "GET", &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, |
| - empty_proxy_retry_info, config(), &result); |
| + empty_proxy_retry_info, config(), "GET", &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, |
| - data_reduction_proxy_retry_info, config(), &result); |
| + data_reduction_proxy_retry_info, config(), "GET", |
| + &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, |
| data_reduction_proxy_config, empty_proxy_retry_info, |
| - config(), &result); |
| + config(), "GET", &result); |
| EXPECT_TRUE(result.is_direct()); |
| + // Reset result, so if the previous test sets result to something else, |
| + // we will fail the test rather than hitting a crash from the DCHECK in |
|
bengr
2016/02/16 20:00:13
Don't personify code and use complete sentences. I
RyanSturm
2016/02/17 21:46:11
I removed it
|
| + // OnResolveProxyHandler |
| + result.UseDirect(); |
| OnResolveProxyHandler(GURL("wss://echo.websocket.org/"), load_flags, |
| data_reduction_proxy_config, empty_proxy_retry_info, |
| - config(), &result); |
| + config(), "GET", &result); |
| + EXPECT_TRUE(result.is_direct()); |
| + |
| + // POST methods go direct |
|
bengr
2016/02/16 20:00:13
direct -> direct.
RyanSturm
2016/02/17 21:46:11
Done.
|
| + result.UseDirect(); |
| + OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config, |
| + empty_proxy_retry_info, config(), "POST", &result); |
| EXPECT_TRUE(result.is_direct()); |
| // Without DataCompressionProxyCriticalBypass Finch trial set, the |
| // BYPASS_DATA_REDUCTION_PROXY load flag should be ignored. |
| + result.UseDirect(); |
| OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config, |
| - empty_proxy_retry_info, config(), &result); |
| + empty_proxy_retry_info, config(), "GET", &result); |
| EXPECT_FALSE(result.is_direct()); |
| OnResolveProxyHandler(url, load_flags, data_reduction_proxy_config, |
| - empty_proxy_retry_info, config(), &other_proxy_info); |
| + empty_proxy_retry_info, config(), "GET", |
| + &other_proxy_info); |
| EXPECT_FALSE(other_proxy_info.is_direct()); |
| } |
| #if defined(OS_ANDROID) |
| #define MAYBE_OnCompletedInternalLoFi DISABLED_OnCompletedInternalLoFi |
| #else |
| #define MAYBE_OnCompletedInternalLoFi OnCompletedInternalLoFi |
| #endif |
| #if defined(OS_ANDROID) |