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_directory_listing_parser_unittest.h" | 5 #include "net/ftp/ftp_directory_listing_parser_unittest.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "net/ftp/ftp_directory_listing_parser_windows.h" | 10 #include "net/ftp/ftp_directory_listing_parser_windows.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 GetSingleLineTestCase(good_cases[i].input), | 66 GetSingleLineTestCase(good_cases[i].input), |
67 &entries)); | 67 &entries)); |
68 VerifySingleLineTestCase(good_cases[i], entries); | 68 VerifySingleLineTestCase(good_cases[i], entries); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 TEST_F(FtpDirectoryListingParserWindowsTest, Ignored) { | 72 TEST_F(FtpDirectoryListingParserWindowsTest, Ignored) { |
73 const char* ignored_cases[] = { | 73 const char* ignored_cases[] = { |
74 "12-07-10 12:05AM <DIR> ", // http://crbug.com/66097 | 74 "12-07-10 12:05AM <DIR> ", // http://crbug.com/66097 |
75 "12-07-10 12:05AM 1234 ", | 75 "12-07-10 12:05AM 1234 ", |
| 76 "11-02-09 05:32 <DIR>", |
| 77 "11-02-09 05:32PM <DIR>", |
76 }; | 78 }; |
77 for (size_t i = 0; i < arraysize(ignored_cases); i++) { | 79 for (size_t i = 0; i < arraysize(ignored_cases); i++) { |
78 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 80 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, |
79 ignored_cases[i])); | 81 ignored_cases[i])); |
80 | 82 |
81 std::vector<FtpDirectoryListingEntry> entries; | 83 std::vector<FtpDirectoryListingEntry> entries; |
82 EXPECT_TRUE(ParseFtpDirectoryListingWindows( | 84 EXPECT_TRUE(ParseFtpDirectoryListingWindows( |
83 GetSingleLineTestCase(ignored_cases[i]), | 85 GetSingleLineTestCase(ignored_cases[i]), |
84 &entries)); | 86 &entries)); |
85 EXPECT_EQ(0U, entries.size()); | 87 EXPECT_EQ(0U, entries.size()); |
86 } | 88 } |
87 } | 89 } |
88 | 90 |
89 TEST_F(FtpDirectoryListingParserWindowsTest, Bad) { | 91 TEST_F(FtpDirectoryListingParserWindowsTest, Bad) { |
90 const char* bad_cases[] = { | 92 const char* bad_cases[] = { |
91 "garbage", | 93 "garbage", |
92 "11-02-09 05:32PM <GARBAGE>", | 94 "11-02-09 05:32PM <GARBAGE>", |
93 "11-02-09 05:32PM <GARBAGE> NT", | 95 "11-02-09 05:32PM <GARBAGE> NT", |
94 "11-02-09 05:32 <DIR>", | |
95 "11-FEB-09 05:32PM <DIR>", | 96 "11-FEB-09 05:32PM <DIR>", |
96 "11-02 05:32PM <DIR>", | 97 "11-02 05:32PM <DIR>", |
97 "11-02-09 05:32PM -1", | 98 "11-02-09 05:32PM -1", |
98 "11-02-09 05:32 <DIR> NT", | |
99 "11-FEB-09 05:32PM <DIR> NT", | 99 "11-FEB-09 05:32PM <DIR> NT", |
100 "11-02 05:32PM <DIR> NT", | 100 "11-02 05:32PM <DIR> NT", |
101 "11-02-09 05:32PM -1 NT", | 101 "11-02-09 05:32PM -1 NT", |
102 "99-25-10 12:00AM 0", | 102 "99-25-10 12:00AM 0", |
103 "12-99-10 12:00AM 0", | 103 "12-99-10 12:00AM 0", |
104 "12-25-10 99:00AM 0", | 104 "12-25-10 99:00AM 0", |
105 "12-25-10 12:99AM 0", | 105 "12-25-10 12:99AM 0", |
106 "12-25-10 12:00ZM 0", | 106 "12-25-10 12:00ZM 0", |
107 "99-25-10 12:00AM 0 months out of range", | 107 "99-25-10 12:00AM 0 months out of range", |
108 "12-99-10 12:00AM 0 days out of range", | 108 "12-99-10 12:00AM 0 days out of range", |
109 "12-25-10 99:00AM 0 hours out of range", | 109 "12-25-10 99:00AM 0 hours out of range", |
110 "12-25-10 12:99AM 0 minutes out of range", | 110 "12-25-10 12:99AM 0 minutes out of range", |
111 "12-25-10 12:00ZM 0 what does ZM mean", | 111 "12-25-10 12:00ZM 0 what does ZM mean", |
112 }; | 112 }; |
113 for (size_t i = 0; i < arraysize(bad_cases); i++) { | 113 for (size_t i = 0; i < arraysize(bad_cases); i++) { |
114 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 114 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, |
115 bad_cases[i])); | 115 bad_cases[i])); |
116 | 116 |
117 std::vector<FtpDirectoryListingEntry> entries; | 117 std::vector<FtpDirectoryListingEntry> entries; |
118 EXPECT_FALSE(ParseFtpDirectoryListingWindows( | 118 EXPECT_FALSE(ParseFtpDirectoryListingWindows( |
119 GetSingleLineTestCase(bad_cases[i]), | 119 GetSingleLineTestCase(bad_cases[i]), |
120 &entries)); | 120 &entries)); |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 } // namespace | 124 } // namespace |
125 | 125 |
126 } // namespace net | 126 } // namespace net |
OLD | NEW |