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

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

Issue 344015: Fix SCOPED_TRACE to not access memory in a wrong way. (Closed)
Patch Set: 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 | « no previous file | 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 net::FtpDirectoryListingEntry::DIRECTORY, "directory", 60 net::FtpDirectoryListingEntry::DIRECTORY, "directory",
61 now_exploded.year, 5, 15, 18, 11 }, 61 now_exploded.year, 5, 15, 18, 11 },
62 { "lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub -> vol/1/.CLUSTER/var_ftp/pub", 62 { "lrwxrwxrwx 1 0 0 26 Sep 18 2008 pub -> vol/1/.CLUSTER/var_ftp/pub",
63 net::FtpDirectoryListingEntry::SYMLINK, "pub", 63 net::FtpDirectoryListingEntry::SYMLINK, "pub",
64 2008, 9, 18, 0, 0 }, 64 2008, 9, 18, 0, 0 },
65 { "lrwxrwxrwx 1 0 0 3 Oct 12 13:37 mirror -> pub", 65 { "lrwxrwxrwx 1 0 0 3 Oct 12 13:37 mirror -> pub",
66 net::FtpDirectoryListingEntry::SYMLINK, "mirror", 66 net::FtpDirectoryListingEntry::SYMLINK, "mirror",
67 now_exploded.year, 10, 12, 13, 37 }, 67 now_exploded.year, 10, 12, 13, 37 },
68 }; 68 };
69 for (size_t i = 0; i < arraysize(good_cases); i++) { 69 for (size_t i = 0; i < arraysize(good_cases); i++) {
70 SCOPED_TRACE(StringPrintf("Test[%d]: %s", i, good_cases[i])); 70 SCOPED_TRACE(StringPrintf("Test[%d]: %s", i, good_cases[i].input));
71 71
72 net::FtpLsDirectoryListingParser parser; 72 net::FtpLsDirectoryListingParser parser;
73 RunSingleLineTestCase(&parser, good_cases[i]); 73 RunSingleLineTestCase(&parser, good_cases[i]);
74 } 74 }
75 75
76 const char* bad_cases[] = { 76 const char* bad_cases[] = {
77 "", 77 "",
78 "garbage", 78 "garbage",
79 "-rw-r--r-- 1 ftp ftp", 79 "-rw-r--r-- 1 ftp ftp",
80 "-rw-r--rgb 1 ftp ftp 528 Nov 01 2007 README", 80 "-rw-r--rgb 1 ftp ftp 528 Nov 01 2007 README",
81 "-rw-rgbr-- 1 ftp ftp 528 Nov 01 2007 README", 81 "-rw-rgbr-- 1 ftp ftp 528 Nov 01 2007 README",
82 "qrwwr--r-- 1 ftp ftp 528 Nov 01 2007 README", 82 "qrwwr--r-- 1 ftp ftp 528 Nov 01 2007 README",
83 "-rw-r--r-- -1 ftp ftp 528 Nov 01 2007 README", 83 "-rw-r--r-- -1 ftp ftp 528 Nov 01 2007 README",
84 "-rw-r--r-- 1 ftp ftp -528 Nov 01 2007 README", 84 "-rw-r--r-- 1 ftp ftp -528 Nov 01 2007 README",
85 "-rw-r--r-- 1 ftp ftp 528 Foo 01 2007 README", 85 "-rw-r--r-- 1 ftp ftp 528 Foo 01 2007 README",
86 }; 86 };
87 for (size_t i = 0; i < arraysize(bad_cases); i++) { 87 for (size_t i = 0; i < arraysize(bad_cases); i++) {
88 net::FtpLsDirectoryListingParser parser; 88 net::FtpLsDirectoryListingParser parser;
89 EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i]; 89 EXPECT_FALSE(parser.ConsumeLine(UTF8ToUTF16(bad_cases[i]))) << bad_cases[i];
90 } 90 }
91 } 91 }
92 92
93 } // namespace 93 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698