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

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: use EXPECT_TRUE 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
« net/cert/x509_cert_types_unittest.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 #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 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 << test.content_range_header_spec; 1036 << test.content_range_header_spec;
1037 EXPECT_EQ(test.expected_last_byte_position, last_byte_position) 1037 EXPECT_EQ(test.expected_last_byte_position, last_byte_position)
1038 << test.content_range_header_spec; 1038 << test.content_range_header_spec;
1039 EXPECT_EQ(test.expected_instance_length, instance_length) 1039 EXPECT_EQ(test.expected_instance_length, instance_length)
1040 << test.content_range_header_spec; 1040 << test.content_range_header_spec;
1041 } 1041 }
1042 } 1042 }
1043 1043
1044 TEST(HttpUtilTest, ParseRetryAfterHeader) { 1044 TEST(HttpUtilTest, ParseRetryAfterHeader) {
1045 base::Time::Exploded now_exploded = {2014, 11, 4, 5, 22, 39, 30, 0}; 1045 base::Time::Exploded now_exploded = {2014, 11, 4, 5, 22, 39, 30, 0};
1046 base::Time now = base::Time::FromUTCExploded(now_exploded); 1046 base::Time now;
1047 EXPECT_TRUE(base::Time::FromUTCExploded(now_exploded, &now));
1047 1048
1048 base::Time::Exploded later_exploded = {2015, 1, 5, 1, 12, 34, 56, 0}; 1049 base::Time::Exploded later_exploded = {2015, 1, 5, 1, 12, 34, 56, 0};
1049 base::Time later = base::Time::FromUTCExploded(later_exploded); 1050 base::Time later;
1051 EXPECT_TRUE(base::Time::FromUTCExploded(later_exploded, &later));
1050 1052
1051 const struct { 1053 const struct {
1052 const char* retry_after_string; 1054 const char* retry_after_string;
1053 bool expected_return_value; 1055 bool expected_return_value;
1054 base::TimeDelta expected_retry_after; 1056 base::TimeDelta expected_retry_after;
1055 } tests[] = { 1057 } tests[] = {
1056 { "", false, base::TimeDelta() }, 1058 { "", false, base::TimeDelta() },
1057 { "-3", false, base::TimeDelta() }, 1059 { "-3", false, base::TimeDelta() },
1058 { "-2", false, base::TimeDelta() }, 1060 { "-2", false, base::TimeDelta() },
1059 { "-1", false, base::TimeDelta() }, 1061 { "-1", false, base::TimeDelta() },
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 EXPECT_FALSE(HttpUtil::IsLWS('a')); 1495 EXPECT_FALSE(HttpUtil::IsLWS('a'));
1494 EXPECT_FALSE(HttpUtil::IsLWS('.')); 1496 EXPECT_FALSE(HttpUtil::IsLWS('.'));
1495 EXPECT_FALSE(HttpUtil::IsLWS('\n')); 1497 EXPECT_FALSE(HttpUtil::IsLWS('\n'));
1496 EXPECT_FALSE(HttpUtil::IsLWS('\r')); 1498 EXPECT_FALSE(HttpUtil::IsLWS('\r'));
1497 1499
1498 EXPECT_TRUE(HttpUtil::IsLWS('\t')); 1500 EXPECT_TRUE(HttpUtil::IsLWS('\t'));
1499 EXPECT_TRUE(HttpUtil::IsLWS(' ')); 1501 EXPECT_TRUE(HttpUtil::IsLWS(' '));
1500 } 1502 }
1501 1503
1502 } // namespace net 1504 } // namespace net
OLDNEW
« net/cert/x509_cert_types_unittest.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