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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « net/http/http_response_headers.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/pickle.h" 9 #include "base/pickle.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 2038
2039 net::HttpResponseHeaders::ChromeProxyInfo chrome_proxy_info; 2039 net::HttpResponseHeaders::ChromeProxyInfo chrome_proxy_info;
2040 EXPECT_EQ(tests[i].expected_result, 2040 EXPECT_EQ(tests[i].expected_result,
2041 parsed->GetChromeProxyInfo(&chrome_proxy_info)); 2041 parsed->GetChromeProxyInfo(&chrome_proxy_info));
2042 EXPECT_EQ(tests[i].expected_retry_delay, 2042 EXPECT_EQ(tests[i].expected_retry_delay,
2043 chrome_proxy_info.bypass_duration.InSeconds()); 2043 chrome_proxy_info.bypass_duration.InSeconds());
2044 EXPECT_EQ(tests[i].expected_bypass_all, 2044 EXPECT_EQ(tests[i].expected_bypass_all,
2045 chrome_proxy_info.bypass_all); 2045 chrome_proxy_info.bypass_all);
2046 } 2046 }
2047 } 2047 }
2048
2049 TEST(HttpResponseHeadersTest, IsChromeProxyResponse) {
2050 const struct {
2051 const char* headers;
2052 bool expected_result;
2053 } tests[] = {
2054 { "HTTP/1.1 200 OK\n"
2055 "Via: 1.1 Chrome-Proxy\n",
2056 false,
2057 },
2058 { "HTTP/1.1 200 OK\n"
2059 "Via: 1.1 Chrome-Compression-Proxy\n",
2060 true,
2061 },
2062 { "HTTP/1.1 200 OK\n"
2063 "Via: 1.0 Chrome-Compression-Proxy\n",
2064 true,
2065 },
2066 { "HTTP/1.1 200 OK\n"
2067 "Via: 1.1 Foo-Bar, 1.1 Chrome-Compression-Proxy\n",
2068 true,
2069 },
2070 { "HTTP/1.1 200 OK\n"
2071 "Via: 1.1 Chrome-Compression-Proxy, 1.1 Bar-Foo\n",
2072 true,
2073 },
2074 { "HTTP/1.1 200 OK\n"
2075 "Via: 1.1 chrome-compression-proxy\n",
2076 false,
2077 },
2078 { "HTTP/1.1 200 OK\n"
2079 "Via: 1.1 Foo-Bar\n"
2080 "Via: 1.1 Chrome-Compression-Proxy\n",
2081 true,
2082 },
2083 { "HTTP/1.1 200 OK\n"
2084 "Via: 1.1 Chrome-Proxy\n",
2085 false,
2086 },
2087 { "HTTP/1.1 200 OK\n"
2088 "Via: 1.1 Chrome Compression Proxy\n",
2089 true,
2090 },
2091 { "HTTP/1.1 200 OK\n"
2092 "Via: 1.1 Foo-Bar, 1.1 Chrome Compression Proxy\n",
2093 true,
2094 },
2095 { "HTTP/1.1 200 OK\n"
2096 "Via: 1.1 Chrome Compression Proxy, 1.1 Bar-Foo\n",
2097 true,
2098 },
2099 { "HTTP/1.1 200 OK\n"
2100 "Via: 1.1 chrome compression proxy\n",
2101 false,
2102 },
2103 { "HTTP/1.1 200 OK\n"
2104 "Via: 1.1 Foo-Bar\n"
2105 "Via: 1.1 Chrome Compression Proxy\n",
2106 true,
2107 },
2108 };
2109 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
2110 std::string headers(tests[i].headers);
2111 HeadersToRaw(&headers);
2112 scoped_refptr<net::HttpResponseHeaders> parsed(
2113 new net::HttpResponseHeaders(headers));
2114
2115 EXPECT_EQ(tests[i].expected_result, parsed->IsChromeProxyResponse());
2116 }
2117 }
2048 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 2118 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
OLDNEW
« 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