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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 VerifySingleLineTestCase(good_cases[i], entries); | 126 VerifySingleLineTestCase(good_cases[i], entries); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 TEST_F(FtpDirectoryListingParserLsTest, Ignored) { | 130 TEST_F(FtpDirectoryListingParserLsTest, Ignored) { |
131 const char* ignored_cases[] = { | 131 const char* ignored_cases[] = { |
132 "drwxr-xr-x 2 0 0 4096 Mar 18 2007 ", // http://crbug.com/60065 | 132 "drwxr-xr-x 2 0 0 4096 Mar 18 2007 ", // http://crbug.com/60065 |
133 | 133 |
134 "ftpd: .: Permission denied", | 134 "ftpd: .: Permission denied", |
135 "ftpd-BSD: .: Permission denied", | 135 "ftpd-BSD: .: Permission denied", |
| 136 "ls: .: EDC5111I Permission denied.", |
136 | 137 |
137 // Tests important for security: verify that after we detect the column | 138 // Tests important for security: verify that after we detect the column |
138 // offset we don't try to access invalid memory on malformed input. | 139 // offset we don't try to access invalid memory on malformed input. |
139 "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11", | 140 "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11", |
140 "drwxr-xr-x 3 ftp 4096 May 15 18:11", | 141 "drwxr-xr-x 3 ftp 4096 May 15 18:11", |
141 "drwxr-xr-x folder 0 May 15 18:11", | 142 "drwxr-xr-x folder 0 May 15 18:11", |
142 }; | 143 }; |
143 for (size_t i = 0; i < arraysize(ignored_cases); i++) { | 144 for (size_t i = 0; i < arraysize(ignored_cases); i++) { |
144 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | 145 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, |
145 ignored_cases[i])); | 146 ignored_cases[i])); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 std::vector<FtpDirectoryListingEntry> entries; | 179 std::vector<FtpDirectoryListingEntry> entries; |
179 EXPECT_FALSE(ParseFtpDirectoryListingLs(GetSingleLineTestCase(bad_cases[i]), | 180 EXPECT_FALSE(ParseFtpDirectoryListingLs(GetSingleLineTestCase(bad_cases[i]), |
180 GetMockCurrentTime(), | 181 GetMockCurrentTime(), |
181 &entries)); | 182 &entries)); |
182 } | 183 } |
183 } | 184 } |
184 | 185 |
185 } // namespace | 186 } // namespace |
186 | 187 |
187 } // namespace net | 188 } // namespace net |
OLD | NEW |