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

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

Issue 3390026: net: Append base:: in the StringPrintf calls. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: fix include order Created 10 years, 2 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
« no previous file with comments | « net/disk_cache/stats.cc ('k') | net/ftp/ftp_directory_listing_parser_ls_unittest.cc » ('j') | 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_buffer.h" 5 #include "net/ftp/ftp_directory_listing_buffer.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); 54 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir);
55 test_dir = test_dir.AppendASCII("net"); 55 test_dir = test_dir.AppendASCII("net");
56 test_dir = test_dir.AppendASCII("data"); 56 test_dir = test_dir.AppendASCII("data");
57 test_dir = test_dir.AppendASCII("ftp"); 57 test_dir = test_dir.AppendASCII("ftp");
58 58
59 base::Time mock_current_time; 59 base::Time mock_current_time;
60 ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994 12:45:26 GMT", 60 ASSERT_TRUE(base::Time::FromString(L"Tue, 15 Nov 1994 12:45:26 GMT",
61 &mock_current_time)); 61 &mock_current_time));
62 62
63 for (size_t i = 0; i < arraysize(test_files); i++) { 63 for (size_t i = 0; i < arraysize(test_files); i++) {
64 SCOPED_TRACE(StringPrintf("Test[%" PRIuS "]: %s", i, test_files[i])); 64 SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %s", i, test_files[i]));
65 65
66 net::FtpDirectoryListingBuffer buffer(mock_current_time); 66 net::FtpDirectoryListingBuffer buffer(mock_current_time);
67 67
68 std::string test_listing; 68 std::string test_listing;
69 EXPECT_TRUE(file_util::ReadFileToString(test_dir.AppendASCII(test_files[i]), 69 EXPECT_TRUE(file_util::ReadFileToString(test_dir.AppendASCII(test_files[i]),
70 &test_listing)); 70 &test_listing));
71 71
72 EXPECT_EQ(net::OK, buffer.ConsumeData(test_listing.data(), 72 EXPECT_EQ(net::OK, buffer.ConsumeData(test_listing.data(),
73 test_listing.length())); 73 test_listing.length()));
74 EXPECT_EQ(net::OK, buffer.ProcessRemainingData()); 74 EXPECT_EQ(net::OK, buffer.ProcessRemainingData());
75 75
76 std::string expected_listing; 76 std::string expected_listing;
77 ASSERT_TRUE(file_util::ReadFileToString( 77 ASSERT_TRUE(file_util::ReadFileToString(
78 test_dir.AppendASCII(std::string(test_files[i]) + ".expected"), 78 test_dir.AppendASCII(std::string(test_files[i]) + ".expected"),
79 &expected_listing)); 79 &expected_listing));
80 80
81 std::vector<std::string> lines; 81 std::vector<std::string> lines;
82 StringTokenizer tokenizer(expected_listing, "\r\n"); 82 StringTokenizer tokenizer(expected_listing, "\r\n");
83 while (tokenizer.GetNext()) 83 while (tokenizer.GetNext())
84 lines.push_back(tokenizer.token()); 84 lines.push_back(tokenizer.token());
85 ASSERT_EQ(0U, lines.size() % 8); 85 ASSERT_EQ(0U, lines.size() % 8);
86 86
87 for (size_t i = 0; i < lines.size() / 8; i++) { 87 for (size_t i = 0; i < lines.size() / 8; i++) {
88 std::string type(lines[8 * i]); 88 std::string type(lines[8 * i]);
89 std::string name(lines[8 * i + 1]); 89 std::string name(lines[8 * i + 1]);
90 int64 size; 90 int64 size;
91 base::StringToInt64(lines[8 * i + 2], &size); 91 base::StringToInt64(lines[8 * i + 2], &size);
92 92
93 SCOPED_TRACE(StringPrintf("Filename: %s", name.c_str())); 93 SCOPED_TRACE(base::StringPrintf("Filename: %s", name.c_str()));
94 94
95 int year, month, day_of_month, hour, minute; 95 int year, month, day_of_month, hour, minute;
96 base::StringToInt(lines[8 * i + 3], &year); 96 base::StringToInt(lines[8 * i + 3], &year);
97 base::StringToInt(lines[8 * i + 4], &month); 97 base::StringToInt(lines[8 * i + 4], &month);
98 base::StringToInt(lines[8 * i + 5], &day_of_month); 98 base::StringToInt(lines[8 * i + 5], &day_of_month);
99 base::StringToInt(lines[8 * i + 6], &hour); 99 base::StringToInt(lines[8 * i + 6], &hour);
100 base::StringToInt(lines[8 * i + 7], &minute); 100 base::StringToInt(lines[8 * i + 7], &minute);
101 101
102 ASSERT_TRUE(buffer.EntryAvailable()); 102 ASSERT_TRUE(buffer.EntryAvailable());
103 net::FtpDirectoryListingEntry entry = buffer.PopEntry(); 103 net::FtpDirectoryListingEntry entry = buffer.PopEntry();
(...skipping 19 matching lines...) Expand all
123 EXPECT_EQ(hour, time_exploded.hour); 123 EXPECT_EQ(hour, time_exploded.hour);
124 EXPECT_EQ(minute, time_exploded.minute); 124 EXPECT_EQ(minute, time_exploded.minute);
125 EXPECT_EQ(0, time_exploded.second); 125 EXPECT_EQ(0, time_exploded.second);
126 EXPECT_EQ(0, time_exploded.millisecond); 126 EXPECT_EQ(0, time_exploded.millisecond);
127 } 127 }
128 EXPECT_FALSE(buffer.EntryAvailable()); 128 EXPECT_FALSE(buffer.EntryAvailable());
129 } 129 }
130 } 130 }
131 131
132 } // namespace 132 } // namespace
OLDNEW
« no previous file with comments | « net/disk_cache/stats.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