diff options
Diffstat (limited to 'chrome/browser/webdata')
-rw-r--r-- | chrome/browser/webdata/web_data_service_unittest.cc | 7 | ||||
-rw-r--r-- | chrome/browser/webdata/web_database_unittest.cc | 49 |
2 files changed, 39 insertions, 17 deletions
diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc index c19fee8..34092b8 100644 --- a/chrome/browser/webdata/web_data_service_unittest.cc +++ b/chrome/browser/webdata/web_data_service_unittest.cc @@ -24,6 +24,7 @@ #include "chrome/common/notification_type.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" #include "webkit/glue/form_field.h" using base::Time; @@ -105,7 +106,11 @@ class WebDataServiceTest : public testing::Test { const string16& value, std::vector<webkit_glue::FormField>* form_fields) { form_fields->push_back( - webkit_glue::FormField(string16(), name, string16(), value)); + webkit_glue::FormField(string16(), + name, + value, + string16(), + WebKit::WebInputElement::Text)); } MessageLoopForUI message_loop_; 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()); |