Chromium Code Reviews| 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 098ce73e99aa48a85c42311b3876228ac37567f3..ca122d9a6d524ebb58c5bc5244ffc9ceef8d04af 100644 |
| --- a/net/http/http_response_headers_unittest.cc |
| +++ b/net/http/http_response_headers_unittest.cc |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include <algorithm> |
| +#include <iostream> |
| #include <limits> |
| #include "base/basictypes.h" |
| @@ -1582,6 +1583,12 @@ struct KeepAliveTestData { |
| bool expected_keep_alive; |
| }; |
| +void PrintTo(const KeepAliveTestData& keep_alive_test_data, |
|
rvargas (doing something else)
2014/10/15 22:55:21
nit: add a comment about this being gtest related.
Adam Rice
2014/10/16 11:29:38
Done.
|
| + std::ostream* os) { |
| + *os << "{\"" << keep_alive_test_data.headers << "\", " << std::boolalpha |
| + << keep_alive_test_data.expected_keep_alive << "}"; |
| +} |
| + |
| class IsKeepAliveTest |
| : public HttpResponseHeadersTest, |
| public ::testing::WithParamInterface<KeepAliveTestData> { |
| @@ -1656,6 +1663,64 @@ const KeepAliveTestData keepalive_tests[] = { |
| "proxy-connection: keep-alive\n", |
| true |
| }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: Upgrade, close\n", |
| + false |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: Upgrade, keep-alive\n", |
| + true |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: Upgrade\n" |
| + "Connection: close\n", |
| + false |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: Upgrade\n" |
| + "Connection: keep-alive\n", |
| + true |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: close, Upgrade\n", |
| + false |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: keep-alive, Upgrade\n", |
| + true |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: Upgrade\n" |
| + "Proxy-Connection: close\n", |
| + false |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: Upgrade\n" |
| + "Proxy-Connection: keep-alive\n", |
| + true |
| + }, |
| + // In situations where the response headers conflict with themselves, use the |
| + // first one for backwards-compatibility. |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: close\n" |
| + "Connection: keep-alive\n", |
| + false |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "Connection: keep-alive\n" |
| + "Connection: close\n", |
| + true |
| + }, |
| + { "HTTP/1.0 200 OK\n" |
| + "Connection: close\n" |
| + "Connection: keep-alive\n", |
| + false |
| + }, |
| + { "HTTP/1.0 200 OK\n" |
| + "Connection: keep-alive\n" |
| + "Connection: close\n", |
| + true |
| + }, |
| }; |
| INSTANTIATE_TEST_CASE_P(HttpResponseHeaders, |