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 "net/http/http_response_headers.h" | 5 #include "net/http/http_response_headers.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iostream> | 10 #include <iostream> |
11 #include <limits> | 11 #include <limits> |
12 #include <memory> | 12 #include <memory> |
13 | 13 |
14 #include "base/macros.h" | |
14 #include "base/pickle.h" | 15 #include "base/pickle.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
17 #include "net/http/http_byte_range.h" | 18 #include "net/http/http_byte_range.h" |
18 #include "net/log/net_log_capture_mode.h" | 19 #include "net/log/net_log_capture_mode.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 namespace { | 24 namespace { |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 | 774 |
774 class RequiresValidationTest | 775 class RequiresValidationTest |
775 : public HttpResponseHeadersTest, | 776 : public HttpResponseHeadersTest, |
776 public ::testing::WithParamInterface<RequiresValidationTestData> { | 777 public ::testing::WithParamInterface<RequiresValidationTestData> { |
777 }; | 778 }; |
778 | 779 |
779 TEST_P(RequiresValidationTest, RequiresValidation) { | 780 TEST_P(RequiresValidationTest, RequiresValidation) { |
780 const RequiresValidationTestData test = GetParam(); | 781 const RequiresValidationTestData test = GetParam(); |
781 | 782 |
782 base::Time request_time, response_time, current_time; | 783 base::Time request_time, response_time, current_time; |
783 base::Time::FromString("Wed, 28 Nov 2007 00:40:09 GMT", &request_time); | 784 ignore_result( |
784 base::Time::FromString("Wed, 28 Nov 2007 00:40:12 GMT", &response_time); | 785 base::Time::FromString("Wed, 28 Nov 2007 00:40:09 GMT", &request_time)); |
785 base::Time::FromString("Wed, 28 Nov 2007 00:45:20 GMT", ¤t_time); | 786 ignore_result( |
787 base::Time::FromString("Wed, 28 Nov 2007 00:40:12 GMT", &response_time)); | |
788 ignore_result( | |
789 base::Time::FromString("Wed, 28 Nov 2007 00:45:20 GMT", ¤t_time)); | |
mmenke
2017/01/03 15:39:24
Should these all be ASSERT_TRUE?
digit1
2017/01/03 16:44:53
Yes, that sounds more logical, I've uploaded a new
| |
786 | 790 |
787 std::string headers(test.headers); | 791 std::string headers(test.headers); |
788 HeadersToRaw(&headers); | 792 HeadersToRaw(&headers); |
789 scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); | 793 scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); |
790 | 794 |
791 ValidationType validation_type = | 795 ValidationType validation_type = |
792 parsed->RequiresValidation(request_time, response_time, current_time); | 796 parsed->RequiresValidation(request_time, response_time, current_time); |
793 EXPECT_EQ(test.validation_type, validation_type); | 797 EXPECT_EQ(test.validation_type, validation_type); |
794 } | 798 } |
795 | 799 |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2131 TEST_F(HttpResponseHeadersCacheControlTest, | 2135 TEST_F(HttpResponseHeadersCacheControlTest, |
2132 FirstStaleWhileRevalidateValueUsed) { | 2136 FirstStaleWhileRevalidateValueUsed) { |
2133 InitializeHeadersWithCacheControl( | 2137 InitializeHeadersWithCacheControl( |
2134 "stale-while-revalidate=1,stale-while-revalidate=7200"); | 2138 "stale-while-revalidate=1,stale-while-revalidate=7200"); |
2135 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); | 2139 EXPECT_EQ(TimeDelta::FromSeconds(1), GetStaleWhileRevalidateValue()); |
2136 } | 2140 } |
2137 | 2141 |
2138 } // namespace | 2142 } // namespace |
2139 | 2143 |
2140 } // namespace net | 2144 } // namespace net |
OLD | NEW |