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

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: typo Created 4 years 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
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 #include <limits> 6 #include <limits>
7 7
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "net/http/http_util.h" 9 #include "net/http/http_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 << test.content_range_header_spec; 1033 << test.content_range_header_spec;
1034 EXPECT_EQ(test.expected_last_byte_position, last_byte_position) 1034 EXPECT_EQ(test.expected_last_byte_position, last_byte_position)
1035 << test.content_range_header_spec; 1035 << test.content_range_header_spec;
1036 EXPECT_EQ(test.expected_instance_length, instance_length) 1036 EXPECT_EQ(test.expected_instance_length, instance_length)
1037 << test.content_range_header_spec; 1037 << test.content_range_header_spec;
1038 } 1038 }
1039 } 1039 }
1040 1040
1041 TEST(HttpUtilTest, ParseRetryAfterHeader) { 1041 TEST(HttpUtilTest, ParseRetryAfterHeader) {
1042 base::Time::Exploded now_exploded = {2014, 11, 4, 5, 22, 39, 30, 0}; 1042 base::Time::Exploded now_exploded = {2014, 11, 4, 5, 22, 39, 30, 0};
1043 base::Time now = base::Time::FromUTCExploded(now_exploded); 1043 base::Time now;
1044 EXPECT_TRUE(base::Time::FromUTCExploded(now_exploded, &now));
1044 1045
1045 base::Time::Exploded later_exploded = {2015, 1, 5, 1, 12, 34, 56, 0}; 1046 base::Time::Exploded later_exploded = {2015, 1, 5, 1, 12, 34, 56, 0};
1046 base::Time later = base::Time::FromUTCExploded(later_exploded); 1047 base::Time later;
1048 EXPECT_TRUE(base::Time::FromUTCExploded(later_exploded, &later));
1047 1049
1048 const struct { 1050 const struct {
1049 const char* retry_after_string; 1051 const char* retry_after_string;
1050 bool expected_return_value; 1052 bool expected_return_value;
1051 base::TimeDelta expected_retry_after; 1053 base::TimeDelta expected_retry_after;
1052 } tests[] = { 1054 } tests[] = {
1053 { "", false, base::TimeDelta() }, 1055 { "", false, base::TimeDelta() },
1054 { "-3", false, base::TimeDelta() }, 1056 { "-3", false, base::TimeDelta() },
1055 { "-2", false, base::TimeDelta() }, 1057 { "-2", false, base::TimeDelta() },
1056 { "-1", false, base::TimeDelta() }, 1058 { "-1", false, base::TimeDelta() },
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 EXPECT_FALSE(HttpUtil::IsLWS('a')); 1492 EXPECT_FALSE(HttpUtil::IsLWS('a'));
1491 EXPECT_FALSE(HttpUtil::IsLWS('.')); 1493 EXPECT_FALSE(HttpUtil::IsLWS('.'));
1492 EXPECT_FALSE(HttpUtil::IsLWS('\n')); 1494 EXPECT_FALSE(HttpUtil::IsLWS('\n'));
1493 EXPECT_FALSE(HttpUtil::IsLWS('\r')); 1495 EXPECT_FALSE(HttpUtil::IsLWS('\r'));
1494 1496
1495 EXPECT_TRUE(HttpUtil::IsLWS('\t')); 1497 EXPECT_TRUE(HttpUtil::IsLWS('\t'));
1496 EXPECT_TRUE(HttpUtil::IsLWS(' ')); 1498 EXPECT_TRUE(HttpUtil::IsLWS(' '));
1497 } 1499 }
1498 1500
1499 } // namespace net 1501 } // namespace net
OLDNEW
« net/ftp/ftp_directory_listing_parser_vms.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