Index: chrome/browser/autofill/autofill_browsertest.cc |
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc |
index e5650568c62402bd3947e7a3add2ea22ff885a43..0249d06c22965e1f78f201d0267dc5d62f544701 100644 |
--- a/chrome/browser/autofill/autofill_browsertest.cc |
+++ b/chrome/browser/autofill/autofill_browsertest.cc |
@@ -659,6 +659,78 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, AppendCountryCodeForAggregatedPhones) { |
PHONE_HOME_WHOLE_NUMBER)); |
} |
+// Test that Autofill uses '+' sign for international numbers. |
+// This applies to the following cases: |
+// The phone number has a leading '+'. |
+// The phone number does not have a leading '+'. |
+// The phone number has a leading international direct dialing (IDD) code. |
+// This does not apply to US numbers. For US numbers, '+' is removed. |
+IN_PROC_BROWSER_TEST_F(AutofillTest, UsePlusSignForInternaltionalNumber) { |
+ ASSERT_TRUE(test_server()->Start()); |
+ std::vector<FormMap> profiles; |
+ |
+ FormMap data1; |
+ data1["NAME_FIRST"] = "Bonnie"; |
+ data1["NAME_LAST"] = "Smith"; |
+ data1["ADDRESS_HOME_LINE1"] = "6723 Roadway Rd"; |
+ data1["ADDRESS_HOME_CITY"] = "Reading"; |
+ data1["ADDRESS_HOME_STATE"] = "Berkshire"; |
+ data1["ADDRESS_HOME_ZIP"] = "RG12 3BR"; |
+ data1["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; |
+ data1["PHONE_HOME_WHOLE_NUMBER"] = "+44 7624-123456"; |
+ profiles.push_back(data1); |
+ |
+ FormMap data2; |
+ data2["NAME_FIRST"] = "John"; |
+ data2["NAME_LAST"] = "Doe"; |
+ data2["ADDRESS_HOME_LINE1"] = "987 H St"; |
+ data2["ADDRESS_HOME_CITY"] = "Reading"; |
+ data2["ADDRESS_HOME_STATE"] = "BerkShire"; |
+ data2["ADDRESS_HOME_ZIP"] = "RG12 3BR"; |
+ data2["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; |
+ data2["PHONE_HOME_WHOLE_NUMBER"] = "44 7624 123456"; |
+ profiles.push_back(data2); |
+ |
+ FormMap data3; |
+ data3["NAME_FIRST"] = "Jane"; |
+ data3["NAME_LAST"] = "Doe"; |
+ data3["ADDRESS_HOME_LINE1"] = "1523 Garcia St"; |
+ data3["ADDRESS_HOME_CITY"] = "Reading"; |
+ data3["ADDRESS_HOME_STATE"] = "BerkShire"; |
+ data3["ADDRESS_HOME_ZIP"] = "RG12 3BR"; |
+ data3["ADDRESS_HOME_COUNTRY"] = "United Kingdom"; |
+ data3["PHONE_HOME_WHOLE_NUMBER"] = "0044 7624 123456"; |
+ profiles.push_back(data3); |
+ |
+ FormMap data4; |
+ data4["NAME_FIRST"] = "Bob"; |
+ data4["NAME_LAST"] = "Smith"; |
+ data4["ADDRESS_HOME_LINE1"] = "123 Cherry Ave"; |
+ data4["ADDRESS_HOME_CITY"] = "Mountain View"; |
+ data4["ADDRESS_HOME_STATE"] = "CA"; |
+ data4["ADDRESS_HOME_ZIP"] = "94043"; |
+ data4["ADDRESS_HOME_COUNTRY"] = "United States"; |
+ data4["PHONE_HOME_WHOLE_NUMBER"] = "+1 (408) 871-4567"; |
+ profiles.push_back(data4); |
+ |
+ for (size_t i = 0; i < profiles.size(); ++i) |
+ FillFormAndSubmit("autofill_test_form.html", profiles[i]); |
+ |
+ ASSERT_EQ(4u, personal_data_manager()->GetProfiles().size()); |
+ ASSERT_EQ(ASCIIToUTF16("+447624123456"), |
+ personal_data_manager()->GetProfiles()[0]->GetInfo( |
+ AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); |
+ ASSERT_EQ(ASCIIToUTF16("+447624123456"), |
+ personal_data_manager()->GetProfiles()[1]->GetInfo( |
+ AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); |
+ ASSERT_EQ(ASCIIToUTF16("+447624123456"), |
+ personal_data_manager()->GetProfiles()[2]->GetInfo( |
+ AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); |
+ ASSERT_EQ(ASCIIToUTF16("14088714567"), |
+ personal_data_manager()->GetProfiles()[3]->GetInfo( |
+ AutofillType(PHONE_HOME_WHOLE_NUMBER), "")); |
+} |
+ |
// Test CC info not offered to be saved when autocomplete=off for CC field. |
// If the credit card number field has autocomplete turned off, then the credit |
// card infobar should not offer to save the credit card info. The credit card |