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..d2dd26adac77413dcec726baede4ec3a3a700bc6 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( |
Alexei Svitkine (slow)
2014/07/21 20:25:35
Nit: Indentation is off.
Not at Google. Contact bengr
2014/07/21 21:45:09
Done.
|
+ 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" |