| Index: components/data_reduction_proxy/common/data_reduction_proxy_headers_unittest.cc
|
| diff --git a/components/data_reduction_proxy/common/data_reduction_proxy_headers_unittest.cc b/components/data_reduction_proxy/common/data_reduction_proxy_headers_unittest.cc
|
| index 250cf32664157acddd2860f07eebf9e87dd96c90..b677576242554a54f78b234976b6fd3dbcc56e98 100644
|
| --- a/components/data_reduction_proxy/common/data_reduction_proxy_headers_unittest.cc
|
| +++ b/components/data_reduction_proxy/common/data_reduction_proxy_headers_unittest.cc
|
| @@ -54,14 +54,6 @@ TEST_F(DataReductionProxyHeadersTest, GetProxyBypassInfo) {
|
| },
|
| { "HTTP/1.1 200 OK\n"
|
| "connection: keep-alive\n"
|
| - "Chrome-Proxy: bypass=0\n"
|
| - "Content-Length: 999\n",
|
| - true,
|
| - 0,
|
| - false,
|
| - },
|
| - { "HTTP/1.1 200 OK\n"
|
| - "connection: keep-alive\n"
|
| "Chrome-Proxy: bypass=-1\n"
|
| "Content-Length: 999\n",
|
| false,
|
| @@ -183,7 +175,7 @@ TEST_F(DataReductionProxyHeadersTest, GetProxyBypassInfo) {
|
|
|
| DataReductionProxyInfo data_reduction_proxy_info;
|
| EXPECT_EQ(tests[i].expected_result,
|
| - GetDataReductionProxyInfo(parsed, &data_reduction_proxy_info));
|
| + ParseHeadersAndSetProxyInfo(parsed, &data_reduction_proxy_info));
|
| EXPECT_EQ(tests[i].expected_retry_delay,
|
| data_reduction_proxy_info.bypass_duration.InSeconds());
|
| EXPECT_EQ(tests[i].expected_bypass_all,
|
| @@ -191,6 +183,23 @@ TEST_F(DataReductionProxyHeadersTest, GetProxyBypassInfo) {
|
| }
|
| }
|
|
|
| +TEST_F(DataReductionProxyHeadersTest, ParseHeadersAndSetProxyInfo) {
|
| + std::string headers = "HTTP/1.1 200 OK\n"
|
| + "connection: keep-alive\n"
|
| + "Chrome-Proxy: bypass=0\n"
|
| + "Content-Length: 999\n";
|
| + HeadersToRaw(&headers);
|
| + scoped_refptr<net::HttpResponseHeaders> parsed(
|
| + new net::HttpResponseHeaders(headers));
|
| +
|
| + DataReductionProxyInfo data_reduction_proxy_info;
|
| + EXPECT_TRUE(
|
| + ParseHeadersAndSetProxyInfo(parsed, &data_reduction_proxy_info));
|
| + EXPECT_LE(60, data_reduction_proxy_info.bypass_duration.InSeconds());
|
| + EXPECT_GE(5 * 60, data_reduction_proxy_info.bypass_duration.InSeconds());
|
| + EXPECT_FALSE(data_reduction_proxy_info.bypass_all);
|
| +}
|
| +
|
| TEST_F(DataReductionProxyHeadersTest, HasDataReductionProxyViaHeader) {
|
| const struct {
|
| const char* headers;
|
| @@ -274,7 +283,7 @@ TEST_F(DataReductionProxyHeadersTest, GetDataReductionProxyBypassEventType) {
|
| { "HTTP/1.1 200 OK\n"
|
| "Chrome-Proxy: bypass=0\n"
|
| "Via: 1.1 Chrome-Compression-Proxy\n",
|
| - net::ProxyService::SHORT_BYPASS,
|
| + net::ProxyService::MEDIUM_BYPASS,
|
| },
|
| { "HTTP/1.1 200 OK\n"
|
| "Chrome-Proxy: bypass=59\n"
|
|
|