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

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

Issue 9225042: Fix Autofill hang when interacting with large forms (i.e. forms containing many fields). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test failure -- don't count hidden fields Created 8 years, 11 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 | « no previous file | chrome/renderer/autofill/form_autofill_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/form_autofill_browsertest.cc
diff --git a/chrome/renderer/autofill/form_autofill_browsertest.cc b/chrome/renderer/autofill/form_autofill_browsertest.cc
index ef2690d6b3fd842808f1bb2c204355e1cf68db45..123df9641a1a3545b631d5d2877eae7aa9c07709 100644
--- a/chrome/renderer/autofill/form_autofill_browsertest.cc
+++ b/chrome/renderer/autofill/form_autofill_browsertest.cc
@@ -496,6 +496,36 @@ TEST_F(FormAutofillTest, WebFormElementToFormData) {
EXPECT_FORM_FIELD_EQUALS(expected, fields[2]);
}
+// We should not be able to serialize a form with too many fillable fields.
+TEST_F(FormAutofillTest, WebFormElementToFormDataTooManyFields) {
+ std::string html =
+ "<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">";
+ for (size_t i = 0; i < (autofill::kMaxParseableFields + 1); ++i) {
+ html += "<INPUT type=\"text\"/>";
+ }
+ html += "</FORM>";
+ LoadHTML(html.c_str());
+
+ WebFrame* frame = GetMainFrame();
+ ASSERT_NE(static_cast<WebFrame*>(NULL), frame);
+
+ WebVector<WebFormElement> forms;
+ frame->document().forms(forms);
+ ASSERT_EQ(1U, forms.size());
+
+ WebElement element = frame->document().getElementById("firstname");
+ WebInputElement input_element = element.to<WebInputElement>();
+
+ FormData form;
+ FormField field;
+ EXPECT_FALSE(WebFormElementToFormData(forms[0],
+ input_element,
+ autofill::REQUIRE_NONE,
+ autofill::EXTRACT_VALUE,
+ &form,
+ &field));
+}
+
TEST_F(FormAutofillTest, ExtractForms) {
ExpectJohnSmithLabels(
"<FORM name=\"TestForm\" action=\"http://cnn.com\" method=\"post\">"
« no previous file with comments | « no previous file | chrome/renderer/autofill/form_autofill_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698