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 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2049 TEST(HttpResponseHeadersTest, IsChromeProxyResponse) { | 2049 TEST(HttpResponseHeadersTest, IsChromeProxyResponse) { |
2050 const struct { | 2050 const struct { |
2051 const char* headers; | 2051 const char* headers; |
2052 bool expected_result; | 2052 bool expected_result; |
2053 } tests[] = { | 2053 } tests[] = { |
2054 { "HTTP/1.1 200 OK\n" | 2054 { "HTTP/1.1 200 OK\n" |
2055 "Via: 1.1 Chrome-Proxy\n", | 2055 "Via: 1.1 Chrome-Proxy\n", |
2056 false, | 2056 false, |
2057 }, | 2057 }, |
2058 { "HTTP/1.1 200 OK\n" | 2058 { "HTTP/1.1 200 OK\n" |
| 2059 "Via: 1\n", |
| 2060 false, |
| 2061 }, |
| 2062 { "HTTP/1.1 200 OK\n" |
2059 "Via: 1.1 Chrome-Compression-Proxy\n", | 2063 "Via: 1.1 Chrome-Compression-Proxy\n", |
2060 true, | 2064 true, |
2061 }, | 2065 }, |
2062 { "HTTP/1.1 200 OK\n" | 2066 { "HTTP/1.1 200 OK\n" |
2063 "Via: 1.0 Chrome-Compression-Proxy\n", | 2067 "Via: 1.0 Chrome-Compression-Proxy\n", |
2064 true, | 2068 true, |
2065 }, | 2069 }, |
2066 { "HTTP/1.1 200 OK\n" | 2070 { "HTTP/1.1 200 OK\n" |
2067 "Via: 1.1 Foo-Bar, 1.1 Chrome-Compression-Proxy\n", | 2071 "Via: 1.1 Foo-Bar, 1.1 Chrome-Compression-Proxy\n", |
2068 true, | 2072 true, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 2113 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
2110 std::string headers(tests[i].headers); | 2114 std::string headers(tests[i].headers); |
2111 HeadersToRaw(&headers); | 2115 HeadersToRaw(&headers); |
2112 scoped_refptr<net::HttpResponseHeaders> parsed( | 2116 scoped_refptr<net::HttpResponseHeaders> parsed( |
2113 new net::HttpResponseHeaders(headers)); | 2117 new net::HttpResponseHeaders(headers)); |
2114 | 2118 |
2115 EXPECT_EQ(tests[i].expected_result, parsed->IsChromeProxyResponse()); | 2119 EXPECT_EQ(tests[i].expected_result, parsed->IsChromeProxyResponse()); |
2116 } | 2120 } |
2117 } | 2121 } |
2118 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 2122 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
OLD | NEW |