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

Side by Side Diff: net/http/http_response_headers_unittest.cc

Issue 9447084: Refactor Pickle Read methods to use higher performance PickleIterator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile (racing with incoming CLs) Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_response_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « net/http/http_response_headers.cc ('k') | net/http/http_response_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698