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

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

Issue 1365203002: Make WebNode::to<Type>() (and toConst) casts contain type asserts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add BLINK_IMPLEMENTATION guard. Created 5 years, 3 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 | components/autofill/content/renderer/form_autofill_util.cc » ('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 76dba7bbba239d7e59bdb14762e704dc99a63a55..7dda2788f7e242d280f18ffdbfab4f0bb5567832 100644
--- a/chrome/renderer/autofill/form_autofill_browsertest.cc
+++ b/chrome/renderer/autofill/form_autofill_browsertest.cc
@@ -1019,7 +1019,7 @@ class FormAutofillTest : public ChromeRenderViewTest {
lastname.setAutofilled(true);
WebInputElement month = GetInputElementById("month");
month.setAutofilled(true);
- WebInputElement textarea = GetInputElementById("textarea");
+ WebFormControlElement textarea = GetFormControlElementById("textarea");
textarea.setAutofilled(true);
// Set the value of the disabled text input element.
@@ -2003,6 +2003,30 @@ TEST_F(FormAutofillTest, WebFormElementToFormData) {
EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[5]);
}
+TEST_F(FormAutofillTest, WebFormElementConsiderNonControlLabelableElements) {
+ LoadHTML("<form id=form>"
+ " <label for='progress'>Progress:</label>"
+ " <progress id='progress'></progress>"
+ " <label for='firstname'>First name:</label>"
+ " <input type='text' id='firstname' value='John'>"
+ "</form>");
+
+ WebFrame* frame = GetMainFrame();
+ ASSERT_NE(nullptr, frame);
+
+ WebFormElement web_form = frame->document().getElementById("form")
+ .to<WebFormElement>();
+ ASSERT_FALSE(web_form.isNull());
+
+ FormData form;
+ EXPECT_TRUE(WebFormElementToFormData(web_form, WebFormControlElement(),
+ EXTRACT_NONE, &form, nullptr));
+
+ const std::vector<FormFieldData>& fields = form.fields;
+ ASSERT_EQ(1U, fields.size());
+ EXPECT_EQ(ASCIIToUTF16("firstname"), fields[0].name);
+}
+
// We should not be able to serialize a form with too many fillable fields.
TEST_F(FormAutofillTest, WebFormElementToFormDataTooManyFields) {
std::string html =
« no previous file with comments | « no previous file | components/autofill/content/renderer/form_autofill_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698