Commit a76346e1 authored by ramankk@chromium.org's avatar ramankk@chromium.org

Remember the initial checked state of {radiobutton|checkbox}. If autofill flow...

Remember the initial checked state of {radiobutton|checkbox}. If autofill flow is not autocheckout, autofilling a form should just use remembered values for checkable elements.

BUG=244645

Review URL: https://chromiumcodereview.appspot.com/15659015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202965 0039d316-1c4b-4281-b951-d872f2087c98
parent eda4caed
...@@ -210,7 +210,7 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldAutofilled) { ...@@ -210,7 +210,7 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldAutofilled) {
// We should be able to extract a radio or a checkbox field that has been // We should be able to extract a radio or a checkbox field that has been
// autofilled. // autofilled.
TEST_F(FormAutofillTest, WebFormControlElementToClickableFormField) { TEST_F(FormAutofillTest, WebFormControlElementToClickableFormField) {
LoadHTML("<INPUT type=\"checkbox\" id=\"checkbox\" value=\"mail\"/>" LoadHTML("<INPUT type=\"checkbox\" id=\"checkbox\" value=\"mail\" checked/>"
"<INPUT type=\"radio\" id=\"radio\" value=\"male\"/>"); "<INPUT type=\"radio\" id=\"radio\" value=\"male\"/>");
WebFrame* frame = GetMainFrame(); WebFrame* frame = GetMainFrame();
...@@ -228,6 +228,7 @@ TEST_F(FormAutofillTest, WebFormControlElementToClickableFormField) { ...@@ -228,6 +228,7 @@ TEST_F(FormAutofillTest, WebFormControlElementToClickableFormField) {
expected.form_control_type = "checkbox"; expected.form_control_type = "checkbox";
expected.is_autofilled = true; expected.is_autofilled = true;
expected.is_checkable = true; expected.is_checkable = true;
expected.is_checked = true;
EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); EXPECT_FORM_FIELD_DATA_EQUALS(expected, result);
web_element = frame->document().getElementById("radio"); web_element = frame->document().getElementById("radio");
...@@ -239,6 +240,7 @@ TEST_F(FormAutofillTest, WebFormControlElementToClickableFormField) { ...@@ -239,6 +240,7 @@ TEST_F(FormAutofillTest, WebFormControlElementToClickableFormField) {
expected.form_control_type = "radio"; expected.form_control_type = "radio";
expected.is_autofilled = true; expected.is_autofilled = true;
expected.is_checkable = true; expected.is_checkable = true;
expected.is_checked = false;
EXPECT_FORM_FIELD_DATA_EQUALS(expected, result); EXPECT_FORM_FIELD_DATA_EQUALS(expected, result);
} }
......
...@@ -716,6 +716,7 @@ void WebFormControlElementToFormField(const WebFormControlElement& element, ...@@ -716,6 +716,7 @@ void WebFormControlElementToFormField(const WebFormControlElement& element,
field->is_focusable = input_element->isFocusable(); field->is_focusable = input_element->isFocusable();
field->should_autocomplete = input_element->autoComplete(); field->should_autocomplete = input_element->autoComplete();
field->is_checkable = IsCheckableElement(input_element); field->is_checkable = IsCheckableElement(input_element);
field->is_checked = input_element->isChecked();
} else if (extract_mask & EXTRACT_OPTIONS) { } else if (extract_mask & EXTRACT_OPTIONS) {
// Set option strings on the field if available. // Set option strings on the field if available.
DCHECK(IsSelectElement(element)); DCHECK(IsSelectElement(element));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment