OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <map> | 7 #include <map> |
| 8 #include <memory> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
13 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "components/autofill/core/browser/autofill_test_utils.h" | 17 #include "components/autofill/core/browser/autofill_test_utils.h" |
17 #include "components/autofill/core/browser/autofill_type.h" | 18 #include "components/autofill/core/browser/autofill_type.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // into the field's name. | 223 // into the field's name. |
223 AutofillField* field = | 224 AutofillField* field = |
224 const_cast<AutofillField*>(form_structure.field(i)); | 225 const_cast<AutofillField*>(form_structure.field(i)); |
225 ServerFieldType type = | 226 ServerFieldType type = |
226 StringToFieldType(base::UTF16ToUTF8(field->name)); | 227 StringToFieldType(base::UTF16ToUTF8(field->name)); |
227 field->set_heuristic_type(type); | 228 field->set_heuristic_type(type); |
228 } | 229 } |
229 form_structure.IdentifySections(false); | 230 form_structure.IdentifySections(false); |
230 | 231 |
231 // Import the profile. | 232 // Import the profile. |
232 scoped_ptr<CreditCard> imported_credit_card; | 233 std::unique_ptr<CreditCard> imported_credit_card; |
233 personal_data_.ImportFormData(form_structure, false, | 234 personal_data_.ImportFormData(form_structure, false, |
234 &imported_credit_card); | 235 &imported_credit_card); |
235 EXPECT_FALSE(imported_credit_card); | 236 EXPECT_FALSE(imported_credit_card); |
236 | 237 |
237 // Clear the |form| to start a new profile. | 238 // Clear the |form| to start a new profile. |
238 form.fields.clear(); | 239 form.fields.clear(); |
239 } | 240 } |
240 } | 241 } |
241 | 242 |
242 *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); | 243 *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); |
243 } | 244 } |
244 | 245 |
245 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { | 246 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { |
246 return string_to_field_type_map_[str]; | 247 return string_to_field_type_map_[str]; |
247 } | 248 } |
248 | 249 |
249 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { | 250 TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { |
250 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), | 251 RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), |
251 kFileNamePattern); | 252 kFileNamePattern); |
252 } | 253 } |
253 | 254 |
254 } // namespace autofill | 255 } // namespace autofill |
OLD | NEW |