OLD | NEW |
---|---|
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 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2238 "Chrome-Proxy: bypass=1799\n", | 2238 "Chrome-Proxy: bypass=1799\n", |
2239 net::ProxyService::SHORT_BYPASS, | 2239 net::ProxyService::SHORT_BYPASS, |
2240 }, | 2240 }, |
2241 { "HTTP/1.1 502 Bad Gateway\n", | 2241 { "HTTP/1.1 502 Bad Gateway\n", |
2242 net::ProxyService::INTERNAL_SERVER_ERROR_BYPASS, | 2242 net::ProxyService::INTERNAL_SERVER_ERROR_BYPASS, |
2243 }, | 2243 }, |
2244 { "HTTP/1.1 502 Bad Gateway\n" | 2244 { "HTTP/1.1 502 Bad Gateway\n" |
2245 "Chrome-Proxy: bypass=1799\n", | 2245 "Chrome-Proxy: bypass=1799\n", |
2246 net::ProxyService::SHORT_BYPASS, | 2246 net::ProxyService::SHORT_BYPASS, |
2247 }, | 2247 }, |
2248 { "HTTP/1.1 502 Bad Gateway\n" | |
2249 "Chrome-Proxy: bypass=1799\n", | |
2250 net::ProxyService::SHORT_BYPASS, | |
2251 }, | |
2252 { "HTTP/1.1 414 Request-URI Too Long\n" | |
2253 "Server: GFE/2.0\n", | |
2254 net::ProxyService::PROXY_4XX_BYPASS, | |
2255 }, | |
2256 { "HTTP/1.1 414 Request-URI Too Long\n", | |
2257 net::ProxyService::MISSING_VIA_HEADER, | |
2258 }, | |
2259 { "HTTP/1.1 414 Request-URI Too Long\n" | |
2260 "Via: 1.1 Chrome-Compression-Proxy\n", | |
2261 net::ProxyService::BYPASS_EVENT_TYPE_MAX, | |
2262 }, | |
2263 { "HTTP/1.1 414 Request-URI Too Long\n" | |
2264 "Server: GFE/2.0\n" | |
mef
2014/05/28 15:39:57
What is expected if this was "Server: MyServer/1.5
| |
2265 "Via: 1.1 Chrome-Compression-Proxy\n", | |
2266 net::ProxyService::BYPASS_EVENT_TYPE_MAX, | |
2267 }, | |
2248 }; | 2268 }; |
2249 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 2269 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
2250 std::string headers(tests[i].headers); | 2270 std::string headers(tests[i].headers); |
2251 HeadersToRaw(&headers); | 2271 HeadersToRaw(&headers); |
2252 scoped_refptr<net::HttpResponseHeaders> parsed( | 2272 scoped_refptr<net::HttpResponseHeaders> parsed( |
2253 new net::HttpResponseHeaders(headers)); | 2273 new net::HttpResponseHeaders(headers)); |
2254 net::HttpResponseHeaders::DataReductionProxyInfo chrome_proxy_info; | 2274 net::HttpResponseHeaders::DataReductionProxyInfo chrome_proxy_info; |
2255 EXPECT_EQ(tests[i].expected_result, | 2275 EXPECT_EQ(tests[i].expected_result, |
2256 parsed->GetDataReductionProxyBypassEventType(&chrome_proxy_info)); | 2276 parsed->GetDataReductionProxyBypassEventType(&chrome_proxy_info)); |
2257 } | 2277 } |
2258 } | 2278 } |
2259 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 2279 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
OLD | NEW |