| 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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "net/ftp/ftp_directory_listing_parser_ls.h" | 10 #include "net/ftp/ftp_directory_listing_parser_ls.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 typedef FtpDirectoryListingParserTest FtpDirectoryListingParserLsTest; | 16 typedef FtpDirectoryListingParserTest FtpDirectoryListingParserLsTest; |
| 17 | 17 |
| 18 TEST_F(FtpDirectoryListingParserLsTest, Good) { | 18 TEST_F(FtpDirectoryListingParserLsTest, Good) { |
| 19 const struct SingleLineTestData good_cases[] = { | 19 const struct SingleLineTestData good_cases[] = { |
| 20 { "-rw-r--r-- 1 ftp ftp 528 Nov 01 2007 README", | 20 {"-rw-r--r-- 1 ftp ftp 528 Nov 01 2007 README", |
| 21 FtpDirectoryListingEntry::FILE, "README", 528, | 21 FtpDirectoryListingEntry::FILE, "README", 528, 2007, 11, 1, 0, 0}, |
| 22 2007, 11, 1, 0, 0 }, | 22 {"drwxr-xr-x 3 ftp ftp 4096 May 15 18:11 directory", |
| 23 { "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11 directory", | 23 FtpDirectoryListingEntry::DIRECTORY, "directory", -1, 1994, 5, 15, 18, |
| 24 FtpDirectoryListingEntry::DIRECTORY, "directory", -1, | 24 11}, |
| 25 1994, 5, 15, 18, 11 }, | 25 {"lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub -> vol/1/.CLUSTER/var_ftp/pub", |
| 26 { "lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub -> vol/1/.CLUSTER/var_ftp/pub", | 26 FtpDirectoryListingEntry::SYMLINK, "pub", -1, 2008, 9, 18, 0, 0}, |
| 27 FtpDirectoryListingEntry::SYMLINK, "pub", -1, | 27 {"lrwxrwxrwx 1 0 0 3 Oct 12 13:37 mirror -> pub", |
| 28 2008, 9, 18, 0, 0 }, | 28 FtpDirectoryListingEntry::SYMLINK, "mirror", -1, 1994, 10, 12, 13, 37}, |
| 29 { "lrwxrwxrwx 1 0 0 3 Oct 12 13:37 mirror -> pub", | 29 {"drwxrwsr-x 4 501 501 4096 Feb 20 2007 pub", |
| 30 FtpDirectoryListingEntry::SYMLINK, "mirror", -1, | 30 FtpDirectoryListingEntry::DIRECTORY, "pub", -1, 2007, 2, 20, 0, 0}, |
| 31 1994, 10, 12, 13, 37 }, | 31 {"drwxr-xr-x 4 (?) (?) 4096 Apr 8 2007 jigdo", |
| 32 { "drwxrwsr-x 4 501 501 4096 Feb 20 2007 pub", | 32 FtpDirectoryListingEntry::DIRECTORY, "jigdo", -1, 2007, 4, 8, 0, 0}, |
| 33 FtpDirectoryListingEntry::DIRECTORY, "pub", -1, | 33 {"drwx-wx-wt 2 root wheel 512 Jul 1 02:15 incoming", |
| 34 2007, 2, 20, 0, 0 }, | 34 FtpDirectoryListingEntry::DIRECTORY, "incoming", -1, 1994, 7, 1, 2, 15}, |
| 35 { "drwxr-xr-x 4 (?) (?) 4096 Apr 8 2007 jigdo", | 35 {"-rw-r--r-- 1 2 3 3447432 May 18 2009 Foo - Manual.pdf", |
| 36 FtpDirectoryListingEntry::DIRECTORY, "jigdo", -1, | 36 FtpDirectoryListingEntry::FILE, "Foo - Manual.pdf", 3447432, 2009, 5, 18, |
| 37 2007, 4, 8, 0, 0 }, | 37 0, 0}, |
| 38 { "drwx-wx-wt 2 root wheel 512 Jul 1 02:15 incoming", | 38 {"d-wx-wx-wt+ 4 ftp 989 512 Dec 8 15:54 incoming", |
| 39 FtpDirectoryListingEntry::DIRECTORY, "incoming", -1, | 39 FtpDirectoryListingEntry::DIRECTORY, "incoming", -1, 1993, 12, 8, 15, |
| 40 1994, 7, 1, 2, 15 }, | 40 54}, |
| 41 { "-rw-r--r-- 1 2 3 3447432 May 18 2009 Foo - Manual.pdf", | 41 {"drwxrwxrwx 1 owner group 1024 Sep 13 0:30 audio", |
| 42 FtpDirectoryListingEntry::FILE, "Foo - Manual.pdf", 3447432, | 42 FtpDirectoryListingEntry::DIRECTORY, "audio", -1, 1994, 9, 13, 0, 30}, |
| 43 2009, 5, 18, 0, 0 }, | 43 {"lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub", |
| 44 { "d-wx-wx-wt+ 4 ftp 989 512 Dec 8 15:54 incoming", | 44 FtpDirectoryListingEntry::SYMLINK, "pub", -1, 2008, 9, 18, 0, 0}, |
| 45 FtpDirectoryListingEntry::DIRECTORY, "incoming", -1, | 45 {"-rw-r--r-- 1 ftp ftp -528 Nov 01 2007 README", |
| 46 1993, 12, 8, 15, 54 }, | 46 FtpDirectoryListingEntry::FILE, "README", -1, 2007, 11, 1, 0, 0}, |
| 47 { "drwxrwxrwx 1 owner group 1024 Sep 13 0:30 audio", | |
| 48 FtpDirectoryListingEntry::DIRECTORY, "audio", -1, | |
| 49 1994, 9, 13, 0, 30 }, | |
| 50 { "lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub", | |
| 51 FtpDirectoryListingEntry::SYMLINK, "pub", -1, | |
| 52 2008, 9, 18, 0, 0 }, | |
| 53 { "-rw-r--r-- 1 ftp ftp -528 Nov 01 2007 README", | |
| 54 FtpDirectoryListingEntry::FILE, "README", -1, | |
| 55 2007, 11, 1, 0, 0 }, | |
| 56 | 47 |
| 57 // Tests for the wu-ftpd variant: | 48 // Tests for the wu-ftpd variant: |
| 58 { "drwxr-xr-x 2 sys 512 Mar 27 2009 pub", | 49 {"drwxr-xr-x 2 sys 512 Mar 27 2009 pub", |
| 59 FtpDirectoryListingEntry::DIRECTORY, "pub", -1, | 50 FtpDirectoryListingEntry::DIRECTORY, "pub", -1, 2009, 3, 27, 0, 0}, |
| 60 2009, 3, 27, 0, 0 }, | 51 {"lrwxrwxrwx 0 0 26 Sep 18 2008 pub -> vol/1/.CLUSTER/var_ftp/pub", |
| 61 { "lrwxrwxrwx 0 0 26 Sep 18 2008 pub -> vol/1/.CLUSTER/var_ftp/pub", | 52 FtpDirectoryListingEntry::SYMLINK, "pub", -1, 2008, 9, 18, 0, 0}, |
| 62 FtpDirectoryListingEntry::SYMLINK, "pub", -1, | 53 {"drwxr-xr-x (?) (?) 4096 Apr 8 2007 jigdo", |
| 63 2008, 9, 18, 0, 0 }, | 54 FtpDirectoryListingEntry::DIRECTORY, "jigdo", -1, 2007, 4, 8, 0, 0}, |
| 64 { "drwxr-xr-x (?) (?) 4096 Apr 8 2007 jigdo", | 55 {"-rw-r--r-- 2 3 3447432 May 18 2009 Foo - Manual.pdf", |
| 65 FtpDirectoryListingEntry::DIRECTORY, "jigdo", -1, | 56 FtpDirectoryListingEntry::FILE, "Foo - Manual.pdf", 3447432, 2009, 5, 18, |
| 66 2007, 4, 8, 0, 0 }, | 57 0, 0}, |
| 67 { "-rw-r--r-- 2 3 3447432 May 18 2009 Foo - Manual.pdf", | |
| 68 FtpDirectoryListingEntry::FILE, "Foo - Manual.pdf", 3447432, | |
| 69 2009, 5, 18, 0, 0 }, | |
| 70 | 58 |
| 71 // Tests for "ls -l" style listings sent by an OS/2 server (FtpServer): | 59 // Tests for "ls -l" style listings sent by an OS/2 server (FtpServer): |
| 72 { "-r--r--r-- 1 ftp -A--- 13274 Mar 1 2006 UpTime.exe", | 60 {"-r--r--r-- 1 ftp -A--- 13274 Mar 1 2006 UpTime.exe", |
| 73 FtpDirectoryListingEntry::FILE, "UpTime.exe", 13274, | 61 FtpDirectoryListingEntry::FILE, "UpTime.exe", 13274, 2006, 3, 1, 0, 0}, |
| 74 2006, 3, 1, 0, 0 }, | 62 {"dr--r--r-- 1 ftp ----- 0 Nov 17 17:08 kernels", |
| 75 { "dr--r--r-- 1 ftp ----- 0 Nov 17 17:08 kernels", | 63 FtpDirectoryListingEntry::DIRECTORY, "kernels", -1, 1993, 11, 17, 17, 8}, |
| 76 FtpDirectoryListingEntry::DIRECTORY, "kernels", -1, | |
| 77 1993, 11, 17, 17, 8 }, | |
| 78 | 64 |
| 79 // Tests for "ls -l" style listing sent by Xplain FTP Server. | 65 // Tests for "ls -l" style listing sent by Xplain FTP Server. |
| 80 { "drwxr-xr-x folder 0 Jul 17 2006 online", | 66 {"drwxr-xr-x folder 0 Jul 17 2006 online", |
| 81 FtpDirectoryListingEntry::DIRECTORY, "online", -1, | 67 FtpDirectoryListingEntry::DIRECTORY, "online", -1, 2006, 7, 17, 0, 0}, |
| 82 2006, 7, 17, 0, 0 }, | |
| 83 | 68 |
| 84 // Tests for "ls -l" style listing with owning group name | 69 // Tests for "ls -l" style listing with owning group name |
| 85 // not separated from file size (http://crbug.com/58963). | 70 // not separated from file size (http://crbug.com/58963). |
| 86 { "-rw-r--r-- 1 ftpadmin ftpadmin125435904 Apr 9 2008 .pureftpd-upload", | 71 {"-rw-r--r-- 1 ftpadmin ftpadmin125435904 Apr 9 2008 .pureftpd-upload", |
| 87 FtpDirectoryListingEntry::FILE, ".pureftpd-upload", 0, | 72 FtpDirectoryListingEntry::FILE, ".pureftpd-upload", 0, 2008, 4, 9, 0, 0}, |
| 88 2008, 4, 9, 0, 0 }, | |
| 89 | 73 |
| 90 // Tests for "ls -l" style listing with number of links | 74 // Tests for "ls -l" style listing with number of links |
| 91 // not separated from permission listing (http://crbug.com/70394). | 75 // not separated from permission listing (http://crbug.com/70394). |
| 92 { "drwxr-xr-x1732 266 111 90112 Jun 21 2001 .rda_2", | 76 {"drwxr-xr-x1732 266 111 90112 Jun 21 2001 .rda_2", |
| 93 FtpDirectoryListingEntry::DIRECTORY, ".rda_2", -1, | 77 FtpDirectoryListingEntry::DIRECTORY, ".rda_2", -1, 2001, 6, 21, 0, 0}, |
| 94 2001, 6, 21, 0, 0 }, | |
| 95 | 78 |
| 96 // Tests for "ls -l" style listing with group name containing spaces. | 79 // Tests for "ls -l" style listing with group name containing spaces. |
| 97 { "drwxrwxr-x 3 %%%% Domain Users 4096 Dec 9 2009 %%%%%", | 80 {"drwxrwxr-x 3 %%%% Domain Users 4096 Dec 9 2009 %%%%%", |
| 98 FtpDirectoryListingEntry::DIRECTORY, "%%%%%", -1, | 81 FtpDirectoryListingEntry::DIRECTORY, "%%%%%", -1, 2009, 12, 9, 0, 0}, |
| 99 2009, 12, 9, 0, 0 }, | |
| 100 | 82 |
| 101 // Tests for "ls -l" style listing in Russian locale (note the swapped | 83 // Tests for "ls -l" style listing in Russian locale (note the swapped |
| 102 // parts order: the day of month is the first, before month). | 84 // parts order: the day of month is the first, before month). |
| 103 { "-rwxrwxr-x 1 ftp ftp 123 23 \xd0\xbc\xd0\xb0\xd0\xb9 2011 test", | 85 {"-rwxrwxr-x 1 ftp ftp 123 23 \xd0\xbc\xd0\xb0\xd0\xb9 2011 test", |
| 104 FtpDirectoryListingEntry::FILE, "test", 123, | 86 FtpDirectoryListingEntry::FILE, "test", 123, 2011, 5, 23, 0, 0}, |
| 105 2011, 5, 23, 0, 0 }, | 87 {"drwxrwxr-x 1 ftp ftp 4096 19 \xd0\xbe\xd0\xba\xd1\x82 2011 dir", |
| 106 { "drwxrwxr-x 1 ftp ftp 4096 19 \xd0\xbe\xd0\xba\xd1\x82 2011 dir", | 88 FtpDirectoryListingEntry::DIRECTORY, "dir", -1, 2011, 10, 19, 0, 0}, |
| 107 FtpDirectoryListingEntry::DIRECTORY, "dir", -1, | |
| 108 2011, 10, 19, 0, 0 }, | |
| 109 | 89 |
| 110 // Plan9 sends entry type "a" for append-only files. | 90 // Plan9 sends entry type "a" for append-only files. |
| 111 { "ar-xr-xr-x 2 none none 512 Apr 26 17:52 plan9", | 91 {"ar-xr-xr-x 2 none none 512 Apr 26 17:52 plan9", |
| 112 FtpDirectoryListingEntry::FILE, "plan9", 512, | 92 FtpDirectoryListingEntry::FILE, "plan9", 512, 1994, 4, 26, 17, 52}, |
| 113 1994, 4, 26, 17, 52 }, | |
| 114 | 93 |
| 115 // Hylafax sends a shorter permission listing. | 94 // Hylafax sends a shorter permission listing. |
| 116 { "drwxrwx 2 10 4096 Jul 28 02:41 tmp", | 95 {"drwxrwx 2 10 4096 Jul 28 02:41 tmp", |
| 117 FtpDirectoryListingEntry::DIRECTORY, "tmp", -1, | 96 FtpDirectoryListingEntry::DIRECTORY, "tmp", -1, 1994, 7, 28, 2, 41}, |
| 118 1994, 7, 28, 2, 41 }, | |
| 119 | 97 |
| 120 // Completely different date format (YYYY-MM-DD). | 98 // Completely different date format (YYYY-MM-DD). |
| 121 { "drwxrwxrwx 2 root root 4096 2012-02-07 00:31 notas_servico", | 99 {"drwxrwxrwx 2 root root 4096 2012-02-07 00:31 notas_servico", |
| 122 FtpDirectoryListingEntry::DIRECTORY, "notas_servico", -1, | 100 FtpDirectoryListingEntry::DIRECTORY, "notas_servico", -1, 2012, 2, 7, 0, |
| 123 2012, 2, 7, 0, 31 }, | 101 31}, |
| 124 { "-rwxrwxrwx 2 root root 4096 2012-02-07 00:31 notas_servico", | 102 {"-rwxrwxrwx 2 root root 4096 2012-02-07 00:31 notas_servico", |
| 125 FtpDirectoryListingEntry::FILE, "notas_servico", 4096, | 103 FtpDirectoryListingEntry::FILE, "notas_servico", 4096, 2012, 2, 7, 0, |
| 126 2012, 2, 7, 0, 31 }, | 104 31}, |
| 127 | 105 |
| 128 // Weird permission bits. | 106 // Weird permission bits. |
| 129 { "drwx--l--- 2 0 10 512 Dec 22 1994 swetzel", | 107 {"drwx--l--- 2 0 10 512 Dec 22 1994 swetzel", |
| 130 FtpDirectoryListingEntry::DIRECTORY, "swetzel", -1, | 108 FtpDirectoryListingEntry::DIRECTORY, "swetzel", -1, 1994, 12, 22, 0, 0}, |
| 131 1994, 12, 22, 0, 0 }, | 109 {"drwxrwxr-x 1 500 244 660 Jan 1 00:0 bin", |
| 110 FtpDirectoryListingEntry::DIRECTORY, "bin", -1, 1994, 1, 1, 0, 0}, |
| 132 | 111 |
| 133 { "drwxrwxr-x 1 500 244 660 Jan 1 00:0 bin", | 112 // Garbage in date (but still parseable). |
| 134 FtpDirectoryListingEntry::DIRECTORY, "bin", -1, | 113 {"lrw-rw-rw- 1 user group 542 " |
| 135 1994, 1, 1, 0, 0 }, | 114 "/t11/member/incomingFeb 8 2007 " |
| 115 "Shortcut to incoming.lnk -> /t11/member/incoming", |
| 116 FtpDirectoryListingEntry::SYMLINK, "Shortcut to incoming.lnk", -1, 2007, |
| 117 2, 8, 0, 0}, |
| 136 | 118 |
| 137 // Garbage in date (but still parseable). | 119 // Garbage in permissions (with no effect on other bits). |
| 138 { "lrw-rw-rw- 1 user group 542 " | 120 // Also test multiple "columns" resulting from the garbage. |
| 139 "/t11/member/incomingFeb 8 2007 " | 121 {"garbage 1 ftp ftp 528 Nov 01 2007 README", |
| 140 "Shortcut to incoming.lnk -> /t11/member/incoming", | 122 FtpDirectoryListingEntry::FILE, "README", 528, 2007, 11, 1, 0, 0}, |
| 141 FtpDirectoryListingEntry::SYMLINK, "Shortcut to incoming.lnk", -1, | 123 {"gar bage 1 ftp ftp 528 Nov 01 2007 README", |
| 142 2007, 2, 8, 0, 0 }, | 124 FtpDirectoryListingEntry::FILE, "README", 528, 2007, 11, 1, 0, 0}, |
| 143 | 125 {"g a r b a g e 1 ftp ftp 528 Nov 01 2007 README", |
| 144 // Garbage in permissions (with no effect on other bits). | 126 FtpDirectoryListingEntry::FILE, "README", 528, 2007, 11, 1, 0, 0}, |
| 145 // Also test multiple "columns" resulting from the garbage. | |
| 146 { "garbage 1 ftp ftp 528 Nov 01 2007 README", | |
| 147 FtpDirectoryListingEntry::FILE, "README", 528, | |
| 148 2007, 11, 1, 0, 0 }, | |
| 149 { "gar bage 1 ftp ftp 528 Nov 01 2007 README", | |
| 150 FtpDirectoryListingEntry::FILE, "README", 528, | |
| 151 2007, 11, 1, 0, 0 }, | |
| 152 { "g a r b a g e 1 ftp ftp 528 Nov 01 2007 README", | |
| 153 FtpDirectoryListingEntry::FILE, "README", 528, | |
| 154 2007, 11, 1, 0, 0 }, | |
| 155 }; | 127 }; |
| 156 for (size_t i = 0; i < arraysize(good_cases); i++) { | 128 for (size_t i = 0; i < arraysize(good_cases); i++) { |
| 157 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 129 SCOPED_TRACE( |
| 158 good_cases[i].input)); | 130 base::StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input)); |
| 159 | 131 |
| 160 std::vector<FtpDirectoryListingEntry> entries; | 132 std::vector<FtpDirectoryListingEntry> entries; |
| 161 EXPECT_TRUE(ParseFtpDirectoryListingLs( | 133 EXPECT_TRUE( |
| 162 GetSingleLineTestCase(good_cases[i].input), | 134 ParseFtpDirectoryListingLs(GetSingleLineTestCase(good_cases[i].input), |
| 163 GetMockCurrentTime(), | 135 GetMockCurrentTime(), |
| 164 &entries)); | 136 &entries)); |
| 165 VerifySingleLineTestCase(good_cases[i], entries); | 137 VerifySingleLineTestCase(good_cases[i], entries); |
| 166 } | 138 } |
| 167 } | 139 } |
| 168 | 140 |
| 169 TEST_F(FtpDirectoryListingParserLsTest, Ignored) { | 141 TEST_F(FtpDirectoryListingParserLsTest, Ignored) { |
| 170 const char* ignored_cases[] = { | 142 const char* ignored_cases[] = { |
| 171 "drwxr-xr-x 2 0 0 4096 Mar 18 2007 ", // http://crbug.com/60065 | 143 "drwxr-xr-x 2 0 0 4096 Mar 18 2007 ", // http://crbug.com/60065 |
| 144 "ftpd: .: Permission denied", |
| 145 "ftpd-BSD: .: Permission denied", |
| 146 "ls: .: EDC5111I Permission denied.", |
| 172 | 147 |
| 173 "ftpd: .: Permission denied", | 148 // Tests important for security: verify that after we detect the column |
| 174 "ftpd-BSD: .: Permission denied", | 149 // offset we don't try to access invalid memory on malformed input. |
| 175 "ls: .: EDC5111I Permission denied.", | 150 "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11", |
| 176 | 151 "drwxr-xr-x 3 ftp 4096 May 15 18:11", |
| 177 // Tests important for security: verify that after we detect the column | 152 "drwxr-xr-x folder 0 May 15 18:11", |
| 178 // offset we don't try to access invalid memory on malformed input. | |
| 179 "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11", | |
| 180 "drwxr-xr-x 3 ftp 4096 May 15 18:11", | |
| 181 "drwxr-xr-x folder 0 May 15 18:11", | |
| 182 }; | 153 }; |
| 183 for (size_t i = 0; i < arraysize(ignored_cases); i++) { | 154 for (size_t i = 0; i < arraysize(ignored_cases); i++) { |
| 184 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 155 SCOPED_TRACE( |
| 185 ignored_cases[i])); | 156 base::StringPrintf("Test[%" PRIuS "]: %s", i, ignored_cases[i])); |
| 186 | 157 |
| 187 std::vector<FtpDirectoryListingEntry> entries; | 158 std::vector<FtpDirectoryListingEntry> entries; |
| 188 EXPECT_TRUE(ParseFtpDirectoryListingLs( | 159 EXPECT_TRUE( |
| 189 GetSingleLineTestCase(ignored_cases[i]), | 160 ParseFtpDirectoryListingLs(GetSingleLineTestCase(ignored_cases[i]), |
| 190 GetMockCurrentTime(), | 161 GetMockCurrentTime(), |
| 191 &entries)); | 162 &entries)); |
| 192 EXPECT_EQ(0U, entries.size()); | 163 EXPECT_EQ(0U, entries.size()); |
| 193 } | 164 } |
| 194 } | 165 } |
| 195 | 166 |
| 196 TEST_F(FtpDirectoryListingParserLsTest, Bad) { | 167 TEST_F(FtpDirectoryListingParserLsTest, Bad) { |
| 197 const char* bad_cases[] = { | 168 const char* bad_cases[] = { |
| 198 " foo", | 169 " foo", |
| 199 "garbage", | 170 "garbage", |
| 200 "-rw-r--r-- ftp ftp", | 171 "-rw-r--r-- ftp ftp", |
| 201 "-rw-r--r-- ftp ftp 528 Foo 01 2007 README", | 172 "-rw-r--r-- ftp ftp 528 Foo 01 2007 README", |
| 202 "-rw-r--r-- 1 ftp ftp", | 173 "-rw-r--r-- 1 ftp ftp", |
| 203 "-rw-r--r-- 1 ftp ftp 528 Foo 01 2007 README", | 174 "-rw-r--r-- 1 ftp ftp 528 Foo 01 2007 README", |
| 204 | 175 |
| 205 // Invalid month value (30). | 176 // Invalid month value (30). |
| 206 "drwxrwxrwx 2 root root 4096 2012-30-07 00:31 notas_servico", | 177 "drwxrwxrwx 2 root root 4096 2012-30-07 00:31 notas_servico", |
| 207 }; | 178 }; |
| 208 for (size_t i = 0; i < arraysize(bad_cases); i++) { | 179 for (size_t i = 0; i < arraysize(bad_cases); i++) { |
| 209 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 180 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, bad_cases[i])); |
| 210 bad_cases[i])); | |
| 211 | 181 |
| 212 std::vector<FtpDirectoryListingEntry> entries; | 182 std::vector<FtpDirectoryListingEntry> entries; |
| 213 EXPECT_FALSE(ParseFtpDirectoryListingLs(GetSingleLineTestCase(bad_cases[i]), | 183 EXPECT_FALSE(ParseFtpDirectoryListingLs( |
| 214 GetMockCurrentTime(), | 184 GetSingleLineTestCase(bad_cases[i]), GetMockCurrentTime(), &entries)); |
| 215 &entries)); | |
| 216 } | 185 } |
| 217 } | 186 } |
| 218 | 187 |
| 219 } // namespace | 188 } // namespace |
| 220 | 189 |
| 221 } // namespace net | 190 } // namespace net |
| OLD | NEW |