Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: net/ftp/ftp_directory_listing_parsers_unittest.cc

Issue 421006: Fix recognizing FTP listings consisting of only one line. (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/ftp/ftp_directory_listing_parsers.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_parsers.h" 5 #include "net/ftp/ftp_directory_listing_parsers.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 "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 2007, 11, 1, 0, 0 }, 61 2007, 11, 1, 0, 0 },
62 { "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11 directory", 62 { "drwxr-xr-x 3 ftp ftp 4096 May 15 18:11 directory",
63 net::FtpDirectoryListingEntry::DIRECTORY, "directory", -1, 63 net::FtpDirectoryListingEntry::DIRECTORY, "directory", -1,
64 now_exploded.year, 5, 15, 18, 11 }, 64 now_exploded.year, 5, 15, 18, 11 },
65 { "lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub -> vol/1/.CLUSTER/var_ftp/pub", 65 { "lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub -> vol/1/.CLUSTER/var_ftp/pub",
66 net::FtpDirectoryListingEntry::SYMLINK, "pub", -1, 66 net::FtpDirectoryListingEntry::SYMLINK, "pub", -1,
67 2008, 9, 18, 0, 0 }, 67 2008, 9, 18, 0, 0 },
68 { "lrwxrwxrwx 1 0 0 3 Oct 12 13:37 mirror -> pub", 68 { "lrwxrwxrwx 1 0 0 3 Oct 12 13:37 mirror -> pub",
69 net::FtpDirectoryListingEntry::SYMLINK, "mirror", -1, 69 net::FtpDirectoryListingEntry::SYMLINK, "mirror", -1,
70 now_exploded.year, 10, 12, 13, 37 }, 70 now_exploded.year, 10, 12, 13, 37 },
71 { "drwxrwsr-x 4 501 501 4096 Feb 20 2007 pub",
72 net::FtpDirectoryListingEntry::DIRECTORY, "pub", -1,
73 2007, 2, 20, 0, 0 },
71 }; 74 };
72 for (size_t i = 0; i < arraysize(good_cases); i++) { 75 for (size_t i = 0; i < arraysize(good_cases); i++) {
73 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input)); 76 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, good_cases[i].input));
74 77
75 net::FtpLsDirectoryListingParser parser; 78 net::FtpLsDirectoryListingParser parser;
76 RunSingleLineTestCase(&parser, good_cases[i]); 79 RunSingleLineTestCase(&parser, good_cases[i]);
77 } 80 }
78 81
79 const char* bad_cases[] = { 82 const char* bad_cases[] = {
80 "garbage", 83 "garbage",
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (!parser.ConsumeLine(UTF8ToUTF16(*i))) { 249 if (!parser.ConsumeLine(UTF8ToUTF16(*i))) {
247 failed = true; 250 failed = true;
248 break; 251 break;
249 } 252 }
250 } 253 }
251 EXPECT_TRUE(failed); 254 EXPECT_TRUE(failed);
252 } 255 }
253 } 256 }
254 257
255 } // namespace 258 } // namespace
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parsers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698