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