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

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: remove redundant line 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 << test.content_range_header_spec; 1023 << test.content_range_header_spec;
1024 EXPECT_EQ(test.expected_last_byte_position, last_byte_position) 1024 EXPECT_EQ(test.expected_last_byte_position, last_byte_position)
1025 << test.content_range_header_spec; 1025 << test.content_range_header_spec;
1026 EXPECT_EQ(test.expected_instance_length, instance_length) 1026 EXPECT_EQ(test.expected_instance_length, instance_length)
1027 << test.content_range_header_spec; 1027 << test.content_range_header_spec;
1028 } 1028 }
1029 } 1029 }
1030 1030
1031 TEST(HttpUtilTest, ParseRetryAfterHeader) { 1031 TEST(HttpUtilTest, ParseRetryAfterHeader) {
1032 base::Time::Exploded now_exploded = {2014, 11, 4, 5, 22, 39, 30, 0}; 1032 base::Time::Exploded now_exploded = {2014, 11, 4, 5, 22, 39, 30, 0};
1033 base::Time now = base::Time::FromUTCExploded(now_exploded); 1033 base::Time now;
1034 EXPECT_TRUE(base::Time::FromUTCExploded(now_exploded, &now));
1034 1035
1035 base::Time::Exploded later_exploded = {2015, 1, 5, 1, 12, 34, 56, 0}; 1036 base::Time::Exploded later_exploded = {2015, 1, 5, 1, 12, 34, 56, 0};
1036 base::Time later = base::Time::FromUTCExploded(later_exploded); 1037 base::Time later;
1038 EXPECT_TRUE(base::Time::FromUTCExploded(later_exploded, &later));
1037 1039
1038 const struct { 1040 const struct {
1039 const char* retry_after_string; 1041 const char* retry_after_string;
1040 bool expected_return_value; 1042 bool expected_return_value;
1041 base::TimeDelta expected_retry_after; 1043 base::TimeDelta expected_retry_after;
1042 } tests[] = { 1044 } tests[] = {
1043 { "", false, base::TimeDelta() }, 1045 { "", false, base::TimeDelta() },
1044 { "-3", false, base::TimeDelta() }, 1046 { "-3", false, base::TimeDelta() },
1045 { "-2", false, base::TimeDelta() }, 1047 { "-2", false, base::TimeDelta() },
1046 { "-1", false, base::TimeDelta() }, 1048 { "-1", false, base::TimeDelta() },
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 EXPECT_FALSE(HttpUtil::IsToken("hello, world")); 1469 EXPECT_FALSE(HttpUtil::IsToken("hello, world"));
1468 EXPECT_FALSE(HttpUtil::IsToken(" ")); 1470 EXPECT_FALSE(HttpUtil::IsToken(" "));
1469 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece("\0", 1))); 1471 EXPECT_FALSE(HttpUtil::IsToken(base::StringPiece("\0", 1)));
1470 EXPECT_FALSE(HttpUtil::IsToken("\x01")); 1472 EXPECT_FALSE(HttpUtil::IsToken("\x01"));
1471 EXPECT_FALSE(HttpUtil::IsToken("\x7F")); 1473 EXPECT_FALSE(HttpUtil::IsToken("\x7F"));
1472 EXPECT_FALSE(HttpUtil::IsToken("\x80")); 1474 EXPECT_FALSE(HttpUtil::IsToken("\x80"));
1473 EXPECT_FALSE(HttpUtil::IsToken("\xff")); 1475 EXPECT_FALSE(HttpUtil::IsToken("\xff"));
1474 } 1476 }
1475 1477
1476 } // namespace net 1478 } // 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