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

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

Issue 368006: Fix the "ls -l" FTP LIST format parser to understand correctly (Closed)
Patch Set: make the code more obvious 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/string_util.h" 7 #include "base/string_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace { 10 namespace {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 now_exploded.year, 10, 12, 13, 37 }, 69 now_exploded.year, 10, 12, 13, 37 },
70 }; 70 };
71 for (size_t i = 0; i < arraysize(good_cases); i++) { 71 for (size_t i = 0; i < arraysize(good_cases); i++) {
72 SCOPED_TRACE(StringPrintf("Test[%d]: %s", i, good_cases[i].input)); 72 SCOPED_TRACE(StringPrintf("Test[%d]: %s", i, good_cases[i].input));
73 73
74 net::FtpLsDirectoryListingParser parser; 74 net::FtpLsDirectoryListingParser parser;
75 RunSingleLineTestCase(&parser, good_cases[i]); 75 RunSingleLineTestCase(&parser, good_cases[i]);
76 } 76 }
77 77
78 const char* bad_cases[] = { 78 const char* bad_cases[] = {
79 "",
80 "garbage", 79 "garbage",
81 "-rw-r--r-- 1 ftp ftp", 80 "-rw-r--r-- 1 ftp ftp",
82 "-rw-r--rgb 1 ftp ftp 528 Nov 01 2007 README", 81 "-rw-r--rgb 1 ftp ftp 528 Nov 01 2007 README",
83 "-rw-rgbr-- 1 ftp ftp 528 Nov 01 2007 README", 82 "-rw-rgbr-- 1 ftp ftp 528 Nov 01 2007 README",
84 "qrwwr--r-- 1 ftp ftp 528 Nov 01 2007 README", 83 "qrwwr--r-- 1 ftp ftp 528 Nov 01 2007 README",
85 "-rw-r--r-- -1 ftp ftp 528 Nov 01 2007 README", 84 "-rw-r--r-- -1 ftp ftp 528 Nov 01 2007 README",
86 "-rw-r--r-- 1 ftp ftp -528 Nov 01 2007 README", 85 "-rw-r--r-- 1 ftp ftp -528 Nov 01 2007 README",
87 "-rw-r--r-- 1 ftp ftp 528 Foo 01 2007 README", 86 "-rw-r--r-- 1 ftp ftp 528 Foo 01 2007 README",
88 }; 87 };
89 for (size_t i = 0; i < arraysize(bad_cases); i++) { 88 for (size_t i = 0; i < arraysize(bad_cases); i++) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (!parser.ConsumeLine(UTF8ToUTF16(*i))) { 187 if (!parser.ConsumeLine(UTF8ToUTF16(*i))) {
189 failed = true; 188 failed = true;
190 break; 189 break;
191 } 190 }
192 } 191 }
193 EXPECT_TRUE(failed); 192 EXPECT_TRUE(failed);
194 } 193 }
195 } 194 }
196 195
197 } // namespace 196 } // 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