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

Unified Diff: net/http/http_response_headers_unittest.cc

Issue 640213002: Make HRH::IsKeepAlive() look past the first header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« net/http/http_response_headers.cc ('K') | « net/http/http_response_headers.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« net/http/http_response_headers.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