| 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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 // Aggregate profiles from forms into Autofill preferences. Returns the number | 193 // Aggregate profiles from forms into Autofill preferences. Returns the number |
| 194 // of parsed profiles. | 194 // of parsed profiles. |
| 195 int AggregateProfilesIntoAutofillPrefs(const std::string& filename) { | 195 int AggregateProfilesIntoAutofillPrefs(const std::string& filename) { |
| 196 CHECK(test_server()->Start()); | 196 CHECK(test_server()->Start()); |
| 197 | 197 |
| 198 std::string data; | 198 std::string data; |
| 199 base::FilePath data_file = | 199 base::FilePath data_file = |
| 200 ui_test_utils::GetTestFilePath(base::FilePath().AppendASCII("autofill"), | 200 ui_test_utils::GetTestFilePath(base::FilePath().AppendASCII("autofill"), |
| 201 base::FilePath().AppendASCII(filename)); | 201 base::FilePath().AppendASCII(filename)); |
| 202 CHECK(file_util::ReadFileToString(data_file, &data)); | 202 CHECK(base::ReadFileToString(data_file, &data)); |
| 203 std::vector<std::string> lines; | 203 std::vector<std::string> lines; |
| 204 base::SplitString(data, '\n', &lines); | 204 base::SplitString(data, '\n', &lines); |
| 205 int parsed_profiles = 0; | 205 int parsed_profiles = 0; |
| 206 for (size_t i = 0; i < lines.size(); ++i) { | 206 for (size_t i = 0; i < lines.size(); ++i) { |
| 207 if (StartsWithASCII(lines[i], "#", false)) | 207 if (StartsWithASCII(lines[i], "#", false)) |
| 208 continue; | 208 continue; |
| 209 | 209 |
| 210 std::vector<std::string> fields; | 210 std::vector<std::string> fields; |
| 211 base::SplitString(lines[i], '|', &fields); | 211 base::SplitString(lines[i], '|', &fields); |
| 212 if (fields.empty()) | 212 if (fields.empty()) |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 IN_PROC_BROWSER_TEST_F(AutofillTest, | 721 IN_PROC_BROWSER_TEST_F(AutofillTest, |
| 722 DISABLED_MergeAggregatedDuplicatedProfiles) { | 722 DISABLED_MergeAggregatedDuplicatedProfiles) { |
| 723 int num_of_profiles = | 723 int num_of_profiles = |
| 724 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); | 724 AggregateProfilesIntoAutofillPrefs("dataset_duplicated_profiles.txt"); |
| 725 | 725 |
| 726 ASSERT_GT(num_of_profiles, | 726 ASSERT_GT(num_of_profiles, |
| 727 static_cast<int>(personal_data_manager()->GetProfiles().size())); | 727 static_cast<int>(personal_data_manager()->GetProfiles().size())); |
| 728 } | 728 } |
| 729 | 729 |
| 730 } // namespace autofill | 730 } // namespace autofill |
| OLD | NEW |