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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 std::string orig_headers(tests[i].orig_headers); | 962 std::string orig_headers(tests[i].orig_headers); |
963 HeadersToRaw(&orig_headers); | 963 HeadersToRaw(&orig_headers); |
964 scoped_refptr<net::HttpResponseHeaders> parsed( | 964 scoped_refptr<net::HttpResponseHeaders> parsed( |
965 new net::HttpResponseHeaders(orig_headers)); | 965 new net::HttpResponseHeaders(orig_headers)); |
966 | 966 |
967 std::string new_headers(tests[i].new_headers); | 967 std::string new_headers(tests[i].new_headers); |
968 HeadersToRaw(&new_headers); | 968 HeadersToRaw(&new_headers); |
969 scoped_refptr<net::HttpResponseHeaders> new_parsed( | 969 scoped_refptr<net::HttpResponseHeaders> new_parsed( |
970 new net::HttpResponseHeaders(new_headers)); | 970 new net::HttpResponseHeaders(new_headers)); |
971 | 971 |
972 parsed->Update(*new_parsed); | 972 parsed->Update(*new_parsed.get()); |
973 | 973 |
974 std::string resulting_headers; | 974 std::string resulting_headers; |
975 parsed->GetNormalizedHeaders(&resulting_headers); | 975 parsed->GetNormalizedHeaders(&resulting_headers); |
976 EXPECT_EQ(std::string(tests[i].expected_headers), resulting_headers); | 976 EXPECT_EQ(std::string(tests[i].expected_headers), resulting_headers); |
977 } | 977 } |
978 } | 978 } |
979 | 979 |
980 TEST(HttpResponseHeadersTest, EnumerateHeaderLines) { | 980 TEST(HttpResponseHeadersTest, EnumerateHeaderLines) { |
981 const struct { | 981 const struct { |
982 const char* headers; | 982 const char* headers; |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 EXPECT_EQ(parsed->response_code(), recreated->response_code()); | 1870 EXPECT_EQ(parsed->response_code(), recreated->response_code()); |
1871 EXPECT_EQ(parsed->GetContentLength(), recreated->GetContentLength()); | 1871 EXPECT_EQ(parsed->GetContentLength(), recreated->GetContentLength()); |
1872 EXPECT_EQ(parsed->IsKeepAlive(), recreated->IsKeepAlive()); | 1872 EXPECT_EQ(parsed->IsKeepAlive(), recreated->IsKeepAlive()); |
1873 | 1873 |
1874 std::string normalized_parsed; | 1874 std::string normalized_parsed; |
1875 parsed->GetNormalizedHeaders(&normalized_parsed); | 1875 parsed->GetNormalizedHeaders(&normalized_parsed); |
1876 std::string normalized_recreated; | 1876 std::string normalized_recreated; |
1877 parsed->GetNormalizedHeaders(&normalized_recreated); | 1877 parsed->GetNormalizedHeaders(&normalized_recreated); |
1878 EXPECT_EQ(normalized_parsed, normalized_recreated); | 1878 EXPECT_EQ(normalized_parsed, normalized_recreated); |
1879 } | 1879 } |
OLD | NEW |