Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4656)

Unified Diff: chrome/renderer/autofill/autofill_browsertest.cc

Issue 7576001: Refactor webkit_glue::FormField to remove hacky methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright header Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/renderer/autofill/form_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/autofill_browsertest.cc
diff --git a/chrome/renderer/autofill/autofill_browsertest.cc b/chrome/renderer/autofill/autofill_browsertest.cc
index 671698c08c5fe4194b087d066bbd81be24b1612a..ba91d659dfc8f59571b332f3669ccb98d2f265ef 100644
--- a/chrome/renderer/autofill/autofill_browsertest.cc
+++ b/chrome/renderer/autofill/autofill_browsertest.cc
@@ -46,27 +46,26 @@ TEST_F(RenderViewTest, SendForms) {
const std::vector<FormData>& forms = params.a;
ASSERT_EQ(1UL, forms.size());
ASSERT_EQ(3UL, forms[0].fields.size());
- EXPECT_TRUE(forms[0].fields[0].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("firstname"),
- string16(),
- ASCIIToUTF16("text"),
- WebInputElement::defaultMaxLength(),
- false))) << forms[0].fields[0];
- EXPECT_TRUE(forms[0].fields[1].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("middlename"),
- string16(),
- ASCIIToUTF16("text"),
- WebInputElement::defaultMaxLength(),
- false))) << forms[0].fields[1];
- EXPECT_TRUE(forms[0].fields[2].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("state"),
- ASCIIToUTF16("?"),
- ASCIIToUTF16("select-one"),
- 0,
- false))) << forms[0].fields[2];
+
+ FormField expected;
+
+ expected.name = ASCIIToUTF16("firstname");
+ expected.value = string16();
+ expected.form_control_type = ASCIIToUTF16("text");
+ expected.max_length = WebInputElement::defaultMaxLength();
+ EXPECT_FORM_FIELD_EQUALS(expected, forms[0].fields[0]);
+
+ expected.name = ASCIIToUTF16("middlename");
+ expected.value = string16();
+ expected.form_control_type = ASCIIToUTF16("text");
+ expected.max_length = WebInputElement::defaultMaxLength();
+ EXPECT_FORM_FIELD_EQUALS(expected, forms[0].fields[1]);
+
+ expected.name = ASCIIToUTF16("state");
+ expected.value = ASCIIToUTF16("?");
+ expected.form_control_type = ASCIIToUTF16("select-one");
+ expected.max_length = 0;
+ EXPECT_FORM_FIELD_EQUALS(expected, forms[0].fields[2]);
// Verify that |didAcceptAutofillSuggestion()| sends the expected number of
// fields.
@@ -93,27 +92,24 @@ TEST_F(RenderViewTest, SendForms) {
AutofillHostMsg_FillAutofillFormData::Read(message2, &params2);
const FormData& form2 = params2.b;
ASSERT_EQ(3UL, form2.fields.size());
- EXPECT_TRUE(form2.fields[0].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("firstname"),
- string16(),
- ASCIIToUTF16("text"),
- WebInputElement::defaultMaxLength(),
- false))) << form2.fields[0];
- EXPECT_TRUE(form2.fields[1].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("middlename"),
- string16(),
- ASCIIToUTF16("text"),
- WebInputElement::defaultMaxLength(),
- false))) << form2.fields[1];
- EXPECT_TRUE(form2.fields[2].StrictlyEqualsHack(
- FormField(string16(),
- ASCIIToUTF16("state"),
- ASCIIToUTF16("?"),
- ASCIIToUTF16("select-one"),
- 0,
- false))) << form2.fields[2];
+
+ expected.name = ASCIIToUTF16("firstname");
+ expected.value = string16();
+ expected.form_control_type = ASCIIToUTF16("text");
+ expected.max_length = WebInputElement::defaultMaxLength();
+ EXPECT_FORM_FIELD_EQUALS(expected, form2.fields[0]);
+
+ expected.name = ASCIIToUTF16("middlename");
+ expected.value = string16();
+ expected.form_control_type = ASCIIToUTF16("text");
+ expected.max_length = WebInputElement::defaultMaxLength();
+ EXPECT_FORM_FIELD_EQUALS(expected, form2.fields[1]);
+
+ expected.name = ASCIIToUTF16("state");
+ expected.value = ASCIIToUTF16("?");
+ expected.form_control_type = ASCIIToUTF16("select-one");
+ expected.max_length = 0;
+ EXPECT_FORM_FIELD_EQUALS(expected, form2.fields[2]);
}
TEST_F(RenderViewTest, FillFormElement) {
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/renderer/autofill/form_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698