Index: content/browser/site_per_process_browsertest.cc |
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc |
index f4beb0be6c0c55ecd92f0f9652b636c36e9c8c27..6bb654a15b58f2bf84fac0ded993a0b6cd45f212 100644 |
--- a/content/browser/site_per_process_browsertest.cc |
+++ b/content/browser/site_per_process_browsertest.cc |
@@ -97,18 +97,6 @@ |
EXPECT_TRUE(success); |
} |
-// Helper function to generate a click on the given RenderWidgetHost. The |
-// mouse event is forwarded directly to the RenderWidgetHost without any |
-// hit-testing. |
-void SimulateMouseClick(RenderWidgetHost* rwh, int x, int y) { |
- blink::WebMouseEvent mouse_event; |
- mouse_event.type = blink::WebInputEvent::MouseDown; |
- mouse_event.button = blink::WebPointerProperties::ButtonLeft; |
- mouse_event.x = x; |
- mouse_event.y = y; |
- rwh->ForwardMouseEvent(mouse_event); |
-} |
- |
class RedirectNotificationObserver : public NotificationObserver { |
public: |
// Register to listen for notifications of the given type from either a |
@@ -3500,8 +3488,14 @@ |
DOMMessageQueue msg_queue; |
// Click on the cross-process subframe. |
- SimulateMouseClick( |
- root->child_at(0)->current_frame_host()->GetRenderWidgetHost(), 1, 1); |
+ blink::WebMouseEvent mouse_event; |
+ mouse_event.type = blink::WebInputEvent::MouseDown; |
+ mouse_event.button = blink::WebPointerProperties::ButtonLeft; |
+ mouse_event.x = 1; |
+ mouse_event.y = 1; |
+ RenderWidgetHost* rwh_child = |
+ root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
+ rwh_child->ForwardMouseEvent(mouse_event); |
// Check that the main frame lost focus and fired blur event on the input |
// text field. |
@@ -3515,8 +3509,8 @@ |
EXPECT_EQ(root->child_at(0), root->frame_tree()->GetFocusedFrame()); |
// Click on the root frame. |
- SimulateMouseClick( |
- shell()->web_contents()->GetRenderViewHost()->GetWidget(), 1, 1); |
+ shell()->web_contents()->GetRenderViewHost()->GetWidget()->ForwardMouseEvent( |
+ mouse_event); |
// Check that the subframe lost focus and fired blur event on its |
// document's body. |
@@ -3632,47 +3626,4 @@ |
EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), cross_url); |
} |
-// Ensure that a cross-process subframe can receive keyboard events when in |
-// focus. |
-IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
- SubframeKeyboardEventRouting) { |
- GURL main_url(embedded_test_server()->GetURL( |
- "a.com", "/frame_tree/page_with_one_frame.html")); |
- EXPECT_TRUE(NavigateToURL(shell(), main_url)); |
- |
- WebContentsImpl* web_contents = |
- static_cast<WebContentsImpl*>(shell()->web_contents()); |
- FrameTreeNode* root = web_contents->GetFrameTree()->root(); |
- |
- GURL frame_url( |
- embedded_test_server()->GetURL("b.com", "/page_with_input_field.html")); |
- NavigateFrameToURL(root->child_at(0), frame_url); |
- EXPECT_TRUE(WaitForRenderFrameReady(root->child_at(0)->current_frame_host())); |
- |
- // Click on the subframe to focus it. |
- SimulateMouseClick( |
- root->child_at(0)->current_frame_host()->GetRenderWidgetHost(), 1, 1); |
- |
- // Focus the input field in the subframe. The return value "input-focus" |
- // will be sent once the input field's focus event fires. |
- std::string result; |
- EXPECT_TRUE(ExecuteScriptAndExtractString( |
- root->child_at(0)->current_frame_host(), "focusInputField()", &result)); |
- EXPECT_EQ(result, "input-focus"); |
- |
- // The subframe should now be focused. |
- EXPECT_EQ(root->child_at(0), root->frame_tree()->GetFocusedFrame()); |
- |
- // Generate a few keyboard events and route them to currently focused frame. |
- SimulateKeyPress(web_contents, ui::VKEY_F, false, false, false, false); |
- SimulateKeyPress(web_contents, ui::VKEY_O, false, false, false, false); |
- SimulateKeyPress(web_contents, ui::VKEY_O, false, false, false, false); |
- |
- // Verify that the input field in the subframe received the keystrokes. |
- EXPECT_TRUE(ExecuteScriptAndExtractString( |
- root->child_at(0)->current_frame_host(), |
- "window.domAutomationController.send(getInputFieldText());", &result)); |
- EXPECT_EQ("FOO", result); |
-} |
- |
} // namespace content |