Compute if a layer is clipped outside CalcDrawProps
[chromium-blink-merge.git] / net / ftp / ftp_directory_listing_parser_netware_unittest.cc
blob11c695f80f878a8e33dd26a69256cf56a1c4fa5e
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
3 // found in the LICENSE file.
5 #include "net/ftp/ftp_directory_listing_parser_unittest.h"
7 #include "base/format_macros.h"
8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "net/ftp/ftp_directory_listing_parser_netware.h"
13 namespace net {
15 namespace {
17 typedef FtpDirectoryListingParserTest FtpDirectoryListingParserNetwareTest;
19 TEST_F(FtpDirectoryListingParserNetwareTest, Good) {
20 const struct SingleLineTestData good_cases[] = {
21 { "d [RWCEAFMS] ftpadmin 512 Jan 29 2004 pub",
22 FtpDirectoryListingEntry::DIRECTORY, "pub", -1,
23 2004, 1, 29, 0, 0 },
24 { "- [RW------] ftpadmin 123 Nov 11 18:25 afile",
25 FtpDirectoryListingEntry::FILE, "afile", 123,
26 1994, 11, 11, 18, 25 },
27 { "d [RWCEAFMS] daniel 512 May 17 2010 NVP anyagok",
28 FtpDirectoryListingEntry::DIRECTORY, "NVP anyagok", -1,
29 2010, 5, 17, 0, 0 },
31 for (size_t i = 0; i < arraysize(good_cases); i++) {
32 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
33 good_cases[i].input));
35 std::vector<base::string16> lines(
36 GetSingleLineTestCase(good_cases[i].input));
38 // The parser requires a "total n" line before accepting regular input.
39 lines.insert(lines.begin(), base::ASCIIToUTF16("total 1"));
41 std::vector<FtpDirectoryListingEntry> entries;
42 EXPECT_TRUE(ParseFtpDirectoryListingNetware(lines,
43 GetMockCurrentTime(),
44 &entries));
45 VerifySingleLineTestCase(good_cases[i], entries);
49 TEST_F(FtpDirectoryListingParserNetwareTest, Bad) {
50 const char* const bad_cases[] = {
51 " foo",
52 "garbage",
53 "d [] ftpadmin 512 Jan 29 2004 pub",
54 "d [XGARBAGE] ftpadmin 512 Jan 29 2004 pub",
55 "d [RWCEAFMS] 512 Jan 29 2004 pub",
56 "d [RWCEAFMS] ftpadmin -1 Jan 29 2004 pub",
57 "l [RW------] ftpadmin 512 Jan 29 2004 pub",
59 for (size_t i = 0; i < arraysize(bad_cases); i++) {
60 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
61 bad_cases[i]));
63 std::vector<base::string16> lines(GetSingleLineTestCase(bad_cases[i]));
65 // The parser requires a "total n" line before accepting regular input.
66 lines.insert(lines.begin(), base::ASCIIToUTF16("total 1"));
68 std::vector<FtpDirectoryListingEntry> entries;
69 EXPECT_FALSE(ParseFtpDirectoryListingNetware(lines,
70 GetMockCurrentTime(),
71 &entries));
75 } // namespace
77 } // namespace net