diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-14 19:21:18 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-14 19:21:18 +0000 |
commit | ee0e2d945e34a794f5268137f71fc9e7d1cdc82b (patch) | |
tree | ceac50e53dc7d55b85e9ca2d0ab359fa9a236deb /chrome/browser/webdata | |
parent | 1b2b9e175adf3b51215ca88f75ea66605f74ef33 (diff) | |
download | chromium_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/webdata')
-rw-r--r-- | chrome/browser/webdata/web_data_service_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/webdata/web_database_unittest.cc | 78 |
2 files changed, 54 insertions, 27 deletions
diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index c11d4b7..0dc7df3 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -133,7 +133,8 @@ class WebDataServiceAutofillTest : public WebDataServiceTest { webkit_glue::FormField(string16(), name, value, - string16())); + string16(), + 0)); } string16 name1_; diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index e1b58c5..6e7e523 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -479,7 +479,8 @@ TEST_F(WebDatabaseTest, Autofill) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes)); std::vector<string16> v; for (int i = 0; i < 5; i++) { @@ -487,7 +488,8 @@ TEST_F(WebDatabaseTest, Autofill) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Kent"), - string16()), + string16(), + 0), &changes)); } for (int i = 0; i < 3; i++) { @@ -495,7 +497,8 @@ TEST_F(WebDatabaseTest, Autofill) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Sutter"), - string16()), + string16(), + 0), &changes)); } for (int i = 0; i < 2; i++) { @@ -503,7 +506,8 @@ TEST_F(WebDatabaseTest, Autofill) { FormField(string16(), ASCIIToUTF16("Favorite Color"), ASCIIToUTF16("Green"), - string16()), + string16(), + 0), &changes)); } @@ -516,7 +520,8 @@ TEST_F(WebDatabaseTest, Autofill) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Kent"), - string16()), + string16(), + 0), &pair_id, &count)); EXPECT_EQ(5, count); EXPECT_NE(0, pair_id); @@ -527,7 +532,8 @@ TEST_F(WebDatabaseTest, Autofill) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("clark kent"), - string16()), + string16(), + 0), &pair_id, &count)); EXPECT_EQ(0, count); @@ -535,7 +541,8 @@ TEST_F(WebDatabaseTest, Autofill) { FormField(string16(), ASCIIToUTF16("Favorite Color"), ASCIIToUTF16("Green"), - string16()), + string16(), + 0), &pair_id, &count)); EXPECT_EQ(2, count); @@ -599,7 +606,8 @@ TEST_F(WebDatabaseTest, Autofill) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Kent"), - string16()), + string16(), + 0), &pair_id, &count)); EXPECT_EQ(0, count); @@ -612,22 +620,26 @@ TEST_F(WebDatabaseTest, Autofill) { EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(), ASCIIToUTF16("blank"), string16(), - string16()), + string16(), + 0), &changes)); EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(), ASCIIToUTF16("blank"), ASCIIToUTF16(" "), - string16()), + string16(), + 0), &changes)); EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(), ASCIIToUTF16("blank"), ASCIIToUTF16(" "), - string16()), + string16(), + 0), &changes)); EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(), ASCIIToUTF16("blank"), kValue, - string16()), + string16(), + 0), &changes)); // They should be stored normally as the DB layer does not check for empty @@ -661,14 +673,16 @@ TEST_F(WebDatabaseTest, Autofill_RemoveBetweenChanges) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes, t1)); EXPECT_TRUE(db.AddFormFieldValueTime( FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes, t2)); @@ -702,7 +716,8 @@ TEST_F(WebDatabaseTest, Autofill_AddChanges) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes, t1)); ASSERT_EQ(1U, changes.size()); @@ -716,7 +731,8 @@ TEST_F(WebDatabaseTest, Autofill_AddChanges) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes, t2)); ASSERT_EQ(1U, changes.size()); @@ -738,7 +754,8 @@ TEST_F(WebDatabaseTest, Autofill_UpdateOneWithOneTimestamp) { FormField field(string16(), ASCIIToUTF16("foo"), ASCIIToUTF16("bar"), - string16()); + string16(), + 0); int64 pair_id; int count; ASSERT_TRUE(db.GetIDAndCountOfFormElement(field, &pair_id, &count)); @@ -763,7 +780,8 @@ TEST_F(WebDatabaseTest, Autofill_UpdateOneWithTwoTimestamps) { FormField field(string16(), ASCIIToUTF16("foo"), ASCIIToUTF16("bar"), - string16()); + string16(), + 0); int64 pair_id; int count; ASSERT_TRUE(db.GetIDAndCountOfFormElement(field, &pair_id, &count)); @@ -808,7 +826,8 @@ TEST_F(WebDatabaseTest, Autofill_UpdateTwo) { FormField field0(string16(), ASCIIToUTF16("foo"), ASCIIToUTF16("bar0"), - string16()); + string16(), + 0); int64 pair_id; int count; ASSERT_TRUE(db.GetIDAndCountOfFormElement(field0, &pair_id, &count)); @@ -818,7 +837,8 @@ TEST_F(WebDatabaseTest, Autofill_UpdateTwo) { FormField field1(string16(), ASCIIToUTF16("foo"), ASCIIToUTF16("bar1"), - string16()); + string16(), + 0); ASSERT_TRUE(db.GetIDAndCountOfFormElement(field1, &pair_id, &count)); EXPECT_LE(0, pair_id); EXPECT_EQ(2, count); @@ -834,7 +854,8 @@ TEST_F(WebDatabaseTest, Autofill_UpdateReplace) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes)); AutofillEntry entry(MakeAutofillEntry("Name", "Superman", 1, 2)); @@ -862,7 +883,8 @@ TEST_F(WebDatabaseTest, Autofill_UpdateDontReplace) { FormField(string16(), existing.key().name(), existing.key().value(), - string16()), + string16(), + 0), &changes, t)); AutofillEntry entry(MakeAutofillEntry("Name", "Clark Kent", 1, 2)); @@ -1231,7 +1253,8 @@ TEST_F(WebDatabaseTest, Autofill_GetAllAutofillEntries_OneResult) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes, Time::FromTimeT(start))); timestamps1.push_back(Time::FromTimeT(start)); @@ -1274,7 +1297,8 @@ TEST_F(WebDatabaseTest, Autofill_GetAllAutofillEntries_TwoDistinct) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes, Time::FromTimeT(start))); timestamps1.push_back(Time::FromTimeT(start)); @@ -1288,7 +1312,8 @@ TEST_F(WebDatabaseTest, Autofill_GetAllAutofillEntries_TwoDistinct) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Clark Kent"), - string16()), + string16(), + 0), &changes, Time::FromTimeT(start))); timestamps2.push_back(Time::FromTimeT(start)); @@ -1335,7 +1360,8 @@ TEST_F(WebDatabaseTest, Autofill_GetAllAutofillEntries_TwoSame) { FormField(string16(), ASCIIToUTF16("Name"), ASCIIToUTF16("Superman"), - string16()), + string16(), + 0), &changes, Time::FromTimeT(start))); timestamps.push_back(Time::FromTimeT(start)); |