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

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: Rebase Created 6 years, 9 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 4fa945fe8764c36a5e4e591f328a1baa5518a196..7581c360a5a7780885312f1a501449fb3ceea947 100644
--- a/chrome/renderer/autofill/form_autofill_browsertest.cc
+++ b/chrome/renderer/autofill/form_autofill_browsertest.cc
@@ -232,9 +232,8 @@ 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 {
ASSERT_TRUE(element.formControlType() == "text" ||
@@ -266,6 +265,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 +275,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();
}
@@ -1313,10 +1318,11 @@ TEST_F(FormAutofillTest, PreviewForm) {
{"month", "month", "", "", true, "2017-11", "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"},
« 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