| 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/pickle.h" | 8 #include "base/pickle.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 | 468 |
| 469 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 469 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
| 470 std::string headers = tests[i].raw_headers; | 470 std::string headers = tests[i].raw_headers; |
| 471 HeadersToRaw(&headers); | 471 HeadersToRaw(&headers); |
| 472 scoped_refptr<net::HttpResponseHeaders> parsed1( | 472 scoped_refptr<net::HttpResponseHeaders> parsed1( |
| 473 new net::HttpResponseHeaders(headers)); | 473 new net::HttpResponseHeaders(headers)); |
| 474 | 474 |
| 475 Pickle pickle; | 475 Pickle pickle; |
| 476 parsed1->Persist(&pickle, tests[i].options); | 476 parsed1->Persist(&pickle, tests[i].options); |
| 477 | 477 |
| 478 void* iter = NULL; | 478 PickleIterator iter(pickle); |
| 479 scoped_refptr<net::HttpResponseHeaders> parsed2( | 479 scoped_refptr<net::HttpResponseHeaders> parsed2( |
| 480 new net::HttpResponseHeaders(pickle, &iter)); | 480 new net::HttpResponseHeaders(pickle, &iter)); |
| 481 | 481 |
| 482 std::string h2; | 482 std::string h2; |
| 483 parsed2->GetNormalizedHeaders(&h2); | 483 parsed2->GetNormalizedHeaders(&h2); |
| 484 EXPECT_EQ(std::string(tests[i].expected_headers), h2); | 484 EXPECT_EQ(std::string(tests[i].expected_headers), h2); |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 TEST(HttpResponseHeadersTest, EnumerateHeader_Coalesced) { | 488 TEST(HttpResponseHeadersTest, EnumerateHeader_Coalesced) { |
| (...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 new net::HttpResponseHeaders(orig_headers)); | 1749 new net::HttpResponseHeaders(orig_headers)); |
| 1750 | 1750 |
| 1751 std::string name(tests[i].new_status); | 1751 std::string name(tests[i].new_status); |
| 1752 parsed->ReplaceStatusLine(name); | 1752 parsed->ReplaceStatusLine(name); |
| 1753 | 1753 |
| 1754 std::string resulting_headers; | 1754 std::string resulting_headers; |
| 1755 parsed->GetNormalizedHeaders(&resulting_headers); | 1755 parsed->GetNormalizedHeaders(&resulting_headers); |
| 1756 EXPECT_EQ(std::string(tests[i].expected_headers), resulting_headers); | 1756 EXPECT_EQ(std::string(tests[i].expected_headers), resulting_headers); |
| 1757 } | 1757 } |
| 1758 } | 1758 } |
| OLD | NEW |