| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if ((i > 0 && line == kProfileSeparator) || | 191 if ((i > 0 && line == kProfileSeparator) || |
| 192 i == lines.size() - 1) { | 192 i == lines.size() - 1) { |
| 193 // Reached the end of a profile. Try to import it. | 193 // Reached the end of a profile. Try to import it. |
| 194 FormStructure form_structure(form); | 194 FormStructure form_structure(form); |
| 195 for (size_t i = 0; i < form_structure.field_count(); ++i) { | 195 for (size_t i = 0; i < form_structure.field_count(); ++i) { |
| 196 // Set the heuristic type for each field, which is currently serialized | 196 // Set the heuristic type for each field, which is currently serialized |
| 197 // into the field's name. | 197 // into the field's name. |
| 198 AutofillField* field = | 198 AutofillField* field = |
| 199 const_cast<AutofillField*>(form_structure.field(i)); | 199 const_cast<AutofillField*>(form_structure.field(i)); |
| 200 AutofillFieldType type = | 200 AutofillFieldType type = |
| 201 AutofillType::StringToFieldType(UTF16ToUTF8(field->name())); | 201 AutofillType::StringToFieldType(UTF16ToUTF8(field->name)); |
| 202 field->set_heuristic_type(type); | 202 field->set_heuristic_type(type); |
| 203 } | 203 } |
| 204 std::vector<const FormStructure*> form_structures(1, &form_structure); | 204 std::vector<const FormStructure*> form_structures(1, &form_structure); |
| 205 | 205 |
| 206 // Import the profile. | 206 // Import the profile. |
| 207 const CreditCard* imported_credit_card; | 207 const CreditCard* imported_credit_card; |
| 208 personal_data_->ImportFormData(form_structures, &imported_credit_card); | 208 personal_data_->ImportFormData(form_structures, &imported_credit_card); |
| 209 EXPECT_FALSE(imported_credit_card); | 209 EXPECT_FALSE(imported_credit_card); |
| 210 | 210 |
| 211 // Clear the |form| to start a new profile. | 211 // Clear the |form| to start a new profile. |
| 212 form.fields.clear(); | 212 form.fields.clear(); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 *merged_profiles = SerializeProfiles(personal_data_->web_profiles()); | 216 *merged_profiles = SerializeProfiles(personal_data_->web_profiles()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 TEST_F(AutoFillMergeTest, DataDrivenMergeProfiles) { | 219 TEST_F(AutoFillMergeTest, DataDrivenMergeProfiles) { |
| 220 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 220 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
| 221 kFileNamePattern); | 221 kFileNamePattern); |
| 222 } | 222 } |
| OLD | NEW |