diff options
author | bengr@chromium.org <bengr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 20:42:27 +0000 |
---|---|---|
committer | bengr@chromium.org <bengr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 20:42:27 +0000 |
commit | a4fd43af496cfbc4185ee01818122ca7ae6926a9 (patch) | |
tree | db589682a4de95d85b7954a0a86571034c6df435 /net/http/http_response_headers_unittest.cc | |
parent | 716c016d95025a8f4d42baab6639b9dc90498f2d (diff) | |
download | chromium_src-a4fd43af496cfbc4185ee01818122ca7ae6926a9.zip chromium_src-a4fd43af496cfbc4185ee01818122ca7ae6926a9.tar.gz chromium_src-a4fd43af496cfbc4185ee01818122ca7ae6926a9.tar.bz2 |
Accept Chrome-Proxy: block=xxx to bypass all Chrome proxies
BUG=325333
Review URL: https://codereview.chromium.org/98373005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_response_headers_unittest.cc')
-rw-r--r-- | net/http/http_response_headers_unittest.cc | 82 |
1 files changed, 55 insertions, 27 deletions
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc index 5904bea..4be7478 100644 --- a/net/http/http_response_headers_unittest.cc +++ b/net/http/http_response_headers_unittest.cc @@ -1884,79 +1884,76 @@ TEST(HttpResponseHeadersTest, GetProxyBypassInfo) { const char* headers; bool expected_result; int64 expected_retry_delay; + bool expected_bypass_all; } tests[] = { { "HTTP/1.1 200 OK\n" "Content-Length: 999\n", false, 0, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Content-Length: 999\n", false, 0, - }, - { "HTTP/1.1 200 OK\n" - "connection: proxy-bypass\n" - "Content-Length: 999\n", - true, - 0, - }, - { "HTTP/1.1 200 OK\n" - "connection: proxy-bypass\n" - "Chrome-Proxy: bypass=86400\n" - "Content-Length: 999\n", - true, - 86400 + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: bypass=86400\n" "Content-Length: 999\n", true, - 86400 + 86400, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: bypass=0\n" "Content-Length: 999\n", true, - 0 + 0, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: bypass=-1\n" "Content-Length: 999\n", false, - 0 + 0, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: bypass=xyz\n" "Content-Length: 999\n", false, - 0 + 0, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: bypass\n" "Content-Length: 999\n", false, - 0 + 0, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: foo=abc, bypass=86400\n" "Content-Length: 999\n", true, - 86400 + 86400, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: bypass=86400, bar=abc\n" "Content-Length: 999\n", true, - 86400 + 86400, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" @@ -1964,21 +1961,24 @@ TEST(HttpResponseHeadersTest, GetProxyBypassInfo) { "Chrome-Proxy: bypass=86400\n" "Content-Length: 999\n", true, - 3600 + 3600, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: bypass=3600, bypass=86400\n" "Content-Length: 999\n", true, - 3600 + 3600, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" "Chrome-Proxy: bypass=, bypass=86400\n" "Content-Length: 999\n", true, - 86400 + 86400, + false, }, { "HTTP/1.1 200 OK\n" "connection: keep-alive\n" @@ -1986,7 +1986,32 @@ TEST(HttpResponseHeadersTest, GetProxyBypassInfo) { "Chrome-Proxy: bypass=86400\n" "Content-Length: 999\n", true, - 86400 + 86400, + false, + }, + { "HTTP/1.1 200 OK\n" + "connection: keep-alive\n" + "Chrome-Proxy: block=, block=3600\n" + "Content-Length: 999\n", + true, + 3600, + true, + }, + { "HTTP/1.1 200 OK\n" + "connection: keep-alive\n" + "Chrome-Proxy: bypass=86400, block=3600\n" + "Content-Length: 999\n", + true, + 3600, + true, + }, + { "HTTP/1.1 200 OK\n" + "connection: proxy-bypass\n" + "Chrome-Proxy: block=, bypass=86400\n" + "Content-Length: 999\n", + true, + 86400, + false, }, }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { @@ -1995,10 +2020,13 @@ TEST(HttpResponseHeadersTest, GetProxyBypassInfo) { scoped_refptr<net::HttpResponseHeaders> parsed( new net::HttpResponseHeaders(headers)); - base::TimeDelta duration; + net::HttpResponseHeaders::ChromeProxyInfo chrome_proxy_info; EXPECT_EQ(tests[i].expected_result, - parsed->GetChromeProxyInfo(&duration)); - EXPECT_EQ(tests[i].expected_retry_delay, duration.InSeconds()); + parsed->GetChromeProxyInfo(&chrome_proxy_info)); + EXPECT_EQ(tests[i].expected_retry_delay, + chrome_proxy_info.bypass_duration.InSeconds()); + EXPECT_EQ(tests[i].expected_bypass_all, + chrome_proxy_info.bypass_all); } } #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |