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

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

Issue 112963005: Update uses of UTF conversions in courgette/, device/, extensions/, google_apis/, gpu/, ipc/, media… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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_parser_unittest.h" 5 #include "net/ftp/ftp_directory_listing_parser_unittest.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 18 matching lines...) Expand all
29 2010, 5, 17, 0, 0 }, 29 2010, 5, 17, 0, 0 },
30 }; 30 };
31 for (size_t i = 0; i < arraysize(good_cases); i++) { 31 for (size_t i = 0; i < arraysize(good_cases); i++) {
32 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, 32 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
33 good_cases[i].input)); 33 good_cases[i].input));
34 34
35 std::vector<base::string16> lines( 35 std::vector<base::string16> lines(
36 GetSingleLineTestCase(good_cases[i].input)); 36 GetSingleLineTestCase(good_cases[i].input));
37 37
38 // The parser requires a "total n" line before accepting regular input. 38 // The parser requires a "total n" line before accepting regular input.
39 lines.insert(lines.begin(), ASCIIToUTF16("total 1")); 39 lines.insert(lines.begin(), base::ASCIIToUTF16("total 1"));
40 40
41 std::vector<FtpDirectoryListingEntry> entries; 41 std::vector<FtpDirectoryListingEntry> entries;
42 EXPECT_TRUE(ParseFtpDirectoryListingNetware(lines, 42 EXPECT_TRUE(ParseFtpDirectoryListingNetware(lines,
43 GetMockCurrentTime(), 43 GetMockCurrentTime(),
44 &entries)); 44 &entries));
45 VerifySingleLineTestCase(good_cases[i], entries); 45 VerifySingleLineTestCase(good_cases[i], entries);
46 } 46 }
47 } 47 }
48 48
49 TEST_F(FtpDirectoryListingParserNetwareTest, Bad) { 49 TEST_F(FtpDirectoryListingParserNetwareTest, Bad) {
50 const char* bad_cases[] = { 50 const char* bad_cases[] = {
51 " foo", 51 " foo",
52 "garbage", 52 "garbage",
53 "d [] ftpadmin 512 Jan 29 2004 pub", 53 "d [] ftpadmin 512 Jan 29 2004 pub",
54 "d [XGARBAGE] ftpadmin 512 Jan 29 2004 pub", 54 "d [XGARBAGE] ftpadmin 512 Jan 29 2004 pub",
55 "d [RWCEAFMS] 512 Jan 29 2004 pub", 55 "d [RWCEAFMS] 512 Jan 29 2004 pub",
56 "d [RWCEAFMS] ftpadmin -1 Jan 29 2004 pub", 56 "d [RWCEAFMS] ftpadmin -1 Jan 29 2004 pub",
57 "l [RW------] ftpadmin 512 Jan 29 2004 pub", 57 "l [RW------] ftpadmin 512 Jan 29 2004 pub",
58 }; 58 };
59 for (size_t i = 0; i < arraysize(bad_cases); i++) { 59 for (size_t i = 0; i < arraysize(bad_cases); i++) {
60 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, 60 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i,
61 bad_cases[i])); 61 bad_cases[i]));
62 62
63 std::vector<base::string16> lines(GetSingleLineTestCase(bad_cases[i])); 63 std::vector<base::string16> lines(GetSingleLineTestCase(bad_cases[i]));
64 64
65 // The parser requires a "total n" line before accepting regular input. 65 // The parser requires a "total n" line before accepting regular input.
66 lines.insert(lines.begin(), ASCIIToUTF16("total 1")); 66 lines.insert(lines.begin(), base::ASCIIToUTF16("total 1"));
67 67
68 std::vector<FtpDirectoryListingEntry> entries; 68 std::vector<FtpDirectoryListingEntry> entries;
69 EXPECT_FALSE(ParseFtpDirectoryListingNetware(lines, 69 EXPECT_FALSE(ParseFtpDirectoryListingNetware(lines,
70 GetMockCurrentTime(), 70 GetMockCurrentTime(),
71 &entries)); 71 &entries));
72 } 72 }
73 } 73 }
74 74
75 } // namespace 75 } // namespace
76 76
77 } // namespace net 77 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_directory_listing_parser_netware.cc ('k') | net/ftp/ftp_directory_listing_parser_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698