summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata/web_database_unittest.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 00:09:32 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 00:09:32 +0000
commitb25e08604bb3a8082f199ccafca4d14aadbcf838 (patch)
tree7381af7d78e69594b0485d4e30efe5e86f2e6ef6 /chrome/browser/webdata/web_database_unittest.cc
parentb45b76e2e22e913450e79a0df076728726a6fc2e (diff)
downloadchromium_src-b25e08604bb3a8082f199ccafca4d14aadbcf838.zip
chromium_src-b25e08604bb3a8082f199ccafca4d14aadbcf838.tar.gz
chromium_src-b25e08604bb3a8082f199ccafca4d14aadbcf838.tar.bz2
Reland r38570. The underlying bug has been fix.
Move conditions of FormField creation to FormFieldHistoryManager; AutoFill does not have the same conditions. This required manipulating the FormField data structure to add necessary field data. TBR=tony BUG=none TEST=none Review URL: http://codereview.chromium.org/603015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38711 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata/web_database_unittest.cc')
-rw-r--r--chrome/browser/webdata/web_database_unittest.cc49
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 ec7cef5..a53214f 100644
--- a/chrome/browser/webdata/web_database_unittest.cc
+++ b/chrome/browser/webdata/web_database_unittest.cc
@@ -23,6 +23,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"
@@ -429,32 +430,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));
}
@@ -466,8 +471,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);
@@ -477,16 +483,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);
@@ -549,8 +557,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);
@@ -563,22 +572,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
@@ -611,15 +624,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));
@@ -652,8 +667,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());
@@ -666,8 +682,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());