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

Unified Diff: net/http/http_response_headers_unittest.cc

Issue 164304: Http cache: Extend support for byte range requests.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/partial_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_headers_unittest.cc
===================================================================
--- net/http/http_response_headers_unittest.cc (revision 22968)
+++ net/http/http_response_headers_unittest.cc (working copy)
@@ -1504,3 +1504,58 @@
EXPECT_EQ(string(tests[i].expected_headers), resulting_headers);
}
}
+
+TEST(HttpResponseHeadersTest, ReplaceStatus) {
+ const struct {
+ const char* orig_headers;
+ const char* new_status;
+ const char* expected_headers;
+ } tests[] = {
+ { "HTTP/1.1 206 Partial Content\n"
+ "connection: keep-alive\n"
+ "Cache-control: max-age=10000\n"
+ "Content-Length: 450\n",
+
+ "HTTP/1.1 200 OK",
+
+ "HTTP/1.1 200 OK\n"
+ "connection: keep-alive\n"
+ "Cache-control: max-age=10000\n"
+ "Content-Length: 450\n"
+ },
+ { "HTTP/1.1 200 OK\n"
+ "connection: keep-alive\n",
+
+ "HTTP/1.1 304 Not Modified",
+
+ "HTTP/1.1 304 Not Modified\n"
+ "connection: keep-alive\n"
+ },
+ { "HTTP/1.1 200 OK\n"
+ "connection: keep-alive \n"
+ "Content-Length : 450 \n"
+ "Cache-control: max-age=10000\n",
+
+ "HTTP/1//1 304 Not Modified",
+
+ "HTTP/1.0 304 Not Modified\n"
+ "connection: keep-alive\n"
+ "Content-Length: 450\n"
+ "Cache-control: max-age=10000\n"
+ },
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
+ string orig_headers(tests[i].orig_headers);
+ HeadersToRaw(&orig_headers);
+ scoped_refptr<HttpResponseHeaders> parsed =
+ new HttpResponseHeaders(orig_headers);
+
+ string name(tests[i].new_status);
+ parsed->ReplaceStatusLine(name);
+
+ string resulting_headers;
+ parsed->GetNormalizedHeaders(&resulting_headers);
+ EXPECT_EQ(string(tests[i].expected_headers), resulting_headers);
+ }
+}
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/partial_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698