Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: components/autofill/core/browser/autofill_merge_unittest.cc

Issue 2855943002: Offer to save card locally if user manually enters same card number as (Closed)
Patch Set: Creates separate tests for duplicating masked server card and not duplicating full server card. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 AutofillField* field = 264 AutofillField* field =
265 const_cast<AutofillField*>(form_structure.field(i)); 265 const_cast<AutofillField*>(form_structure.field(i));
266 ServerFieldType type = 266 ServerFieldType type =
267 StringToFieldType(base::UTF16ToUTF8(field->name)); 267 StringToFieldType(base::UTF16ToUTF8(field->name));
268 field->set_heuristic_type(type); 268 field->set_heuristic_type(type);
269 } 269 }
270 form_structure.IdentifySections(false); 270 form_structure.IdentifySections(false);
271 271
272 // Import the profile. 272 // Import the profile.
273 std::unique_ptr<CreditCard> imported_credit_card; 273 std::unique_ptr<CreditCard> imported_credit_card;
274 personal_data_.ImportFormData(form_structure, false, 274 bool imported_credit_card_matches_masked_server_credit_card;
275 &imported_credit_card); 275 personal_data_.ImportFormData(
276 form_structure, false, &imported_credit_card,
277 &imported_credit_card_matches_masked_server_credit_card);
276 EXPECT_FALSE(imported_credit_card); 278 EXPECT_FALSE(imported_credit_card);
277 279
278 // Clear the |form| to start a new profile. 280 // Clear the |form| to start a new profile.
279 form.fields.clear(); 281 form.fields.clear();
280 } 282 }
281 } 283 }
282 284
283 *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); 285 *merged_profiles = SerializeProfiles(personal_data_.web_profiles());
284 } 286 }
285 287
286 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { 288 ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) {
287 return string_to_field_type_map_[str]; 289 return string_to_field_type_map_[str];
288 } 290 }
289 291
290 TEST_P(AutofillMergeTest, DataDrivenMergeProfiles) { 292 TEST_P(AutofillMergeTest, DataDrivenMergeProfiles) {
291 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName)); 293 RunOneDataDrivenTest(GetParam(), GetOutputDirectory(kTestName));
292 } 294 }
293 295
294 INSTANTIATE_TEST_CASE_P(, AutofillMergeTest, testing::ValuesIn(GetTestFiles())); 296 INSTANTIATE_TEST_CASE_P(, AutofillMergeTest, testing::ValuesIn(GetTestFiles()));
295 297
296 } // namespace autofill 298 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698