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

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

Issue 1245623003: [Autofill] Copy attributes for the select elements as well. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated heuristic tests Created 5 years, 5 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/test/data/autofill/heuristics/output/04_checkout_lowes.com.out » ('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 88d8994a424f5ce991acf4459c8ecd983fcbbb7b..f3b46da4cb1ffa3a35626418aedee8e6f9645b13 100644
--- a/chrome/renderer/autofill/form_autofill_browsertest.cc
+++ b/chrome/renderer/autofill/form_autofill_browsertest.cc
@@ -1563,6 +1563,38 @@ TEST_F(FormAutofillTest, WebFormControlElementToFormFieldSelect) {
EXPECT_EQ(ASCIIToUTF16("Texas"), result3.option_contents[1]);
}
+// We copy extra attributes for the select field.
+TEST_F(FormAutofillTest,
+ WebFormControlElementToFormFieldSelect_ExtraAttributes) {
+ LoadHTML("<SELECT id='element' autocomplete='off'/>"
+ " <OPTION value='CA'>California</OPTION>"
+ " <OPTION value='TX'>Texas</OPTION>"
+ "</SELECT>");
+
+ WebFrame* frame = GetMainFrame();
+ ASSERT_NE(nullptr, frame);
+
+ WebFormControlElement element = GetFormControlElementById("element");
+ element.setAutofilled(true);
+
+ FormFieldData result1;
+ WebFormControlElementToFormField(element, EXTRACT_VALUE, &result1);
+
+ FormFieldData expected;
+ expected.name = ASCIIToUTF16("element");
+ expected.max_length = 0;
+ expected.form_control_type = "select-one";
+ // We check that the extra attributes have been copied to |result1|.
+ expected.is_autofilled = true;
+ expected.autocomplete_attribute = "off";
+ expected.should_autocomplete = false;
+ expected.is_focusable = true;
+ expected.text_direction = base::i18n::LEFT_TO_RIGHT;
+
+ expected.value = ASCIIToUTF16("CA");
+ EXPECT_FORM_FIELD_DATA_EQUALS(expected, result1);
+}
+
// When faced with <select> field with *many* options, we should trim them to a
// reasonable number.
TEST_F(FormAutofillTest, WebFormControlElementToFormFieldLongSelect) {
« no previous file with comments | « no previous file | chrome/test/data/autofill/heuristics/output/04_checkout_lowes.com.out » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698