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 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, -1, 5, 22, 39, 30, 0 }; |
968 base::Time now = base::Time::FromUTCExploded(now_exploded); | 968 base::Time now; |
| 969 EXPECT_TRUE(base::Time::FromUTCExploded(now_exploded, &now)); |
969 | 970 |
970 base::Time::Exploded later_exploded = { 2015, 1, -1, 1, 12, 34, 56, 0 }; | 971 base::Time::Exploded later_exploded = { 2015, 1, -1, 1, 12, 34, 56, 0 }; |
971 base::Time later = base::Time::FromUTCExploded(later_exploded); | 972 base::Time later; |
| 973 EXPECT_TRUE(base::Time::FromUTCExploded(later_exploded, &later)); |
972 | 974 |
973 const struct { | 975 const struct { |
974 const char* retry_after_string; | 976 const char* retry_after_string; |
975 bool expected_return_value; | 977 bool expected_return_value; |
976 base::TimeDelta expected_retry_after; | 978 base::TimeDelta expected_retry_after; |
977 } tests[] = { | 979 } tests[] = { |
978 { "", false, base::TimeDelta() }, | 980 { "", false, base::TimeDelta() }, |
979 { "-3", false, base::TimeDelta() }, | 981 { "-3", false, base::TimeDelta() }, |
980 { "-2", false, base::TimeDelta() }, | 982 { "-2", false, base::TimeDelta() }, |
981 { "-1", false, base::TimeDelta() }, | 983 { "-1", false, base::TimeDelta() }, |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 EXPECT_FALSE(HttpUtil::IsToken("hello, world")); | 1404 EXPECT_FALSE(HttpUtil::IsToken("hello, world")); |
1403 EXPECT_FALSE(HttpUtil::IsToken(" ")); | 1405 EXPECT_FALSE(HttpUtil::IsToken(" ")); |
1404 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece("\0", 1))); | 1406 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece("\0", 1))); |
1405 EXPECT_FALSE(HttpUtil::IsToken("\x01")); | 1407 EXPECT_FALSE(HttpUtil::IsToken("\x01")); |
1406 EXPECT_FALSE(HttpUtil::IsToken("\x7F")); | 1408 EXPECT_FALSE(HttpUtil::IsToken("\x7F")); |
1407 EXPECT_FALSE(HttpUtil::IsToken("\x80")); | 1409 EXPECT_FALSE(HttpUtil::IsToken("\x80")); |
1408 EXPECT_FALSE(HttpUtil::IsToken("\xff")); | 1410 EXPECT_FALSE(HttpUtil::IsToken("\xff")); |
1409 } | 1411 } |
1410 | 1412 |
1411 } // namespace net | 1413 } // namespace net |
OLD | NEW |