| 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 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2259 testing::ValuesIn(update_range_tests)); | 2259 testing::ValuesIn(update_range_tests)); |
| 2260 | 2260 |
| 2261 TEST(HttpResponseHeadersTest, ToNetLogParamAndBackAgain) { | 2261 TEST(HttpResponseHeadersTest, ToNetLogParamAndBackAgain) { |
| 2262 std::string headers("HTTP/1.1 404\n" | 2262 std::string headers("HTTP/1.1 404\n" |
| 2263 "Content-Length: 450\n" | 2263 "Content-Length: 450\n" |
| 2264 "Connection: keep-alive\n"); | 2264 "Connection: keep-alive\n"); |
| 2265 HeadersToRaw(&headers); | 2265 HeadersToRaw(&headers); |
| 2266 scoped_refptr<net::HttpResponseHeaders> parsed( | 2266 scoped_refptr<net::HttpResponseHeaders> parsed( |
| 2267 new net::HttpResponseHeaders(headers)); | 2267 new net::HttpResponseHeaders(headers)); |
| 2268 | 2268 |
| 2269 scoped_ptr<base::Value> event_param( | 2269 scoped_ptr<base::Value> event_param(parsed->NetLogCallback( |
| 2270 parsed->NetLogCallback(net::NetLog::LOG_ALL_BUT_BYTES)); | 2270 net::NetLogCaptureMode::IncludeCookiesAndCredentials())); |
| 2271 scoped_refptr<net::HttpResponseHeaders> recreated; | 2271 scoped_refptr<net::HttpResponseHeaders> recreated; |
| 2272 | 2272 |
| 2273 ASSERT_TRUE(net::HttpResponseHeaders::FromNetLogParam(event_param.get(), | 2273 ASSERT_TRUE(net::HttpResponseHeaders::FromNetLogParam(event_param.get(), |
| 2274 &recreated)); | 2274 &recreated)); |
| 2275 ASSERT_TRUE(recreated.get()); | 2275 ASSERT_TRUE(recreated.get()); |
| 2276 EXPECT_EQ(parsed->GetHttpVersion(), recreated->GetHttpVersion()); | 2276 EXPECT_EQ(parsed->GetHttpVersion(), recreated->GetHttpVersion()); |
| 2277 EXPECT_EQ(parsed->response_code(), recreated->response_code()); | 2277 EXPECT_EQ(parsed->response_code(), recreated->response_code()); |
| 2278 EXPECT_EQ(parsed->GetContentLength(), recreated->GetContentLength()); | 2278 EXPECT_EQ(parsed->GetContentLength(), recreated->GetContentLength()); |
| 2279 EXPECT_EQ(parsed->IsKeepAlive(), recreated->IsKeepAlive()); | 2279 EXPECT_EQ(parsed->IsKeepAlive(), recreated->IsKeepAlive()); |
| 2280 | 2280 |
| (...skipping 109 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 |