OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 | 239 |
240 std::string data; | 240 std::string data; |
241 base::FilePath data_file = | 241 base::FilePath data_file = |
242 ui_test_utils::GetTestFilePath(base::FilePath().AppendASCII("autofill"), | 242 ui_test_utils::GetTestFilePath(base::FilePath().AppendASCII("autofill"), |
243 base::FilePath().AppendASCII(filename)); | 243 base::FilePath().AppendASCII(filename)); |
244 CHECK(base::ReadFileToString(data_file, &data)); | 244 CHECK(base::ReadFileToString(data_file, &data)); |
245 std::vector<std::string> lines; | 245 std::vector<std::string> lines; |
246 base::SplitString(data, '\n', &lines); | 246 base::SplitString(data, '\n', &lines); |
247 int parsed_profiles = 0; | 247 int parsed_profiles = 0; |
248 for (size_t i = 0; i < lines.size(); ++i) { | 248 for (size_t i = 0; i < lines.size(); ++i) { |
249 if (base::StartsWithASCII(lines[i], "#", false)) | 249 if (base::StartsWith(lines[i], "#", base::CompareCase::SENSITIVE)) |
250 continue; | 250 continue; |
251 | 251 |
252 std::vector<std::string> fields; | 252 std::vector<std::string> fields = base::SplitString( |
253 base::SplitString(lines[i], '|', &fields); | 253 lines[i], "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
Nico
2015/07/06 17:55:00
this is unrelated?
brettw
2015/07/06 18:23:34
Oh yeah, I've been doing both SplitString and Star
| |
254 if (fields.empty()) | 254 if (fields.empty()) |
255 continue; // Blank line. | 255 continue; // Blank line. |
256 | 256 |
257 ++parsed_profiles; | 257 ++parsed_profiles; |
258 CHECK_EQ(12u, fields.size()); | 258 CHECK_EQ(12u, fields.size()); |
259 | 259 |
260 FormMap data; | 260 FormMap data; |
261 data["NAME_FIRST"] = fields[0]; | 261 data["NAME_FIRST"] = fields[0]; |
262 data["NAME_MIDDLE"] = fields[1]; | 262 data["NAME_MIDDLE"] = fields[1]; |
263 data["NAME_LAST"] = fields[2]; | 263 data["NAME_LAST"] = fields[2]; |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
943 IN_PROC_BROWSER_TEST_F(AutofillTest, | 943 IN_PROC_BROWSER_TEST_F(AutofillTest, |
944 DISABLED_MergeAggregatedDuplicatedProfiles) { | 944 DISABLED_MergeAggregatedDuplicatedProfiles) { |
945 int num_of_profiles = | 945 int num_of_profiles = |
946 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); | 946 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); |
947 | 947 |
948 ASSERT_GT(num_of_profiles, | 948 ASSERT_GT(num_of_profiles, |
949 static_cast<int>(personal_data_manager()->GetProfiles().size())); | 949 static_cast<int>(personal_data_manager()->GetProfiles().size())); |
950 } | 950 } |
951 | 951 |
952 } // namespace autofill | 952 } // namespace autofill |
OLD | NEW |