Autofill should not allow overwrite of field data when merging profile data

Changes notion of |PrimaryKey| to include address line 2 and email.  When submitting a filled form the Autofill merging of profiles now considers changes to address line 2 and email a trigger to create a new profile.

BUG=64669
TEST=PersonalDataManagerTest.AggregateSameProfileWithConflict

Review URL: http://codereview.chromium.org/5364007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67680 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/autofill/personal_data_manager_unittest.cc b/chrome/browser/autofill/personal_data_manager_unittest.cc
index 11978df..a4b3099 100644
--- a/chrome/browser/autofill/personal_data_manager_unittest.cc
+++ b/chrome/browser/autofill/personal_data_manager_unittest.cc
@@ -750,8 +750,15 @@
       "Address:", "address", "1600 Pennsylvania Avenue", "text", &field);
   form1.fields.push_back(field);
   autofill_test::CreateTestFormField(
+      "Address Line 2:", "address2", "Suite A", "text", &field);
+  form1.fields.push_back(field);
+  autofill_test::CreateTestFormField(
       "Email:", "email", "[email protected]", "text", &field);
   form1.fields.push_back(field);
+  // Phone gets updated.
+  autofill_test::CreateTestFormField(
+      "Phone:", "phone", "4445556666", "text", &field);
+  form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
   std::vector<FormStructure*> forms;
@@ -766,8 +773,8 @@
 
   AutoFillProfile expected;
   autofill_test::SetProfileInfo(&expected, NULL, "George", NULL,
-      "Washington", "[email protected]", NULL, "1600 Pennsylvania Avenue", NULL,
-      NULL, NULL, NULL, NULL, NULL, NULL);
+      "Washington", "[email protected]", NULL, "1600 Pennsylvania Avenue",
+      "Suite A", NULL, NULL, NULL, NULL, "4445556666", NULL);
   const std::vector<AutoFillProfile*>& results1 = personal_data_->profiles();
   ASSERT_EQ(1U, results1.size());
   EXPECT_EQ(0, expected.Compare(*results1[0]));
@@ -783,13 +790,19 @@
   autofill_test::CreateTestFormField(
       "Address:", "address", "1600 Pennsylvania Avenue", "text", &field);
   form2.fields.push_back(field);
+  autofill_test::CreateTestFormField(
+      "Address Line 2:", "address2", "Suite A", "text", &field);
+  form2.fields.push_back(field);
+  autofill_test::CreateTestFormField(
+      "Email:", "email", "[email protected]", "text", &field);
+  form2.fields.push_back(field);
   // Country gets added.
   autofill_test::CreateTestFormField(
       "Country:", "country", "USA", "text", &field);
   form2.fields.push_back(field);
-  // Email gets updated.
+  // Phone gets updated.
   autofill_test::CreateTestFormField(
-      "Email:", "email", "[email protected]", "text", &field);
+      "Phone:", "phone", "1231231234", "text", &field);
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
@@ -807,8 +820,8 @@
 
   AutoFillProfile expected2;
   autofill_test::SetProfileInfo(&expected2, NULL, "George", NULL,
-      "Washington", "[email protected]", NULL, "1600 Pennsylvania Avenue",
-      NULL, NULL, NULL, NULL, "USA", NULL, NULL);
+      "Washington", "[email protected]", NULL, "1600 Pennsylvania Avenue",
+      "Suite A", NULL, NULL, NULL, "USA", "1231231234", NULL);
   ASSERT_EQ(1U, results2.size());
   EXPECT_EQ(0, expected2.Compare(*results2[0]));
 }