summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-27 20:04:35 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-27 20:04:35 +0000
commita8f55faf9b2e44faf5c6d8e7b3ee46feeaf4002f (patch)
tree970a2e4629fc9c406d3075d1f7fca222e4901a5c /chrome/browser/autofill
parentc94c42fe3f25774be517c4e2a21b8b0bcbc39aab (diff)
downloadchromium_src-a8f55faf9b2e44faf5c6d8e7b3ee46feeaf4002f.zip
chromium_src-a8f55faf9b2e44faf5c6d8e7b3ee46feeaf4002f.tar.gz
chromium_src-a8f55faf9b2e44faf5c6d8e7b3ee46feeaf4002f.tar.bz2
Update Autofill renderer code to ignore non-Autofillable fields in some additional cases.
Fixes a regression from http://crrev.com/102240 BUG=98140 TEST=interactive_ui_tests --gtest_filter=AutofillTest.AutofillFormWithNonAutofillableField Review URL: http://codereview.chromium.org/8046026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill')
-rw-r--r--chrome/browser/autofill/autofill_browsertest.cc100
1 files changed, 72 insertions, 28 deletions
diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc
index f3bbdf5..4c0630d 100644
--- a/chrome/browser/autofill/autofill_browsertest.cc
+++ b/chrome/browser/autofill/autofill_browsertest.cc
@@ -37,31 +37,31 @@ static const char* kTestFormString =
"<form action=\"http://www.example.com/\" method=\"POST\">"
"<label for=\"firstname\">First name:</label>"
" <input type=\"text\" id=\"firstname\""
- " onFocus=\"domAutomationController.send(true)\" /><br />"
+ " onFocus=\"domAutomationController.send(true)\"><br>"
"<label for=\"lastname\">Last name:</label>"
- " <input type=\"text\" id=\"lastname\" /><br />"
+ " <input type=\"text\" id=\"lastname\"><br>"
"<label for=\"address1\">Address line 1:</label>"
- " <input type=\"text\" id=\"address1\" /><br />"
+ " <input type=\"text\" id=\"address1\"><br>"
"<label for=\"address2\">Address line 2:</label>"
- " <input type=\"text\" id=\"address2\" /><br />"
+ " <input type=\"text\" id=\"address2\"><br>"
"<label for=\"city\">City:</label>"
- " <input type=\"text\" id=\"city\" /><br />"
+ " <input type=\"text\" id=\"city\"><br>"
"<label for=\"state\">State:</label>"
" <select id=\"state\">"
" <option value=\"\" selected=\"yes\">--</option>"
" <option value=\"CA\">California</option>"
" <option value=\"TX\">Texas</option>"
- " </select><br />"
+ " </select><br>"
"<label for=\"zip\">ZIP code:</label>"
- " <input type=\"text\" id=\"zip\" /><br />"
+ " <input type=\"text\" id=\"zip\"><br>"
"<label for=\"country\">Country:</label>"
" <select id=\"country\">"
" <option value=\"\" selected=\"yes\">--</option>"
" <option value=\"CA\">Canada</option>"
" <option value=\"US\">United States</option>"
- " </select><br />"
+ " </select><br>"
"<label for=\"phone\">Phone number:</label>"
- " <input type=\"text\" id=\"phone\" /><br />"
+ " <input type=\"text\" id=\"phone\"><br>"
"</form>";
class AutofillTest : public InProcessBrowserTest {
@@ -395,34 +395,34 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, AutofillFormWithRepeatedField) {
"<form action=\"http://www.example.com/\" method=\"POST\">"
"<label for=\"firstname\">First name:</label>"
" <input type=\"text\" id=\"firstname\""
- " onFocus=\"domAutomationController.send(true)\" /><br />"
+ " onFocus=\"domAutomationController.send(true)\"><br>"
"<label for=\"lastname\">Last name:</label>"
- " <input type=\"text\" id=\"lastname\" /><br />"
+ " <input type=\"text\" id=\"lastname\"><br>"
"<label for=\"address1\">Address line 1:</label>"
- " <input type=\"text\" id=\"address1\" /><br />"
+ " <input type=\"text\" id=\"address1\"><br>"
"<label for=\"address2\">Address line 2:</label>"
- " <input type=\"text\" id=\"address2\" /><br />"
+ " <input type=\"text\" id=\"address2\"><br>"
"<label for=\"city\">City:</label>"
- " <input type=\"text\" id=\"city\" /><br />"
+ " <input type=\"text\" id=\"city\"><br>"
"<label for=\"state\">State:</label>"
" <select id=\"state\">"
" <option value=\"\" selected=\"yes\">--</option>"
" <option value=\"CA\">California</option>"
" <option value=\"TX\">Texas</option>"
- " </select><br />"
+ " </select><br>"
"<label for=\"state_freeform\" style=\"display:none\">State:</label>"
" <input type=\"text\" id=\"state_freeform\""
- " style=\"display:none\" /><br />"
+ " style=\"display:none\"><br>"
"<label for=\"zip\">ZIP code:</label>"
- " <input type=\"text\" id=\"zip\" /><br />"
+ " <input type=\"text\" id=\"zip\"><br>"
"<label for=\"country\">Country:</label>"
" <select id=\"country\">"
" <option value=\"\" selected=\"yes\">--</option>"
" <option value=\"CA\">Canada</option>"
" <option value=\"US\">United States</option>"
- " </select><br />"
+ " </select><br>"
"<label for=\"phone\">Phone number:</label>"
- " <input type=\"text\" id=\"phone\" /><br />"
+ " <input type=\"text\" id=\"phone\"><br>"
"</form>")));
// Invoke Autofill.
@@ -430,6 +430,50 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, AutofillFormWithRepeatedField) {
ExpectFieldValue(L"state_freeform", "");
}
+// Test that we properly autofill forms with non-autofillable fields.
+IN_PROC_BROWSER_TEST_F(AutofillTest, AutofillFormWithNonAutofillableField) {
+ CreateTestProfile();
+
+ // Load the test page.
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+ ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
+ GURL(std::string(kDataURIPrefix) +
+ "<form action=\"http://www.example.com/\" method=\"POST\">"
+ "<label for=\"firstname\">First name:</label>"
+ " <input type=\"text\" id=\"firstname\""
+ " onFocus=\"domAutomationController.send(true)\"><br>"
+ "<label for=\"middlename\">Middle name:</label>"
+ " <input type=\"text\" id=\"middlename\" autocomplete=\"off\" /><br>"
+ "<label for=\"lastname\">Last name:</label>"
+ " <input type=\"text\" id=\"lastname\"><br>"
+ "<label for=\"address1\">Address line 1:</label>"
+ " <input type=\"text\" id=\"address1\"><br>"
+ "<label for=\"address2\">Address line 2:</label>"
+ " <input type=\"text\" id=\"address2\"><br>"
+ "<label for=\"city\">City:</label>"
+ " <input type=\"text\" id=\"city\"><br>"
+ "<label for=\"state\">State:</label>"
+ " <select id=\"state\">"
+ " <option value=\"\" selected=\"yes\">--</option>"
+ " <option value=\"CA\">California</option>"
+ " <option value=\"TX\">Texas</option>"
+ " </select><br>"
+ "<label for=\"zip\">ZIP code:</label>"
+ " <input type=\"text\" id=\"zip\"><br>"
+ "<label for=\"country\">Country:</label>"
+ " <select id=\"country\">"
+ " <option value=\"\" selected=\"yes\">--</option>"
+ " <option value=\"CA\">Canada</option>"
+ " <option value=\"US\">United States</option>"
+ " </select><br>"
+ "<label for=\"phone\">Phone number:</label>"
+ " <input type=\"text\" id=\"phone\"><br>"
+ "</form>")));
+
+ // Invoke Autofill.
+ TryBasicFormFill();
+}
+
// Test that we can Autofill dynamically generated forms.
IN_PROC_BROWSER_TEST_F(AutofillTest, DynamicFormFill) {
CreateTestProfile();
@@ -565,31 +609,31 @@ IN_PROC_BROWSER_TEST_F(AutofillTest, AutofillAfterTranslate) {
"<label for=\"fn\">なまえ</label>"
" <input type=\"text\" id=\"fn\""
" onFocus=\"domAutomationController.send(true)\""
- " /><br />"
+ "><br>"
"<label for=\"ln\">みょうじ</label>"
- " <input type=\"text\" id=\"ln\" /><br />"
+ " <input type=\"text\" id=\"ln\"><br>"
"<label for=\"a1\">Address line 1:</label>"
- " <input type=\"text\" id=\"a1\" /><br />"
+ " <input type=\"text\" id=\"a1\"><br>"
"<label for=\"a2\">Address line 2:</label>"
- " <input type=\"text\" id=\"a2\" /><br />"
+ " <input type=\"text\" id=\"a2\"><br>"
"<label for=\"ci\">City:</label>"
- " <input type=\"text\" id=\"ci\" /><br />"
+ " <input type=\"text\" id=\"ci\"><br>"
"<label for=\"st\">State:</label>"
" <select id=\"st\">"
" <option value=\"\" selected=\"yes\">--</option>"
" <option value=\"CA\">California</option>"
" <option value=\"TX\">Texas</option>"
- " </select><br />"
+ " </select><br>"
"<label for=\"z\">ZIP code:</label>"
- " <input type=\"text\" id=\"z\" /><br />"
+ " <input type=\"text\" id=\"z\"><br>"
"<label for=\"co\">Country:</label>"
" <select id=\"co\">"
" <option value=\"\" selected=\"yes\">--</option>"
" <option value=\"CA\">Canada</option>"
" <option value=\"US\">United States</option>"
- " </select><br />"
+ " </select><br>"
"<label for=\"ph\">Phone number:</label>"
- " <input type=\"text\" id=\"ph\" /><br />"
+ " <input type=\"text\" id=\"ph\"><br>"
"</form>");
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), url));