Chromium Code Reviews| Index: components/autofill/core/browser/personal_data_manager_unittest.cc |
| diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc |
| index a9dfd18f4dc631de2c877982ffdc40a77c35b421..6edc296ac16adf2c48de219ed32ae6c17ae311a3 100644 |
| --- a/components/autofill/core/browser/personal_data_manager_unittest.cc |
| +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc |
| @@ -4011,6 +4011,83 @@ TEST_F(PersonalDataManagerTest, SaveImportedProfile) { |
| // two profiles being saved. |
| {ProfileFields(), {{NAME_FIRST, "Marionette"}}}, |
| + // Test that saving an identical profile except with the middle name |
| + // initial instead of the full middle name results in the profiles |
| + // getting merged and the full middle name being kept. |
| + {ProfileFields(), {{NAME_MIDDLE, "M"}}, {{NAME_MIDDLE, "Mitchell"}}}, |
| + |
| + // Test that saving an identical profile except with the full middle name |
| + // instead of the middle name initial results in the profiles getting |
| + // merged and the full middle name replacing the initial. |
| + {{{NAME_MIDDLE, "M"}}, |
| + {{NAME_MIDDLE, "Mitchell"}}, |
| + {{NAME_MIDDLE, "Mitchell"}}}, |
| + |
| + // Test that saving an identical profile except with no middle name |
| + // results in the profiles getting merged and the full middle name being |
| + // kept. |
| + {ProfileFields(), {{NAME_MIDDLE, ""}}, {{NAME_MIDDLE, "Mitchell"}}}, |
| + |
| + // Test that saving an identical profile except with a middle name initial |
| + // results in the profiles getting merged and the middle name initial |
| + // being saved. |
| + {{{NAME_MIDDLE, ""}}, {{NAME_MIDDLE, "M"}}, {{NAME_MIDDLE, "M"}}}, |
| + |
| + // Test that saving an identical profile except with a middle name |
| + // results in the profiles getting merged and the full middle name being |
| + // saved. |
| + {{{NAME_MIDDLE, ""}}, |
| + {{NAME_MIDDLE, "Mitchell"}}, |
| + {{NAME_MIDDLE, "Mitchell"}}}, |
| + |
| + // Test that saving a identical profile except with the full name set |
| + // instead of the name parts results in the two profiles being merged and |
| + // all the name parts kept and the full name being added. |
| + { |
| + { |
| + {NAME_FIRST, "Marion"}, |
| + {NAME_MIDDLE, "Mitchell"}, |
| + {NAME_LAST, "Morrison"}, |
| + {NAME_FULL, ""}, |
| + }, |
| + { |
| + {NAME_FIRST, ""}, |
| + {NAME_MIDDLE, ""}, |
| + {NAME_LAST, ""}, |
| + {NAME_FULL, "Marion Mitchell Morrison"}, |
| + }, |
| + { |
| + {NAME_FIRST, "Marion"}, |
| + {NAME_MIDDLE, "Mitchell"}, |
| + {NAME_LAST, "Morrison"}, |
| + {NAME_FULL, "Marion Mitchell Morrison"}, |
| + }, |
| + }, |
| + |
| + // Test that saving a identical profile except with the name parts set |
|
Mathieu
2016/05/13 13:32:52
Can we add a test where it's clear that the full n
sebsg
2016/05/13 17:20:02
Done.
|
| + // instead of the full name results in the two profiles being merged and |
| + // the full name being kept and all the name parts being added. |
| + { |
| + { |
| + {NAME_FIRST, ""}, |
| + {NAME_MIDDLE, ""}, |
| + {NAME_LAST, ""}, |
| + {NAME_FULL, "Marion Mitchell Morrison"}, |
| + }, |
| + { |
| + {NAME_FIRST, "Marion"}, |
| + {NAME_MIDDLE, "Mitchell"}, |
| + {NAME_LAST, "Morrison"}, |
| + {NAME_FULL, ""}, |
| + }, |
| + { |
| + {NAME_FIRST, "Marion"}, |
| + {NAME_MIDDLE, "Mitchell"}, |
| + {NAME_LAST, "Morrison"}, |
| + {NAME_FULL, "Marion Mitchell Morrison"}, |
| + }, |
| + }, |
| + |
| // Test that saving an identical profile except for the first address line |
| // results in two profiles being saved. |
| {ProfileFields(), {{ADDRESS_HOME_LINE1, "123 Aquarium St."}}}, |
| @@ -4152,6 +4229,8 @@ TEST_F(PersonalDataManagerTest, SaveImportedProfile) { |
| if (test_case.changed_field_values.empty()) { |
| EXPECT_EQ(2U, saved_profiles.size()); |
| } else { |
| + EXPECT_EQ(1U, saved_profiles.size()); |
| + |
| // Make sure the new information was merged correctly. |
| for (ProfileField changed_field : test_case.changed_field_values) { |
| EXPECT_EQ(base::UTF8ToUTF16(changed_field.field_value), |