Only detect heuristic autofill types on page load (not on form submission).

BUG=75862, 76034
TEST=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78336 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 2575239..6ae07e4 100644
--- a/chrome/browser/autofill/personal_data_manager_unittest.cc
+++ b/chrome/browser/autofill/personal_data_manager_unittest.cc
@@ -542,6 +542,7 @@
       "Zip:", "zip", "94102", "text", &field);
   form.fields.push_back(field);
   FormStructure form_structure(form);
+  form_structure.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure);
   const CreditCard* imported_credit_card;
@@ -588,6 +589,7 @@
       "Zip:", "zip", "94102", "text", &field);
   form.fields.push_back(field);
   FormStructure form_structure(form);
+  form_structure.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure);
   const CreditCard* imported_credit_card;
@@ -622,6 +624,7 @@
       "Card number:", "card_number", "4111 1111 1111 1111", "text", &field);
   form.fields.push_back(field);
   FormStructure form_structure(form);
+  form_structure.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure);
   const CreditCard* imported_credit_card;
@@ -674,6 +677,7 @@
       "Zip:", "zip", "94102", "text", &field);
   form.fields.push_back(field);
   FormStructure form_structure(form);
+  form_structure.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure);
   const CreditCard* imported_credit_card;
@@ -776,6 +780,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -821,6 +826,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_TRUE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -876,6 +882,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -933,6 +940,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_TRUE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -978,6 +986,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1023,6 +1032,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_TRUE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -1073,6 +1083,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1119,6 +1130,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_TRUE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -1160,6 +1172,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1198,6 +1211,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1235,6 +1249,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_TRUE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -1276,6 +1291,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1313,6 +1329,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_FALSE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -1344,6 +1361,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1382,6 +1400,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_TRUE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -1424,6 +1443,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1458,6 +1478,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_FALSE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -1493,6 +1514,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1529,6 +1551,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_FALSE(personal_data_->ImportFormData(forms, &imported_credit_card));
@@ -1562,6 +1585,7 @@
   form1.fields.push_back(field);
 
   FormStructure form_structure1(form1);
+  form_structure1.DetermineHeuristicTypes();
   std::vector<const FormStructure*> forms;
   forms.push_back(&form_structure1);
   const CreditCard* imported_credit_card;
@@ -1600,6 +1624,7 @@
   form2.fields.push_back(field);
 
   FormStructure form_structure2(form2);
+  form_structure2.DetermineHeuristicTypes();
   forms.clear();
   forms.push_back(&form_structure2);
   EXPECT_TRUE(personal_data_->ImportFormData(forms, &imported_credit_card));