Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: net/http/http_response_headers_unittest.cc

Issue 156373002: Support for new data reduction proxy via header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed compilation error on unsupported platforms Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_response_headers.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_headers_unittest.cc
diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc
index 825f5c46585dbb3e78d1a49783b7e2819ab033a4..b6211ce5389fcfefb33259c1f05841c4934bcd7f 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)
« no previous file with comments | « net/http/http_response_headers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698