diff options
author | bengr@chromium.org <bengr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-14 04:19:00 +0000 |
---|---|---|
committer | bengr@chromium.org <bengr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-14 04:19:00 +0000 |
commit | 4a95f859a4abafb2d429d25f070216e506763315 (patch) | |
tree | e9b03f2aeaca456cff37381f8bfeaa6e2350d9ff /net/http/http_response_headers_unittest.cc | |
parent | 3cc51b98831b18a9df93b4a013d45dd458f67668 (diff) | |
download | chromium_src-4a95f859a4abafb2d429d25f070216e506763315.zip chromium_src-4a95f859a4abafb2d429d25f070216e506763315.tar.gz chromium_src-4a95f859a4abafb2d429d25f070216e506763315.tar.bz2 |
Support for new data reduction proxy via header
This new header conforms to RFC 2616. With this change,
both the old and new header will be supported. Eventually,
support for the old header will be removed.
BUG=340333
Review URL: https://codereview.chromium.org/156373002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251256 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 | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc index 825f5c4..b6211ce 100644 --- a/net/http/http_response_headers_unittest.cc +++ b/net/http/http_response_headers_unittest.cc @@ -2045,4 +2045,74 @@ TEST(HttpResponseHeadersTest, GetProxyBypassInfo) { chrome_proxy_info.bypass_all); } } + +TEST(HttpResponseHeadersTest, IsChromeProxyResponse) { + const struct { + const char* headers; + bool expected_result; + } tests[] = { + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Chrome-Proxy\n", + false, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Chrome-Compression-Proxy\n", + true, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.0 Chrome-Compression-Proxy\n", + true, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Foo-Bar, 1.1 Chrome-Compression-Proxy\n", + true, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Chrome-Compression-Proxy, 1.1 Bar-Foo\n", + true, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 chrome-compression-proxy\n", + false, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Foo-Bar\n" + "Via: 1.1 Chrome-Compression-Proxy\n", + true, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Chrome-Proxy\n", + false, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Chrome Compression Proxy\n", + true, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Foo-Bar, 1.1 Chrome Compression Proxy\n", + true, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Chrome Compression Proxy, 1.1 Bar-Foo\n", + true, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 chrome compression proxy\n", + false, + }, + { "HTTP/1.1 200 OK\n" + "Via: 1.1 Foo-Bar\n" + "Via: 1.1 Chrome Compression Proxy\n", + true, + }, + }; + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { + std::string headers(tests[i].headers); + HeadersToRaw(&headers); + scoped_refptr<net::HttpResponseHeaders> parsed( + new net::HttpResponseHeaders(headers)); + + EXPECT_EQ(tests[i].expected_result, parsed->IsChromeProxyResponse()); + } +} #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |