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

Unified Diff: net/ftp/ftp_directory_listing_parser_hprc_unittest.cc

Issue 3448029: FTP: fix directory listing parser for ftp.usa.hp.com (Closed)
Patch Set: attempt to fix Windows trybots Created 10 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_hprc.cc ('k') | net/ftp/ftp_directory_listing_parser_ls_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_directory_listing_parser_hprc_unittest.cc
diff --git a/net/ftp/ftp_directory_listing_parser_hprc_unittest.cc b/net/ftp/ftp_directory_listing_parser_hprc_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bd057e9d3529dedaba0477ee0539a4289017c7ff
--- /dev/null
+++ b/net/ftp/ftp_directory_listing_parser_hprc_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/ftp/ftp_directory_listing_parser_unittest.h"
+
+#include "base/format_macros.h"
+#include "base/string_util.h"
+#include "base/stringprintf.h"
+#include "net/ftp/ftp_directory_listing_parser_hprc.h"
+
+namespace {
+
+typedef net::FtpDirectoryListingParserTest FtpDirectoryListingParserHprcTest;
+
+TEST_F(FtpDirectoryListingParserHprcTest, Good) {
+ const struct SingleLineTestData good_cases[] = {
+ { " .welcome",
+ net::FtpDirectoryListingEntry::FILE, ".welcome", 0,
+ 1994, 11, 15, 12, 45 },
+ };
+ for (size_t i = 0; i < arraysize(good_cases); i++) {
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
+ good_cases[i].input));
+
+ net::FtpDirectoryListingParserHprc parser(GetMockCurrentTime());
+ RunSingleLineTestCase(&parser, good_cases[i]);
+ }
+}
+
+TEST_F(FtpDirectoryListingParserHprcTest, Bad) {
+ const char* bad_cases[] = {
+ "",
+ "test",
+ "-rw-r--r-- 1 ftp ftp 528 Nov 01 2007 README",
+ "d [RWCEAFMS] ftpadmin 512 Jan 29 2004 pub",
+ "TEST.DIR;1 1 4-MAR-1999 22:14:34 [UCX$NOBO,ANONYMOUS] (RWE,RWE,RWE,RWE)",
+ "type=dir;modify=20010414155237;UNIX.mode=0555;unique=6ag5b4e400; etc",
+ };
+ for (size_t i = 0; i < arraysize(bad_cases); i++) {
+ net::FtpDirectoryListingParserHprc parser(GetMockCurrentTime());
+ EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i];
+ }
+}
+
+} // namespace
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_hprc.cc ('k') | net/ftp/ftp_directory_listing_parser_ls_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698