| 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 24af2a89cafc7ca31f31f6bcd2e2ea655ccbc3ed..e12e37555b3e00079c9a9d627823314e5d84c894 100644
|
| --- a/content/browser/site_per_process_browsertest.cc
|
| +++ b/content/browser/site_per_process_browsertest.cc
|
| @@ -49,8 +49,15 @@
|
| #include "net/test/embedded_test_server/embedded_test_server.h"
|
| #include "third_party/WebKit/public/web/WebInputEvent.h"
|
| #include "third_party/WebKit/public/web/WebSandboxFlags.h"
|
| +#include "ui/events/event.h"
|
| +#include "ui/events/event_utils.h"
|
| +#include "ui/gfx/geometry/point.h"
|
| #include "ui/gfx/switches.h"
|
|
|
| +#if defined(USE_AURA)
|
| +#include "content/browser/renderer_host/render_widget_host_view_aura.h"
|
| +#endif
|
| +
|
| #if defined(OS_MACOSX)
|
| #include "ui/base/test/scoped_preferred_scroller_style_mac.h"
|
| #endif
|
| @@ -4381,6 +4388,56 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OpenerSetLocation) {
|
| EXPECT_EQ(shell()->web_contents()->GetLastCommittedURL(), cross_url);
|
| }
|
|
|
| +// Ensure that a cross-process subframe with a touch-handler can receive touch
|
| +// events.
|
| +#if defined(AURA)
|
| +// Browser process hit testing is not implemented on Android, and this test
|
| +// requires Aura for RenderWidgetHostViewAura::OnTouchEvent().
|
| +// https://crbug.com/491334
|
| +IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
| + SubframeTouchEventRouting) {
|
| + 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_touch_handler.html"));
|
| + NavigateFrameToURL(root->child_at(0), frame_url);
|
| + EXPECT_TRUE(WaitForRenderFrameReady(root->child_at(0)->current_frame_host()));
|
| +
|
| + // Synchronize with the child and parent renderers to guarantee that the
|
| + // surface information required for event hit testing is ready.
|
| + RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>(
|
| + root->child_at(0)->current_frame_host()->GetView());
|
| + MainThreadFrameObserver child_observer(child_rwhv->GetRenderWidgetHost());
|
| + child_observer.Wait();
|
| +
|
| + MainThreadFrameObserver parent_observer(
|
| + web_contents->GetRenderWidgetHostView()->GetRenderWidgetHost());
|
| + parent_observer.Wait();
|
| +
|
| +
|
| + // Simulate touch event to sub-frame.
|
| + gfx::Point child_center = child_rwhv->GetBoundsInRootWindow().CenterPoint();
|
| + auto rwhv = static_cast<RenderWidgetHostViewAura*>(
|
| + web_contents->GetRenderWidgetHostView());
|
| + ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0,
|
| + ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f);
|
| + rwhv->OnTouchEvent(&touch_event);
|
| +
|
| + // Verify touch handler in subframe was invoked
|
| + std::string result;
|
| + EXPECT_TRUE(ExecuteScriptAndExtractString(
|
| + root->child_at(0)->current_frame_host(),
|
| + "window.domAutomationController.send(getLastTouchEvent());", &result));
|
| + EXPECT_EQ("touchstart", result);
|
| +}
|
| +#endif // defined(USE_AURA)
|
| +
|
| // Ensure that a cross-process subframe can receive keyboard events when in
|
| // focus.
|
| IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
|
|
|