OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/ftp/ftp_directory_listing_parser_unittest.h" | |
6 | |
7 #include "base/format_macros.h" | |
8 #include "base/string_util.h" | |
9 #include "base/stringprintf.h" | |
10 #include "net/ftp/ftp_directory_listing_parser_hprc.h" | |
11 | |
12 namespace { | |
13 | |
14 typedef net::FtpDirectoryListingParserTest FtpDirectoryListingParserHprcTest; | |
15 | |
16 TEST_F(FtpDirectoryListingParserHprcTest, Good) { | |
17 const struct SingleLineTestData good_cases[] = { | |
18 { " .welcome", | |
19 net::FtpDirectoryListingEntry::FILE, ".welcome", 0, | |
20 1994, 11, 15, 12, 45 }, | |
21 }; | |
22 for (size_t i = 0; i < arraysize(good_cases); i++) { | |
23 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, | |
24 good_cases[i].input)); | |
25 | |
26 net::FtpDirectoryListingParserHprc parser(GetMockCurrentTime()); | |
27 RunSingleLineTestCase(&parser, good_cases[i]); | |
28 } | |
29 } | |
30 | |
31 TEST_F(FtpDirectoryListingParserHprcTest, Bad) { | |
32 const char* bad_cases[] = { | |
33 "", | |
34 "test", | |
35 "-rw-r--r-- 1 ftp ftp 528 Nov 01 2007 README", | |
36 "d [RWCEAFMS] ftpadmin 512 Jan 29 2004 pub", | |
37 "TEST.DIR;1 1 4-MAR-1999 22:14:34 [UCX$NOBO,ANONYMOUS] (RWE,RWE,RWE,RWE)", | |
38 "type=dir;modify=20010414155237;UNIX.mode=0555;unique=6ag5b4e400; etc", | |
39 }; | |
40 for (size_t i = 0; i < arraysize(bad_cases); i++) { | |
41 net::FtpDirectoryListingParserHprc parser(GetMockCurrentTime()); | |
42 EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i]; | |
43 } | |
44 } | |
45 | |
46 } // namespace | |
OLD | NEW |