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

Unified Diff: net/ftp/ftp_util_unittest.cc

Issue 7590011: FTP: add directory listing parser for OS/2 format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« net/ftp/ftp_util.cc ('K') | « net/ftp/ftp_util.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_util_unittest.cc
diff --git a/net/ftp/ftp_util_unittest.cc b/net/ftp/ftp_util_unittest.cc
index 94c1837bf559e682e157354ee2ee1908bd1df126..7545f58fbcf21d58650bd171d25d03e89a26aa73 100644
--- a/net/ftp/ftp_util_unittest.cc
+++ b/net/ftp/ftp_util_unittest.cc
@@ -175,6 +175,46 @@ TEST(FtpUtilTest, LsDateListingToTime) {
}
}
+TEST(FtpUtilTest, WindowsDateListingToTime) {
+ const struct {
+ // Input.
+ const char* date;
+ const char* time;
+
+ // Expected output.
+ int expected_year;
+ int expected_month;
+ int expected_day_of_month;
+ int expected_hour;
+ int expected_minute;
+ } kTestCases[] = {
+ { "11-01-07", "12:42", 2007, 11, 1, 12, 42 },
+ { "11-01-07", "12:42AM", 2007, 11, 1, 0, 42 },
+ { "11-01-07", "12:42PM", 2007, 11, 1, 12, 42 },
+
+ { "11-01-2007", "12:42", 2007, 11, 1, 12, 42 },
+ };
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s %s", i,
+ kTestCases[i].date, kTestCases[i].time));
+
+ base::Time time;
+ ASSERT_TRUE(net::FtpUtil::WindowsDateListingToTime(
+ UTF8ToUTF16(kTestCases[i].date),
+ UTF8ToUTF16(kTestCases[i].time),
+ &time));
+
+ base::Time::Exploded time_exploded;
+ time.LocalExplode(&time_exploded);
+ EXPECT_EQ(kTestCases[i].expected_year, time_exploded.year);
+ EXPECT_EQ(kTestCases[i].expected_month, time_exploded.month);
+ EXPECT_EQ(kTestCases[i].expected_day_of_month, time_exploded.day_of_month);
+ EXPECT_EQ(kTestCases[i].expected_hour, time_exploded.hour);
+ EXPECT_EQ(kTestCases[i].expected_minute, time_exploded.minute);
+ EXPECT_EQ(0, time_exploded.second);
+ EXPECT_EQ(0, time_exploded.millisecond);
+ }
+}
eroman 2011/08/10 23:52:16 nit: add a newline.
Paweł Hajdan Jr. 2011/08/11 00:03:19 Done.
TEST(FtpUtilTest, GetStringPartAfterColumns) {
const struct {
const char* text;
« net/ftp/ftp_util.cc ('K') | « net/ftp/ftp_util.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698