diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 03:06:54 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-10 03:06:54 +0000 |
commit | fb856c7c3b8ed71b0d15cbe08ef4ca35eb79abd3 (patch) | |
tree | 37bdfc77e78080fe596f556a5761f6d16188eb5d /chrome/browser/webdata/web_database_unittest.cc | |
parent | 3242bbfed6822cc22d8154a80c34c3127e692032 (diff) | |
download | chromium_src-fb856c7c3b8ed71b0d15cbe08ef4ca35eb79abd3.zip chromium_src-fb856c7c3b8ed71b0d15cbe08ef4ca35eb79abd3.tar.gz chromium_src-fb856c7c3b8ed71b0d15cbe08ef4ca35eb79abd3.tar.bz2 |
Move conditions of FormFields creation to FormFieldHistoryManager; AutoFill does not have the same conditions. This required manipulating the FormField data structure to add necessary field data.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/602008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38570 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 | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc index 1b950c8..8064ef4 100644 --- a/chrome/browser/webdata/web_database_unittest.cc +++ b/chrome/browser/webdata/web_database_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/common/chrome_paths.h" #include "third_party/skia/include/core/SkBitmap.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" #include "webkit/glue/form_field.h" #include "webkit/glue/password_form.h" @@ -427,32 +428,36 @@ TEST_F(WebDatabaseTest, Autofill) { EXPECT_TRUE(db.AddFormFieldValue( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Superman"), string16(), - ASCIIToUTF16("Superman")), + WebKit::WebInputElement::Text), &changes)); std::vector<string16> v; for (int i = 0; i < 5; i++) { EXPECT_TRUE(db.AddFormFieldValue( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Clark Kent"), string16(), - ASCIIToUTF16("Clark Kent")), + WebKit::WebInputElement::Text), &changes)); } for (int i = 0; i < 3; i++) { EXPECT_TRUE(db.AddFormFieldValue( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Clark Sutter"), string16(), - ASCIIToUTF16("Clark Sutter")), + WebKit::WebInputElement::Text), &changes)); } for (int i = 0; i < 2; i++) { EXPECT_TRUE(db.AddFormFieldValue( FormField(string16(), ASCIIToUTF16("Favorite Color"), + ASCIIToUTF16("Green"), string16(), - ASCIIToUTF16("Green")), + WebKit::WebInputElement::Text), &changes)); } @@ -464,8 +469,9 @@ TEST_F(WebDatabaseTest, Autofill) { EXPECT_TRUE(db.GetIDAndCountOfFormElement( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Clark Kent"), string16(), - ASCIIToUTF16("Clark Kent")), + WebKit::WebInputElement::Text), &pair_id, &count)); EXPECT_EQ(5, count); EXPECT_NE(0, pair_id); @@ -475,16 +481,18 @@ TEST_F(WebDatabaseTest, Autofill) { EXPECT_TRUE(db.GetIDAndCountOfFormElement( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("clark kent"), string16(), - ASCIIToUTF16("clark kent")), + WebKit::WebInputElement::Text), &pair_id, &count)); EXPECT_EQ(0, count); EXPECT_TRUE(db.GetIDAndCountOfFormElement( FormField(string16(), ASCIIToUTF16("Favorite Color"), + ASCIIToUTF16("Green"), string16(), - ASCIIToUTF16("Green")), + WebKit::WebInputElement::Text), &pair_id, &count)); EXPECT_EQ(2, count); @@ -547,8 +555,9 @@ TEST_F(WebDatabaseTest, Autofill) { EXPECT_TRUE(db.GetIDAndCountOfFormElement( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Clark Kent"), string16(), - ASCIIToUTF16("Clark Kent")), + WebKit::WebInputElement::Text), &pair_id, &count)); EXPECT_EQ(0, count); @@ -561,22 +570,26 @@ TEST_F(WebDatabaseTest, Autofill) { EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(), ASCIIToUTF16("blank"), string16(), - string16()), + string16(), + WebKit::WebInputElement::Text), &changes)); EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(), ASCIIToUTF16("blank"), + ASCIIToUTF16(" "), string16(), - ASCIIToUTF16(" ")), + WebKit::WebInputElement::Text), &changes)); EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(), ASCIIToUTF16("blank"), + ASCIIToUTF16(" "), string16(), - ASCIIToUTF16(" ")), + WebKit::WebInputElement::Text), &changes)); EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(), ASCIIToUTF16("blank"), + kValue, string16(), - kValue), + WebKit::WebInputElement::Text), &changes)); // They should be stored normally as the DB layer does not check for empty @@ -609,15 +622,17 @@ TEST_F(WebDatabaseTest, Autofill_RemoveBetweenChanges) { EXPECT_TRUE(db.AddFormFieldValueTime( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Superman"), string16(), - ASCIIToUTF16("Superman")), + WebKit::WebInputElement::Text), &changes, t1)); EXPECT_TRUE(db.AddFormFieldValueTime( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Superman"), string16(), - ASCIIToUTF16("Superman")), + WebKit::WebInputElement::Text), &changes, t2)); @@ -650,8 +665,9 @@ TEST_F(WebDatabaseTest, Autofill_AddChanges) { EXPECT_TRUE(db.AddFormFieldValueTime( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Superman"), string16(), - ASCIIToUTF16("Superman")), + WebKit::WebInputElement::Text), &changes, t1)); ASSERT_EQ(1U, changes.size()); @@ -664,8 +680,9 @@ TEST_F(WebDatabaseTest, Autofill_AddChanges) { EXPECT_TRUE(db.AddFormFieldValueTime( FormField(string16(), ASCIIToUTF16("Name"), + ASCIIToUTF16("Superman"), string16(), - ASCIIToUTF16("Superman")), + WebKit::WebInputElement::Text), &changes, t2)); ASSERT_EQ(1U, changes.size()); |