Index: components/autofill/core/browser/autofill_field_unittest.cc |
diff --git a/components/autofill/core/browser/autofill_field_unittest.cc b/components/autofill/core/browser/autofill_field_unittest.cc |
index 10b1d96ce6a146dbce193be0fdc2343e90afba12..b339e62894393ccbde7df3a58746b2562f9ec682 100644 |
--- a/components/autofill/core/browser/autofill_field_unittest.cc |
+++ b/components/autofill/core/browser/autofill_field_unittest.cc |
@@ -273,7 +273,7 @@ TEST(AutofillFieldTest, FillPhoneNumber) { |
field, ASCIIToUTF16("5551234"), "en-US", "en-US", &field); |
EXPECT_EQ(ASCIIToUTF16("555"), field.value); |
- // Now reset the type, and set a max-length instead. |
+ // Now reset the type, and set a max-length the size of a suffix. |
field.SetHtmlType(HTML_TYPE_UNSPECIFIED, HtmlFieldMode()); |
field.set_heuristic_type(PHONE_HOME_NUMBER); |
field.max_length = 4; |
@@ -282,6 +282,17 @@ TEST(AutofillFieldTest, FillPhoneNumber) { |
AutofillField::FillFormField( |
field, ASCIIToUTF16("5551234"), "en-US", "en-US", &field); |
EXPECT_EQ(ASCIIToUTF16("1234"), field.value); |
+ |
+ // Now reset the type, and set a max-length of 10. |
+ field.SetHtmlType(HTML_TYPE_UNSPECIFIED, HtmlFieldMode()); |
Mathieu
2016/01/26 14:43:02
HTML_TYPE_TEL?
https://code.google.com/p/chromiu
sebsg
2016/01/26 23:56:26
Done.
|
+ field.set_heuristic_type(PHONE_HOME_WHOLE_NUMBER); |
+ field.max_length = 10; |
+ |
+ // Fill with a whole phone number including country code. The number should |
+ // fill without the country code. |
+ AutofillField::FillFormField(field, ASCIIToUTF16("15141254578"), "en-US", |
+ "en-US", &field); |
+ EXPECT_EQ(ASCIIToUTF16("5141254578"), field.value); |
} |
TEST(AutofillFieldTest, FillSelectControlByValue) { |