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

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: Addressed comments 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
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..2145096c528c1964cc0b6d92ad5c0eacf7f1a0d7 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",
mef 2014/02/12 21:36:50 I think Foo Bar is not a valid token, is it?
bengr 2014/02/13 00:17:38 It isn't. Changed.
+ 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)
« chrome/renderer/page_load_histograms.cc ('K') | « net/http/http_response_headers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698