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

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

Issue 136793007: Add Autofill preview support for <select> input fields (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 e12acc40d344f4c7924349fc30db9ac91a4e0dcd..b046aec1a01a7bb4859a95742829b0a1dd07b4e1 100644
--- a/chrome/renderer/autofill/form_autofill_browsertest.cc
+++ b/chrome/renderer/autofill/form_autofill_browsertest.cc
@@ -232,11 +232,11 @@ class FormAutofillTest : public ChromeRenderViewTest {
WebString value;
WebFormControlElement element = GetMainFrame()->document().getElementById(
ASCIIToUTF16(field_case.name)).to<WebFormControlElement>();
- if (element.formControlType() == "select-one") {
- value = element.to<WebSelectElement>().value();
- } else if (element.formControlType() == "textarea") {
+ if ((element.formControlType() == "select-one") ||
+ (element.formControlType() == "textarea"))
value = get_value_function(element);
- } else {
+ else
+ {
Ilya Sherman 2014/02/08 01:40:41 nit: Please keep all the curly braces as they were
ASSERT_TRUE(element.formControlType() == "text" ||
element.formControlType() == "month");
value = get_value_function(element);
@@ -266,6 +266,9 @@ class FormAutofillTest : public ChromeRenderViewTest {
if (element.formControlType() == "textarea")
return element.to<WebTextAreaElement>().value();
+ if (element.formControlType() == "select-one")
+ return element.to<WebSelectElement>().value();
+
return element.to<WebInputElement>().value();
}
@@ -273,6 +276,9 @@ class FormAutofillTest : public ChromeRenderViewTest {
if (element.formControlType() == "textarea")
return element.to<WebTextAreaElement>().suggestedValue();
+ if (element.formControlType() == "select-one")
+ return element.to<WebSelectElement>().suggestedValue();
+
return element.to<WebInputElement>().suggestedValue();
}
@@ -1205,10 +1211,11 @@ TEST_F(FormAutofillTest, PreviewForm) {
{"month", "month", "", "", false, "2017-11", ""},
// Non-empty <input type="month"> should not be previewed.
{"month", "month-nonempty", "2011-12", "", false, "2017-11", ""},
- // Regular select fields preview is not yet supported
- {"select-one", "select", "", "", false, "TX", ""},
- // Select fields preview is not yet supported
- {"select-one", "select-nonempty", "CA", "", false, "TX", "CA"},
+ // Regular select fields should be previewed.
+ {"select-one", "select", "", "", true, "TX", "TX"},
+ // Select fields should be previewed even if they already have a
+ // non-empty value.
+ {"select-one", "select-nonempty", "CA", "", true, "TX", "TX"},
// Normal textarea elements should be previewed.
{"textarea", "textarea", "", "", true, "suggested multi-\nline value",
"suggested multi-\nline value"},

Powered by Google App Engine
This is Rietveld 408576698