Chromium Code Reviews| 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 { "drwxr-sr-x 5 22623 10 512 Jan 17 1996 sat-files", | |
| 133 FtpDirectoryListingEntry::DIRECTORY, "sat-files", -1, | |
| 134 1996, 1, 17, 0, 0 }, | |
|
mmenke
2012/12/03 21:59:05
Does this differ in any significant way from the 5
| |
| 135 | |
| 136 // Garbage in date (but still parseable). | |
| 137 { "lrw-rw-rw- 1 user group 542 " | |
| 138 "/t11/member/incomingFeb 8 2007 " | |
| 139 "Shortcut to incoming.lnk -> /t11/member/incoming", | |
| 140 FtpDirectoryListingEntry::SYMLINK, "Shortcut to incoming.lnk", -1, | |
| 141 2007, 2, 8, 0, 0 }, | |
| 127 }; | 142 }; |
| 128 for (size_t i = 0; i < arraysize(good_cases); i++) { | 143 for (size_t i = 0; i < arraysize(good_cases); i++) { |
| 129 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 144 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, |
| 130 good_cases[i].input)); | 145 good_cases[i].input)); |
| 131 | 146 |
| 132 std::vector<FtpDirectoryListingEntry> entries; | 147 std::vector<FtpDirectoryListingEntry> entries; |
| 133 EXPECT_TRUE(ParseFtpDirectoryListingLs( | 148 EXPECT_TRUE(ParseFtpDirectoryListingLs( |
| 134 GetSingleLineTestCase(good_cases[i].input), | 149 GetSingleLineTestCase(good_cases[i].input), |
| 135 GetMockCurrentTime(), | 150 GetMockCurrentTime(), |
| 136 &entries)); | 151 &entries)); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 std::vector<FtpDirectoryListingEntry> entries; | 206 std::vector<FtpDirectoryListingEntry> entries; |
| 192 EXPECT_FALSE(ParseFtpDirectoryListingLs(GetSingleLineTestCase(bad_cases[i]), | 207 EXPECT_FALSE(ParseFtpDirectoryListingLs(GetSingleLineTestCase(bad_cases[i]), |
| 193 GetMockCurrentTime(), | 208 GetMockCurrentTime(), |
| 194 &entries)); | 209 &entries)); |
| 195 } | 210 } |
| 196 } | 211 } |
| 197 | 212 |
| 198 } // namespace | 213 } // namespace |
| 199 | 214 |
| 200 } // namespace net | 215 } // namespace net |
| OLD | NEW |