summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-23 19:47:41 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-23 19:47:41 +0000
commit6780b3bd5805018c242cde0a9cff3f48d12e4649 (patch)
tree4d208f861eb7d181010c5b230aad39ae96807bb7 /chrome
parent91451171aa98b6e44238517f39fc58a86028d75d (diff)
downloadchromium_src-6780b3bd5805018c242cde0a9cff3f48d12e4649.zip
chromium_src-6780b3bd5805018c242cde0a9cff3f48d12e4649.tar.gz
chromium_src-6780b3bd5805018c242cde0a9cff3f48d12e4649.tar.bz2
Add a label member to the FormField class. This member will hold the value of the field's label once we parse this value from the DOM.
BUG=none TEST=none Review URL: http://codereview.chromium.org/418032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/webdata/web_database_unittest.cc44
-rw-r--r--chrome/common/render_messages.h6
2 files changed, 36 insertions, 14 deletions
diff --git a/chrome/browser/webdata/web_database_unittest.cc b/chrome/browser/webdata/web_database_unittest.cc
index 14f52e1..4a54d76 100644
--- a/chrome/browser/webdata/web_database_unittest.cc
+++ b/chrome/browser/webdata/web_database_unittest.cc
@@ -392,23 +392,29 @@ TEST_F(WebDatabaseTest, Autofill) {
// Simulate the submission of a handful of entries in a field called "Name",
// some more often than others.
EXPECT_TRUE(db.AddFormFieldValue(
- FormField(ASCIIToUTF16("Name"), string16(), ASCIIToUTF16("Superman"))));
+ FormField(string16(),
+ ASCIIToUTF16("Name"),
+ string16(),
+ ASCIIToUTF16("Superman"))));
std::vector<string16> v;
for (int i = 0; i < 5; i++) {
EXPECT_TRUE(db.AddFormFieldValue(
- FormField(ASCIIToUTF16("Name"),
+ FormField(string16(),
+ ASCIIToUTF16("Name"),
string16(),
ASCIIToUTF16("Clark Kent"))));
}
for (int i = 0; i < 3; i++) {
EXPECT_TRUE(db.AddFormFieldValue(
- FormField(ASCIIToUTF16("Name"),
+ FormField(string16(),
+ ASCIIToUTF16("Name"),
string16(),
ASCIIToUTF16("Clark Sutter"))));
}
for (int i = 0; i < 2; i++) {
EXPECT_TRUE(db.AddFormFieldValue(
- FormField(ASCIIToUTF16("Favorite Color"),
+ FormField(string16(),
+ ASCIIToUTF16("Favorite Color"),
string16(),
ASCIIToUTF16("Green"))));
}
@@ -419,7 +425,10 @@ TEST_F(WebDatabaseTest, Autofill) {
// We have added the name Clark Kent 5 times, so count should be 5 and pair_id
// should be somthing non-zero.
EXPECT_TRUE(db.GetIDAndCountOfFormElement(
- FormField(ASCIIToUTF16("Name"), string16(), ASCIIToUTF16("Clark Kent")),
+ FormField(string16(),
+ ASCIIToUTF16("Name"),
+ string16(),
+ ASCIIToUTF16("Clark Kent")),
&pair_id, &count));
EXPECT_EQ(5, count);
EXPECT_NE(0, pair_id);
@@ -427,12 +436,16 @@ TEST_F(WebDatabaseTest, Autofill) {
// Storing in the data base should be case sensitive, so there should be no
// database entry for clark kent lowercase.
EXPECT_TRUE(db.GetIDAndCountOfFormElement(
- FormField(ASCIIToUTF16("Name"), string16(), ASCIIToUTF16("clark kent")),
+ FormField(string16(),
+ ASCIIToUTF16("Name"),
+ string16(),
+ ASCIIToUTF16("clark kent")),
&pair_id, &count));
EXPECT_EQ(0, count);
EXPECT_TRUE(db.GetIDAndCountOfFormElement(
- FormField(ASCIIToUTF16("Favorite Color"),
+ FormField(string16(),
+ ASCIIToUTF16("Favorite Color"),
string16(),
ASCIIToUTF16("Green")),
&pair_id, &count));
@@ -475,7 +488,10 @@ TEST_F(WebDatabaseTest, Autofill) {
EXPECT_TRUE(db.RemoveFormElementsAddedBetween(t1, Time()));
EXPECT_TRUE(db.GetIDAndCountOfFormElement(
- FormField(ASCIIToUTF16("Name"), string16(), ASCIIToUTF16("Clark Kent")),
+ FormField(string16(),
+ ASCIIToUTF16("Name"),
+ string16(),
+ ASCIIToUTF16("Clark Kent")),
&pair_id, &count));
EXPECT_EQ(0, count);
@@ -485,16 +501,20 @@ TEST_F(WebDatabaseTest, Autofill) {
// Now add some values with empty strings.
const string16 kValue = ASCIIToUTF16(" toto ");
- EXPECT_TRUE(db.AddFormFieldValue(FormField(ASCIIToUTF16("blank"),
+ EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(),
+ ASCIIToUTF16("blank"),
string16(),
string16())));
- EXPECT_TRUE(db.AddFormFieldValue(FormField(ASCIIToUTF16("blank"),
+ EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(),
+ ASCIIToUTF16("blank"),
string16(),
ASCIIToUTF16(" "))));
- EXPECT_TRUE(db.AddFormFieldValue(FormField(ASCIIToUTF16("blank"),
+ EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(),
+ ASCIIToUTF16("blank"),
string16(),
ASCIIToUTF16(" "))));
- EXPECT_TRUE(db.AddFormFieldValue(FormField(ASCIIToUTF16("blank"),
+ EXPECT_TRUE(db.AddFormFieldValue(FormField(string16(),
+ ASCIIToUTF16("blank"),
string16(),
kValue)));
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 3403448..b6ccc67 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -827,6 +827,7 @@ struct ParamTraits<webkit_glue::FormFieldValues> {
WriteParam(m, p.elements.size());
std::vector<webkit_glue::FormField>::const_iterator itr;
for (itr = p.elements.begin(); itr != p.elements.end(); itr++) {
+ WriteParam(m, itr->label());
WriteParam(m, itr->name());
WriteParam(m, itr->html_input_type());
WriteParam(m, itr->value());
@@ -843,11 +844,12 @@ struct ParamTraits<webkit_glue::FormFieldValues> {
result = result && ReadParam(m, iter, &elements_size);
p->elements.resize(elements_size);
for (size_t i = 0; i < elements_size; i++) {
- string16 name, type, value;
+ string16 label, name, type, value;
+ result = result && ReadParam(m, iter, &label);
result = result && ReadParam(m, iter, &name);
result = result && ReadParam(m, iter, &type);
result = result && ReadParam(m, iter, &value);
- p->elements[i] = webkit_glue::FormField(name, type, value);
+ p->elements[i] = webkit_glue::FormField(label, name, type, value);
}
return result;
}