| 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_ls.h" | 10 #include "net/ftp/ftp_directory_listing_parser_ls.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 FtpDirectoryListingEntry::DIRECTORY, "tmp", -1, | 117 FtpDirectoryListingEntry::DIRECTORY, "tmp", -1, |
| 118 1994, 7, 28, 2, 41 }, | 118 1994, 7, 28, 2, 41 }, |
| 119 | 119 |
| 120 // Completely different date format (YYYY-MM-DD). | 120 // Completely different date format (YYYY-MM-DD). |
| 121 { "drwxrwxrwx 2 root root 4096 2012-02-07 00:31 notas_servico", | 121 { "drwxrwxrwx 2 root root 4096 2012-02-07 00:31 notas_servico", |
| 122 FtpDirectoryListingEntry::DIRECTORY, "notas_servico", -1, | 122 FtpDirectoryListingEntry::DIRECTORY, "notas_servico", -1, |
| 123 2012, 2, 7, 0, 31 }, | 123 2012, 2, 7, 0, 31 }, |
| 124 { "-rwxrwxrwx 2 root root 4096 2012-02-07 00:31 notas_servico", | 124 { "-rwxrwxrwx 2 root root 4096 2012-02-07 00:31 notas_servico", |
| 125 FtpDirectoryListingEntry::FILE, "notas_servico", 4096, | 125 FtpDirectoryListingEntry::FILE, "notas_servico", 4096, |
| 126 2012, 2, 7, 0, 31 }, | 126 2012, 2, 7, 0, 31 }, |
| 127 |
| 128 // Weird permission bits. |
| 129 { "drwx--l--- 2 0 10 512 Dec 22 1994 swetzel", |
| 130 FtpDirectoryListingEntry::DIRECTORY, "swetzel", -1, |
| 131 1994, 12, 22, 0, 0 }, |
| 132 |
| 133 // Garbage in date (but still parseable). |
| 134 { "lrw-rw-rw- 1 user group 542 " |
| 135 "/t11/member/incomingFeb 8 2007 " |
| 136 "Shortcut to incoming.lnk -> /t11/member/incoming", |
| 137 FtpDirectoryListingEntry::SYMLINK, "Shortcut to incoming.lnk", -1, |
| 138 2007, 2, 8, 0, 0 }, |
| 127 }; | 139 }; |
| 128 for (size_t i = 0; i < arraysize(good_cases); i++) { | 140 for (size_t i = 0; i < arraysize(good_cases); i++) { |
| 129 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 141 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, |
| 130 good_cases[i].input)); | 142 good_cases[i].input)); |
| 131 | 143 |
| 132 std::vector<FtpDirectoryListingEntry> entries; | 144 std::vector<FtpDirectoryListingEntry> entries; |
| 133 EXPECT_TRUE(ParseFtpDirectoryListingLs( | 145 EXPECT_TRUE(ParseFtpDirectoryListingLs( |
| 134 GetSingleLineTestCase(good_cases[i].input), | 146 GetSingleLineTestCase(good_cases[i].input), |
| 135 GetMockCurrentTime(), | 147 GetMockCurrentTime(), |
| 136 &entries)); | 148 &entries)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 std::vector<FtpDirectoryListingEntry> entries; | 203 std::vector<FtpDirectoryListingEntry> entries; |
| 192 EXPECT_FALSE(ParseFtpDirectoryListingLs(GetSingleLineTestCase(bad_cases[i]), | 204 EXPECT_FALSE(ParseFtpDirectoryListingLs(GetSingleLineTestCase(bad_cases[i]), |
| 193 GetMockCurrentTime(), | 205 GetMockCurrentTime(), |
| 194 &entries)); | 206 &entries)); |
| 195 } | 207 } |
| 196 } | 208 } |
| 197 | 209 |
| 198 } // namespace | 210 } // namespace |
| 199 | 211 |
| 200 } // namespace net | 212 } // namespace net |
| OLD | NEW |