diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-13 02:16:53 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-13 02:16:53 +0000 |
commit | 44e621d061718eb36b814cda5e9fc466abb850f6 (patch) | |
tree | 4e928909169e609777576a171939856e00d8cbda /chrome/browser/autofill/name_field_unittest.cc | |
parent | edb2cd3f0f88b06c6a73380110692bf201ac8472 (diff) | |
download | chromium_src-44e621d061718eb36b814cda5e9fc466abb850f6.zip chromium_src-44e621d061718eb36b814cda5e9fc466abb850f6.tar.gz chromium_src-44e621d061718eb36b814cda5e9fc466abb850f6.tar.bz2 |
AutoFill heuristics extended to include multiple separator characters.
AutoFill heuristics were successfully matching labels such as "First Name" but not "First Name". Extra whitespace and other separator characters are now allowed. There are examples of this in the sample3.html test file.
BUG=38257
TEST=Manual testing against sample3.html, sample6.html, and sample8.html.
NameFieldTest.FirstLastMiddleWithSpaces
Review URL: http://codereview.chromium.org/1993013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47111 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/name_field_unittest.cc')
-rw-r--r-- | chrome/browser/autofill/name_field_unittest.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/autofill/name_field_unittest.cc b/chrome/browser/autofill/name_field_unittest.cc index f8a3d1c..438bef3 100644 --- a/chrome/browser/autofill/name_field_unittest.cc +++ b/chrome/browser/autofill/name_field_unittest.cc @@ -147,4 +147,39 @@ TEST_F(NameFieldTest, FirstLast2) { EXPECT_EQ(NAME_LAST, field_type_map_[ASCIIToUTF16("name2")]); } +TEST_F(NameFieldTest, FirstLastMiddleWithSpaces) { + list_.push_back( + new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("First Name"), + ASCIIToUTF16("first name"), + string16(), + ASCIIToUTF16("text")), + ASCIIToUTF16("name1"))); + list_.push_back( + new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Middle Name"), + ASCIIToUTF16("middle name"), + string16(), + ASCIIToUTF16("text")), + ASCIIToUTF16("name2"))); + list_.push_back( + new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Last Name"), + ASCIIToUTF16("last name"), + string16(), + ASCIIToUTF16("text")), + ASCIIToUTF16("name3"))); + list_.push_back(NULL); + iter_ = list_.begin(); + field_.reset(NameField::Parse(&iter_, false)); + ASSERT_NE(static_cast<NameField*>(NULL), field_.get()); + ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_)); + ASSERT_TRUE( + field_type_map_.find(ASCIIToUTF16("name1")) != field_type_map_.end()); + EXPECT_EQ(NAME_FIRST, field_type_map_[ASCIIToUTF16("name1")]); + ASSERT_TRUE( + field_type_map_.find(ASCIIToUTF16("name2")) != field_type_map_.end()); + EXPECT_EQ(NAME_MIDDLE, field_type_map_[ASCIIToUTF16("name2")]); + ASSERT_TRUE( + field_type_map_.find(ASCIIToUTF16("name3")) != field_type_map_.end()); + EXPECT_EQ(NAME_LAST, field_type_map_[ASCIIToUTF16("name3")]); +} + } // namespace |