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

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

Issue 1026493002: Allow only a user gesture to trigger autofill popup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not layout frame. Created 5 years, 8 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/renderer/autofill/password_autofill_agent_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/autofill/autofill_renderer_browsertest.cc
diff --git a/chrome/renderer/autofill/autofill_renderer_browsertest.cc b/chrome/renderer/autofill/autofill_renderer_browsertest.cc
index 0ff5d278a96321e89ebb1152f26faae245971380..e6f4ec1384c9d517980cb75edc851c152b0cb8e3 100644
--- a/chrome/renderer/autofill/autofill_renderer_browsertest.cc
+++ b/chrome/renderer/autofill/autofill_renderer_browsertest.cc
@@ -22,6 +22,7 @@
#include "third_party/WebKit/public/web/WebFormElement.h"
#include "third_party/WebKit/public/web/WebInputElement.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "third_party/WebKit/public/web/WebView.h"
using base::ASCIIToUTF16;
using blink::WebDocument;
@@ -245,6 +246,31 @@ TEST_F(AutofillRendererTest, DynamicallyAddedUnownedFormElements) {
EXPECT_FORM_FIELD_DATA_EQUALS(expected, forms[0].fields[8]);
}
+TEST_F(AutofillRendererTest, IgnoreNonUserGestureTextFieldChanges) {
+ LoadHTML("<form method='post'>"
+ " <input type='text' id='full_name'/>"
+ "</form>");
+
+ blink::WebInputElement full_name =
+ GetMainFrame()->document().getElementById("full_name")
+ .to<blink::WebInputElement>();
+ while (!full_name.focused())
+ GetMainFrame()->view()->advanceFocus(false);
+
+ // Not a user gesture, so no IPC message to browser.
+ full_name.setValue("Alice", true);
+ GetMainFrame()->toWebLocalFrame()->autofillClient()->textFieldDidChange(
+ full_name);
+ base::MessageLoop::current()->RunUntilIdle();
+ ASSERT_EQ(nullptr, render_thread_->sink().GetFirstMessageMatching(
+ AutofillHostMsg_TextFieldDidChange::ID));
+
+ // A user gesture will send a message to the browser.
+ SimulateUserInputChangeForElement(&full_name, "Alice");
+ ASSERT_NE(nullptr, render_thread_->sink().GetFirstMessageMatching(
+ AutofillHostMsg_TextFieldDidChange::ID));
+}
+
class RequestAutocompleteRendererTest : public AutofillRendererTest {
public:
RequestAutocompleteRendererTest()
« no previous file with comments | « no previous file | chrome/renderer/autofill/password_autofill_agent_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698