From 6a3f8d9afcbb397f562e3a359ffbe39d59d278b9 Mon Sep 17 00:00:00 2001 From: rouslan Date: Mon, 27 Apr 2015 18:00:01 -0700 Subject: [autofill] Allow only a user gesture to trigger autofill. If a script inserts text into an input field without a user gesture, then do not show the autofill popup. TEST=AutofillRendererTest.IgnoreNonUserGestureTextFieldChanges BUG=353001 Review URL: https://codereview.chromium.org/1026493002 Cr-Commit-Position: refs/heads/master@{#327204} --- content/public/test/render_view_test.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'content/public/test/render_view_test.h') diff --git a/content/public/test/render_view_test.h b/content/public/test/render_view_test.h index d3fd776..91d0df6 100644 --- a/content/public/test/render_view_test.h +++ b/content/public/test/render_view_test.h @@ -22,6 +22,7 @@ struct ViewMsg_Resize_Params; namespace blink { +class WebInputElement; class WebWidget; } @@ -99,7 +100,7 @@ class RenderViewTest : public testing::Test { void SendWebKeyboardEvent(const blink::WebKeyboardEvent& key_event); // Send a raw mouse event to the renderer. - void SendWebMouseEvent(const blink::WebMouseEvent& key_event); + void SendWebMouseEvent(const blink::WebMouseEvent& mouse_event); // Returns the bounds (coordinates and size) of the element with id // |element_id|. Returns an empty rect if such an element was not found. @@ -130,6 +131,18 @@ class RenderViewTest : public testing::Test { gfx::Rect resizer_rect, bool is_fullscreen); + // Simulates typing the |ascii_character| into this render view. Also accepts + // ui::VKEY_BACK for backspace. Will flush the message loop if + // |flush_message_loop| is true. + void SimulateUserTypingASCIICharacter(char ascii_character, + bool flush_message_loop); + + // Simulates user focusing |input|, erasing all text, and typing the + // |new_value| instead. Will process input events for autofill. This is a user + // gesture. + void SimulateUserInputChangeForElement(blink::WebInputElement* input, + const std::string& new_value); + // These are all methods from RenderViewImpl that we expose to testing code. bool OnMessageReceived(const IPC::Message& msg); void DidNavigateWithinPage(blink::WebLocalFrame* frame, -- cgit v1.1