| 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\">"
|
|
|