| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // Add a field to the current profile. | 172 // Add a field to the current profile. |
| 173 size_t separator_pos = line.find(kFieldSeparator); | 173 size_t separator_pos = line.find(kFieldSeparator); |
| 174 ASSERT_NE(std::string::npos, separator_pos); | 174 ASSERT_NE(std::string::npos, separator_pos); |
| 175 string16 field_type = UTF8ToUTF16(line.substr(0, separator_pos)); | 175 string16 field_type = UTF8ToUTF16(line.substr(0, separator_pos)); |
| 176 string16 value = UTF8ToUTF16(line.substr(separator_pos + kFieldOffset)); | 176 string16 value = UTF8ToUTF16(line.substr(separator_pos + kFieldOffset)); |
| 177 | 177 |
| 178 FormFieldData field; | 178 FormFieldData field; |
| 179 field.label = field_type; | 179 field.label = field_type; |
| 180 field.name = field_type; | 180 field.name = field_type; |
| 181 field.value = value; | 181 field.value = value; |
| 182 field.form_control_type = ASCIIToUTF16("text"); | 182 field.form_control_type = "text"; |
| 183 form.fields.push_back(field); | 183 form.fields.push_back(field); |
| 184 } | 184 } |
| 185 | 185 |
| 186 // The first line is always a profile separator, and the last profile is not | 186 // The first line is always a profile separator, and the last profile is not |
| 187 // followed by an explicit separator. | 187 // followed by an explicit separator. |
| 188 if ((i > 0 && line == kProfileSeparator) || i == lines.size() - 1) { | 188 if ((i > 0 && line == kProfileSeparator) || i == lines.size() - 1) { |
| 189 // Reached the end of a profile. Try to import it. | 189 // Reached the end of a profile. Try to import it. |
| 190 FormStructure form_structure(form); | 190 FormStructure form_structure(form); |
| 191 for (size_t i = 0; i < form_structure.field_count(); ++i) { | 191 for (size_t i = 0; i < form_structure.field_count(); ++i) { |
| 192 // Set the heuristic type for each field, which is currently serialized | 192 // Set the heuristic type for each field, which is currently serialized |
| (...skipping 15 matching lines...) Expand all Loading... |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); | 211 *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); |
| 212 } | 212 } |
| 213 | 213 |
| 214 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { | 214 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { |
| 215 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 215 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
| 216 kFileNamePattern); | 216 kFileNamePattern); |
| 217 } | 217 } |
| OLD | NEW |