diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 17:22:43 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-11 17:22:43 +0000 |
commit | feb7cfba67c122cd39ae15e3bac5a2be5a2014e5 (patch) | |
tree | 9d050d10fa86b8251fe42424b565c833f2443708 /chrome/browser/webdata/web_database_unittest.cc | |
parent | a01805c89445c44c954668c8441fa5d2f416fff5 (diff) | |
download | chromium_src-feb7cfba67c122cd39ae15e3bac5a2be5a2014e5.zip chromium_src-feb7cfba67c122cd39ae15e3bac5a2be5a2014e5.tar.gz chromium_src-feb7cfba67c122cd39ae15e3bac5a2be5a2014e5.tar.bz2 |
This CL ensures we don't store empty values in the autofill form DB.
Also it applies a clean-up to remove any empty values previously stored in the DB.
BUG=6111
TEST=Submit a form and leave some fields empty. Come back to that form, click on a field that was empty. No autofill popup should show up (or if one show up, it should not contains empty values).
Review URL: http://codereview.chromium.org/21217
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9570 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata/web_database_unittest.cc')
-rw-r--r-- | chrome/browser/webdata/web_database_unittest.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index 8842e40..d56edbd 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -464,6 +464,31 @@ TEST_F(WebDatabaseTest, Autofill) { EXPECT_TRUE(db.GetFormValuesForElementName(L"Name", L"", &v, 6)); EXPECT_EQ(0U, v.size()); + + // Now add some values with empty strings. + const std::wstring kValue = L" toto "; + EXPECT_TRUE(db.AddAutofillFormElement(AutofillForm::Element(L"blank", L""))); + EXPECT_TRUE(db.AddAutofillFormElement(AutofillForm::Element(L"blank", + L" "))); + EXPECT_TRUE(db.AddAutofillFormElement(AutofillForm::Element(L"blank", + L" "))); + EXPECT_TRUE(db.AddAutofillFormElement(AutofillForm::Element(L"blank", + kValue))); + + // They should be stored normally as the DB layer does not check for empty + // values. + v.clear(); + EXPECT_TRUE(db.GetFormValuesForElementName(L"blank", L"", &v, 10)); + EXPECT_EQ(4U, v.size()); + + // Now we'll check that ClearAutofillEmptyValueElements() works as expected. + db.ClearAutofillEmptyValueElements(); + + v.clear(); + EXPECT_TRUE(db.GetFormValuesForElementName(L"blank", L"", &v, 10)); + ASSERT_EQ(1U, v.size()); + + EXPECT_EQ(kValue, v[0]); } static bool AddTimestampedLogin(WebDatabase* db, std::string url, |