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/time.h" | 10 #include "base/time/time.h" |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 base::Time::FromString("Wed, 28 Nov 2007 00:40:12 GMT", &response_time); | 860 base::Time::FromString("Wed, 28 Nov 2007 00:40:12 GMT", &response_time); |
861 base::Time::FromString("Wed, 28 Nov 2007 00:45:20 GMT", ¤t_time); | 861 base::Time::FromString("Wed, 28 Nov 2007 00:45:20 GMT", ¤t_time); |
862 | 862 |
863 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 863 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
864 std::string headers(tests[i].headers); | 864 std::string headers(tests[i].headers); |
865 HeadersToRaw(&headers); | 865 HeadersToRaw(&headers); |
866 scoped_refptr<net::HttpResponseHeaders> parsed( | 866 scoped_refptr<net::HttpResponseHeaders> parsed( |
867 new net::HttpResponseHeaders(headers)); | 867 new net::HttpResponseHeaders(headers)); |
868 | 868 |
869 bool requires_validation = | 869 bool requires_validation = |
870 parsed->RequiresValidation(request_time, response_time, current_time); | 870 parsed->GetFreshnessExpiry(request_time, response_time) <= current_time; |
871 EXPECT_EQ(tests[i].requires_validation, requires_validation); | 871 EXPECT_EQ(tests[i].requires_validation, requires_validation); |
872 } | 872 } |
873 } | 873 } |
874 | 874 |
875 TEST(HttpResponseHeadersTest, Update) { | 875 TEST(HttpResponseHeadersTest, Update) { |
876 const struct { | 876 const struct { |
877 const char* orig_headers; | 877 const char* orig_headers; |
878 const char* new_headers; | 878 const char* new_headers; |
879 const char* expected_headers; | 879 const char* expected_headers; |
880 } tests[] = { | 880 } tests[] = { |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { | 2109 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { |
2110 std::string headers(tests[i].headers); | 2110 std::string headers(tests[i].headers); |
2111 HeadersToRaw(&headers); | 2111 HeadersToRaw(&headers); |
2112 scoped_refptr<net::HttpResponseHeaders> parsed( | 2112 scoped_refptr<net::HttpResponseHeaders> parsed( |
2113 new net::HttpResponseHeaders(headers)); | 2113 new net::HttpResponseHeaders(headers)); |
2114 | 2114 |
2115 EXPECT_EQ(tests[i].expected_result, parsed->IsChromeProxyResponse()); | 2115 EXPECT_EQ(tests[i].expected_result, parsed->IsChromeProxyResponse()); |
2116 } | 2116 } |
2117 } | 2117 } |
2118 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 2118 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
OLD | NEW |