Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: net/http/http_util_unittest.cc

Issue 2090713003: Make callers of FromUTC(Local)Exploded in net/ use new time API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« net/ftp/ftp_util.cc ('K') | « net/ftp/ftp_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 } 1395 }
1394 1396
1395 TEST(HttpUtilTest, IsToken) { 1397 TEST(HttpUtilTest, IsToken) {
1396 EXPECT_TRUE(HttpUtil::IsToken("valid")); 1398 EXPECT_TRUE(HttpUtil::IsToken("valid"));
1397 EXPECT_FALSE(HttpUtil::IsToken("")); 1399 EXPECT_FALSE(HttpUtil::IsToken(""));
1398 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece())); 1400 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece()));
1399 EXPECT_FALSE(HttpUtil::IsToken("hello, world")); 1401 EXPECT_FALSE(HttpUtil::IsToken("hello, world"));
1400 } 1402 }
1401 1403
1402 } // namespace net 1404 } // namespace net
OLDNEW
« net/ftp/ftp_util.cc ('K') | « net/ftp/ftp_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698