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

Unified Diff: chrome/browser/site_per_process_interactive_browsertest.cc

Issue 2479663002: Move compositor InputHandler from RenderViewImpl to RenderWidget. (Closed)
Patch Set: Rebase to master@{#445291}. Created 3 years, 11 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 | « cc/trees/layer_tree_host_impl.cc ('k') | content/browser/renderer_host/input/input_router_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/site_per_process_interactive_browsertest.cc
diff --git a/chrome/browser/site_per_process_interactive_browsertest.cc b/chrome/browser/site_per_process_interactive_browsertest.cc
index de70dde96691548580e283698860815035defd1a..79fe4f6287fed9f4e6290753de3467da726f9d8c 100644
--- a/chrome/browser/site_per_process_interactive_browsertest.cc
+++ b/chrome/browser/site_per_process_interactive_browsertest.cc
@@ -149,6 +149,14 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
content::RenderFrameHost* child =
ChildFrameAt(web_contents->GetMainFrame(), 0);
std::string result;
+ std::string script =
+ "function onInput(e) {"
+ " domAutomationController.setAutomationId(0);"
+ " domAutomationController.send(getInputFieldText());"
+ "}"
+ "inputField = document.getElementById('text-field');"
+ "inputField.addEventListener('input', onInput, false);";
+ EXPECT_TRUE(ExecuteScript(child, script));
EXPECT_TRUE(ExecuteScriptAndExtractString(
child, "window.focus(); focusInputField();", &result));
EXPECT_EQ("input-focus", result);
@@ -157,18 +165,24 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
EXPECT_EQ(child, web_contents->GetFocusedFrame());
// Generate a few keyboard events and route them to currently focused frame.
+ // We wait for replies to be sent back from the page, since keystrokes may
+ // take time to propagate to the renderer's main thread.
+ content::DOMMessageQueue msg_queue;
+ std::string reply;
SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('f'),
ui::DomCode::US_F, ui::VKEY_F, false, false, false, false);
+ EXPECT_TRUE(msg_queue.WaitForMessage(&reply));
+ EXPECT_EQ("\"F\"", reply);
+
SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('O'),
ui::DomCode::US_O, ui::VKEY_O, false, false, false, false);
+ EXPECT_TRUE(msg_queue.WaitForMessage(&reply));
+ EXPECT_EQ("\"FO\"", reply);
+
SimulateKeyPress(web_contents, ui::DomKey::FromCharacter('O'),
ui::DomCode::US_O, ui::VKEY_O, false, false, false, false);
-
- // Verify that the input field in the subframe received the keystrokes.
- EXPECT_TRUE(ExecuteScriptAndExtractString(
- child,
- "window.domAutomationController.send(getInputFieldText());", &result));
- EXPECT_EQ("FOO", result);
+ EXPECT_TRUE(msg_queue.WaitForMessage(&reply));
+ EXPECT_EQ("\"FOO\"", reply);
}
// Ensure that sequential focus navigation (advancing focused elements with
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | content/browser/renderer_host/input/input_router_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698