| 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/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 EXPECT_EQ(tests[i].expected_ranges[j].expected_last_byte_position, | 957 EXPECT_EQ(tests[i].expected_ranges[j].expected_last_byte_position, |
| 958 ranges[j].last_byte_position()); | 958 ranges[j].last_byte_position()); |
| 959 EXPECT_EQ(tests[i].expected_ranges[j].expected_suffix_length, | 959 EXPECT_EQ(tests[i].expected_ranges[j].expected_suffix_length, |
| 960 ranges[j].suffix_length()); | 960 ranges[j].suffix_length()); |
| 961 } | 961 } |
| 962 } | 962 } |
| 963 } | 963 } |
| 964 } | 964 } |
| 965 | 965 |
| 966 TEST(HttpUtilTest, ParseRetryAfterHeader) { | 966 TEST(HttpUtilTest, ParseRetryAfterHeader) { |
| 967 base::Time::Exploded now_exploded = { 2014, 11, -1, 5, 22, 39, 30, 0 }; | 967 base::Time::Exploded now_exploded = {2014, 11, 4, 5, 22, 39, 30, 0}; |
| 968 base::Time now = base::Time::FromUTCExploded(now_exploded); | 968 base::Time now = base::Time::FromUTCExploded(now_exploded); |
| 969 | 969 |
| 970 base::Time::Exploded later_exploded = { 2015, 1, -1, 1, 12, 34, 56, 0 }; | 970 base::Time::Exploded later_exploded = {2015, 1, 5, 1, 12, 34, 56, 0}; |
| 971 base::Time later = base::Time::FromUTCExploded(later_exploded); | 971 base::Time later = base::Time::FromUTCExploded(later_exploded); |
| 972 | 972 |
| 973 const struct { | 973 const struct { |
| 974 const char* retry_after_string; | 974 const char* retry_after_string; |
| 975 bool expected_return_value; | 975 bool expected_return_value; |
| 976 base::TimeDelta expected_retry_after; | 976 base::TimeDelta expected_retry_after; |
| 977 } tests[] = { | 977 } tests[] = { |
| 978 { "", false, base::TimeDelta() }, | 978 { "", false, base::TimeDelta() }, |
| 979 { "-3", false, base::TimeDelta() }, | 979 { "-3", false, base::TimeDelta() }, |
| 980 { "-2", false, base::TimeDelta() }, | 980 { "-2", false, base::TimeDelta() }, |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1402 EXPECT_FALSE(HttpUtil::IsToken("hello, world")); | 1402 EXPECT_FALSE(HttpUtil::IsToken("hello, world")); |
| 1403 EXPECT_FALSE(HttpUtil::IsToken(" ")); | 1403 EXPECT_FALSE(HttpUtil::IsToken(" ")); |
| 1404 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece("\0", 1))); | 1404 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece("\0", 1))); |
| 1405 EXPECT_FALSE(HttpUtil::IsToken("\x01")); | 1405 EXPECT_FALSE(HttpUtil::IsToken("\x01")); |
| 1406 EXPECT_FALSE(HttpUtil::IsToken("\x7F")); | 1406 EXPECT_FALSE(HttpUtil::IsToken("\x7F")); |
| 1407 EXPECT_FALSE(HttpUtil::IsToken("\x80")); | 1407 EXPECT_FALSE(HttpUtil::IsToken("\x80")); |
| 1408 EXPECT_FALSE(HttpUtil::IsToken("\xff")); | 1408 EXPECT_FALSE(HttpUtil::IsToken("\xff")); |
| 1409 } | 1409 } |
| 1410 | 1410 |
| 1411 } // namespace net | 1411 } // namespace net |
| OLD | NEW |