OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/ftp/ftp_util.h" | 5 #include "net/ftp/ftp_util.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 }; | 99 }; |
100 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) { | 100 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) { |
101 EXPECT_EQ(kTestCases[i].expected_output, | 101 EXPECT_EQ(kTestCases[i].expected_output, |
102 net::FtpUtil::VMSPathToUnix(kTestCases[i].input)) | 102 net::FtpUtil::VMSPathToUnix(kTestCases[i].input)) |
103 << kTestCases[i].input; | 103 << kTestCases[i].input; |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 TEST(FtpUtilTest, LsDateListingToTime) { | 107 TEST(FtpUtilTest, LsDateListingToTime) { |
108 base::Time mock_current_time; | 108 base::Time mock_current_time; |
109 ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994 12:45:26 GMT", | 109 ASSERT_TRUE(base::Time::FromString("Tue, 15 Nov 1994 12:45:26 GMT", |
110 &mock_current_time)); | 110 &mock_current_time)); |
111 | 111 |
112 const struct { | 112 const struct { |
113 // Input. | 113 // Input. |
114 const char* month; | 114 const char* month; |
115 const char* day; | 115 const char* day; |
116 const char* rest; | 116 const char* rest; |
117 | 117 |
118 // Expected output. | 118 // Expected output. |
119 int expected_year; | 119 int expected_year; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %d", i, | 196 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %d", i, |
197 kTestCases[i].text, kTestCases[i].column)); | 197 kTestCases[i].text, kTestCases[i].column)); |
198 | 198 |
199 EXPECT_EQ(ASCIIToUTF16(kTestCases[i].expected_result), | 199 EXPECT_EQ(ASCIIToUTF16(kTestCases[i].expected_result), |
200 net::FtpUtil::GetStringPartAfterColumns( | 200 net::FtpUtil::GetStringPartAfterColumns( |
201 ASCIIToUTF16(kTestCases[i].text), kTestCases[i].column)); | 201 ASCIIToUTF16(kTestCases[i].text), kTestCases[i].column)); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 } // namespace | 205 } // namespace |
OLD | NEW |