summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-11 22:20:17 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-11 22:20:17 +0000
commitd274529093cf9751e7addc510fdce5c17eaad26e (patch)
treee2fee6c73e64a47a33fa12fedcbf00cd59192a26
parente876f3c9d6f9202a196f5ab43ef0fb84ddf42747 (diff)
downloadchromium_src-d274529093cf9751e7addc510fdce5c17eaad26e.zip
chromium_src-d274529093cf9751e7addc510fdce5c17eaad26e.tar.gz
chromium_src-d274529093cf9751e7addc510fdce5c17eaad26e.tar.bz2
Merge 280469 "Mark the single autofilled field when the relevant..."
> Mark the single autofilled field when the relevant section is autofilled.This allows the renderer to distinguish autofilled fields from fields with non-empty values, such as select-one fields. > > R=isherman@chromium.org > BUG=388477 > > Review URL: https://codereview.chromium.org/357653003 TBR=ziran.sun@samsung.com Review URL: https://codereview.chromium.org/388993002 git-svn-id: svn://svn.chromium.org/chrome/branches/2062/src@282716 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autofill/autofill_interactive_uitest.cc29
-rw-r--r--components/autofill/core/browser/autofill_manager.cc5
2 files changed, 34 insertions, 0 deletions
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc
index 259e568..31ae763 100644
--- a/chrome/browser/autofill/autofill_interactive_uitest.cc
+++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -483,6 +483,35 @@ IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, AutofillSelectViaTab) {
ExpectFilledTestForm();
}
+// Test that a field is still autofillable after the previously autofilled
+// value is deleted.
+IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, OnDeleteValueAfterAutofill) {
+ CreateTestProfile();
+
+ // Load the test page.
+ ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
+ GURL(std::string(kDataURIPrefix) + kTestFormString)));
+
+ // Invoke and accept the Autofill popup and verify the form was filled.
+ FocusFirstNameField();
+ SendKeyToPageAndWait(ui::VKEY_M);
+ SendKeyToPopupAndWait(ui::VKEY_DOWN);
+ SendKeyToPopupAndWait(ui::VKEY_RETURN);
+ ExpectFilledTestForm();
+
+ // Delete the value of a filled field.
+ ASSERT_TRUE(content::ExecuteScript(
+ GetRenderViewHost(),
+ "document.getElementById('firstname').value = '';"));
+ ExpectFieldValue("firstname", "");
+
+ // Invoke and accept the Autofill popup and verify the field was filled.
+ SendKeyToPageAndWait(ui::VKEY_M);
+ SendKeyToPopupAndWait(ui::VKEY_DOWN);
+ SendKeyToPopupAndWait(ui::VKEY_RETURN);
+ ExpectFieldValue("firstname", "Milton");
+}
+
// Test that a JavaScript oninput event is fired after auto-filling a form.
IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, OnInputAfterAutofill) {
CreateTestProfile();
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 370a8f0..bc7030de 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -569,6 +569,11 @@ void AutofillManager::FillOrPreviewForm(
// user edits an autofilled field (for metrics).
autofill_field->is_autofilled = true;
+ // Mark the field as autofilled when a non-empty value is assigned to
+ // it. This allows the renderer to distinguish autofilled fields from
+ // fields with non-empty values, such as select-one fields.
+ iter->is_autofilled = true;
+
if (!is_credit_card && !value.empty())
client_->DidFillOrPreviewField(value, profile_full_name);
}