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 4848510ccc5605addcb3b5c2c579cd2129c7eada..d06bb8d651ac98b3f5f325b7a66e83fd29d7fcf6 100644 |
| --- a/net/http/http_response_headers_unittest.cc |
| +++ b/net/http/http_response_headers_unittest.cc |
| @@ -1624,6 +1624,57 @@ TEST(HttpResponseHeadersTest, RemoveHeader) { |
| } |
| } |
| +TEST(HttpResponseHeadersTest, RemoveIndividualHeader) { |
| + const struct { |
| + const char* orig_headers; |
| + const char* to_remove_name; |
| + const char* to_remove_value; |
| + const char* expected_headers; |
| + } tests[] = { |
| + { "HTTP/1.1 200 OK\n" |
| + "connection: keep-alive\n" |
| + "Cache-control: max-age=10000\n" |
| + "Content-Length: 450\n", |
| + |
| + "Content-Length", |
| + |
| + "450", |
| + |
| + "HTTP/1.1 200 OK\n" |
| + "connection: keep-alive\n" |
| + "Cache-control: max-age=10000\n" |
| + }, |
| + { "HTTP/1.1 200 OK\n" |
| + "connection: keep-alive \n" |
| + "Content-Length : 450 \n" |
| + "Cache-control: max-age=10000\n", |
| + |
| + "Content-Length", |
| + |
| + "450", |
| + |
| + "HTTP/1.1 200 OK\n" |
| + "connection: keep-alive\n" |
| + "Cache-control: max-age=10000\n" |
| + }, |
| + }; |
|
Matt Perry
2011/11/11 22:05:08
how about a test case where the name matches but t
battre
2011/11/17 12:01:04
Done.
|
| + |
| + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| + std::string orig_headers(tests[i].orig_headers); |
| + HeadersToRaw(&orig_headers); |
| + scoped_refptr<net::HttpResponseHeaders> parsed( |
| + new net::HttpResponseHeaders(orig_headers)); |
| + |
| + std::string name(tests[i].to_remove_name); |
| + std::string value(tests[i].to_remove_value); |
| + parsed->RemoveHeader(name, value); |
| + |
| + std::string resulting_headers; |
| + parsed->GetNormalizedHeaders(&resulting_headers); |
| + EXPECT_EQ(std::string(tests[i].expected_headers), resulting_headers); |
| + } |
| +} |
| + |
| TEST(HttpResponseHeadersTest, ReplaceStatus) { |
| const struct { |
| const char* orig_headers; |