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 #include <iostream> | 6 #include <iostream> |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 public ::testing::WithParamInterface<PersistData> { | 308 public ::testing::WithParamInterface<PersistData> { |
309 }; | 309 }; |
310 | 310 |
311 TEST_P(PersistenceTest, Persist) { | 311 TEST_P(PersistenceTest, Persist) { |
312 const PersistData test = GetParam(); | 312 const PersistData test = GetParam(); |
313 | 313 |
314 std::string headers = test.raw_headers; | 314 std::string headers = test.raw_headers; |
315 HeadersToRaw(&headers); | 315 HeadersToRaw(&headers); |
316 scoped_refptr<HttpResponseHeaders> parsed1(new HttpResponseHeaders(headers)); | 316 scoped_refptr<HttpResponseHeaders> parsed1(new HttpResponseHeaders(headers)); |
317 | 317 |
318 Pickle pickle; | 318 base::Pickle pickle; |
319 parsed1->Persist(&pickle, test.options); | 319 parsed1->Persist(&pickle, test.options); |
320 | 320 |
321 PickleIterator iter(pickle); | 321 base::PickleIterator iter(pickle); |
322 scoped_refptr<HttpResponseHeaders> parsed2(new HttpResponseHeaders(&iter)); | 322 scoped_refptr<HttpResponseHeaders> parsed2(new HttpResponseHeaders(&iter)); |
323 | 323 |
324 std::string h2; | 324 std::string h2; |
325 parsed2->GetNormalizedHeaders(&h2); | 325 parsed2->GetNormalizedHeaders(&h2); |
326 EXPECT_EQ(std::string(test.expected_headers), h2); | 326 EXPECT_EQ(std::string(test.expected_headers), h2); |
327 } | 327 } |
328 | 328 |
329 const struct PersistData persistence_tests[] = { | 329 const struct PersistData persistence_tests[] = { |
330 {HttpResponseHeaders::PERSIST_ALL, | 330 {HttpResponseHeaders::PERSIST_ALL, |
331 "HTTP/1.1 200 OK\n" | 331 "HTTP/1.1 200 OK\n" |
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2327 TEST_F(HttpResponseHeadersCacheControlTest, | 2327 TEST_F(HttpResponseHeadersCacheControlTest, |
2328 FirstStaleWhileRevalidateValueUsed) { | 2328 FirstStaleWhileRevalidateValueUsed) { |
2329 InitializeHeadersWithCacheControl( | 2329 InitializeHeadersWithCacheControl( |
2330 "stale-while-revalidate=1,stale-while-revalidate=7200"); | 2330 "stale-while-revalidate=1,stale-while-revalidate=7200"); |
2331 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); | 2331 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); |
2332 } | 2332 } |
2333 | 2333 |
2334 } // namespace | 2334 } // namespace |
2335 | 2335 |
2336 } // namespace net | 2336 } // namespace net |
OLD | NEW |