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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 std::string headers = test.raw_headers; | 339 std::string headers = test.raw_headers; |
340 HeadersToRaw(&headers); | 340 HeadersToRaw(&headers); |
341 scoped_refptr<net::HttpResponseHeaders> parsed1( | 341 scoped_refptr<net::HttpResponseHeaders> parsed1( |
342 new net::HttpResponseHeaders(headers)); | 342 new net::HttpResponseHeaders(headers)); |
343 | 343 |
344 Pickle pickle; | 344 Pickle pickle; |
345 parsed1->Persist(&pickle, test.options); | 345 parsed1->Persist(&pickle, test.options); |
346 | 346 |
347 PickleIterator iter(pickle); | 347 PickleIterator iter(pickle); |
348 scoped_refptr<net::HttpResponseHeaders> parsed2( | 348 scoped_refptr<net::HttpResponseHeaders> parsed2( |
349 new net::HttpResponseHeaders(pickle, &iter)); | 349 new net::HttpResponseHeaders(&iter)); |
350 | 350 |
351 std::string h2; | 351 std::string h2; |
352 parsed2->GetNormalizedHeaders(&h2); | 352 parsed2->GetNormalizedHeaders(&h2); |
353 EXPECT_EQ(std::string(test.expected_headers), h2); | 353 EXPECT_EQ(std::string(test.expected_headers), h2); |
354 } | 354 } |
355 | 355 |
356 const struct PersistData persistence_tests[] = { | 356 const struct PersistData persistence_tests[] = { |
357 { net::HttpResponseHeaders::PERSIST_ALL, | 357 { net::HttpResponseHeaders::PERSIST_ALL, |
358 "HTTP/1.1 200 OK\n" | 358 "HTTP/1.1 200 OK\n" |
359 "Cache-control:private\n" | 359 "Cache-control:private\n" |
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2390 } | 2390 } |
2391 | 2391 |
2392 TEST_F(HttpResponseHeadersCacheControlTest, | 2392 TEST_F(HttpResponseHeadersCacheControlTest, |
2393 FirstStaleWhileRevalidateValueUsed) { | 2393 FirstStaleWhileRevalidateValueUsed) { |
2394 InitializeHeadersWithCacheControl( | 2394 InitializeHeadersWithCacheControl( |
2395 "stale-while-revalidate=1,stale-while-revalidate=7200"); | 2395 "stale-while-revalidate=1,stale-while-revalidate=7200"); |
2396 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); | 2396 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); |
2397 } | 2397 } |
2398 | 2398 |
2399 } // end namespace | 2399 } // end namespace |
OLD | NEW |