summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/address_field_unittest.cc
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-14 19:21:18 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-14 19:21:18 +0000
commitee0e2d945e34a794f5268137f71fc9e7d1cdc82b (patch)
treeceac50e53dc7d55b85e9ca2d0ab359fa9a236deb /chrome/browser/autofill/address_field_unittest.cc
parent1b2b9e175adf3b51215ca88f75ea66605f74ef33 (diff)
downloadchromium_src-ee0e2d945e34a794f5268137f71fc9e7d1cdc82b.zip
chromium_src-ee0e2d945e34a794f5268137f71fc9e7d1cdc82b.tar.gz
chromium_src-ee0e2d945e34a794f5268137f71fc9e7d1cdc82b.tar.bz2
Form AutoFill Phone number should be displayed as xxx-xxx-xxxx
Modifies the AutoFill label inferencing logic to skip over <img> tags when deriving labels. It is common to use small images as spacers between elements. Also, extends the phone number heuristics to recognize numbers that are split into three fields of the form [xxx]-[yyy]-[zzzz] where xxx is the area code, yyy is the phone number prefix and zzz is the phone number suffix. Note: This change has a dependency on WebKit change: https://bugs.webkit.org/show_bug.cgi?id=38825. Will need to wait for that to land before committing this change. BUG=38218 TEST=FormManagerTest.LabelsInferredWithImageTags:FormStructureTest.ThreePartPhoneNumber:PhoneFieldTest.ThreePartPhoneNumber Review URL: http://codereview.chromium.org/1979008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47297 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/address_field_unittest.cc')
-rw-r--r--chrome/browser/autofill/address_field_unittest.cc57
1 files changed, 38 insertions, 19 deletions
diff --git a/chrome/browser/autofill/address_field_unittest.cc b/chrome/browser/autofill/address_field_unittest.cc
index 8b82dda..7e3c2dd 100644
--- a/chrome/browser/autofill/address_field_unittest.cc
+++ b/chrome/browser/autofill/address_field_unittest.cc
@@ -44,7 +44,8 @@ TEST_F(AddressFieldTest, ParseOneLineAddress) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address"),
ASCIIToUTF16("address"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -63,7 +64,8 @@ TEST_F(AddressFieldTest, ParseOneLineAddressEcml) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address"),
kEcmlShipToAddress1,
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -82,13 +84,15 @@ TEST_F(AddressFieldTest, ParseTwoLineAddress) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address"),
ASCIIToUTF16("address"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr1")));
list_.push_back(
new AutoFillField(webkit_glue::FormField(string16(),
string16(),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr2")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -110,19 +114,22 @@ TEST_F(AddressFieldTest, ParseThreeLineAddress) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address Line1"),
ASCIIToUTF16("Address"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr1")));
list_.push_back(
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address Line2"),
ASCIIToUTF16("Address"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr2")));
list_.push_back(
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address Line3"),
ASCIIToUTF16("Address"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr3")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -146,13 +153,15 @@ TEST_F(AddressFieldTest, ParseTwoLineAddressEcml) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address"),
kEcmlShipToAddress1,
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr1")));
list_.push_back(
new AutoFillField(webkit_glue::FormField(string16(),
kEcmlShipToAddress2,
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr2")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -174,7 +183,8 @@ TEST_F(AddressFieldTest, ParseCity) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("City"),
ASCIIToUTF16("city"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("city1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -193,7 +203,8 @@ TEST_F(AddressFieldTest, ParseCityEcml) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("City"),
kEcmlShipToCity,
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("city1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -212,7 +223,8 @@ TEST_F(AddressFieldTest, ParseState) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("State"),
ASCIIToUTF16("state"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("state1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -231,7 +243,8 @@ TEST_F(AddressFieldTest, ParseStateEcml) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("State"),
kEcmlShipToStateProv,
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("state1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -250,7 +263,8 @@ TEST_F(AddressFieldTest, ParseZip) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Zip"),
ASCIIToUTF16("zip"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("zip1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -269,7 +283,8 @@ TEST_F(AddressFieldTest, ParseZipEcml) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Zip"),
kEcmlShipToPostalCode,
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("zip1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -288,7 +303,8 @@ TEST_F(AddressFieldTest, ParseCountry) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Country"),
ASCIIToUTF16("country"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("country1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -307,7 +323,8 @@ TEST_F(AddressFieldTest, ParseCountryEcml) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Country"),
kEcmlShipToCountry,
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("country1")));
list_.push_back(NULL);
iter_ = list_.begin();
@@ -326,13 +343,15 @@ TEST_F(AddressFieldTest, ParseTwoLineAddressMissingLabel) {
new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address"),
ASCIIToUTF16("address"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr1")));
list_.push_back(
new AutoFillField(webkit_glue::FormField(string16(),
ASCIIToUTF16("bogus"),
string16(),
- ASCIIToUTF16("text")),
+ ASCIIToUTF16("text"),
+ 0),
ASCIIToUTF16("addr2")));
list_.push_back(NULL);
iter_ = list_.begin();