| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 5366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5377 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( | 5377 RenderWidgetHostViewBase* child_rwhv = static_cast<RenderWidgetHostViewBase*>( |
| 5378 root->child_at(0)->current_frame_host()->GetView()); | 5378 root->child_at(0)->current_frame_host()->GetView()); |
| 5379 SurfaceHitTestReadyNotifier notifier( | 5379 SurfaceHitTestReadyNotifier notifier( |
| 5380 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); | 5380 static_cast<RenderWidgetHostViewChildFrame*>(child_rwhv)); |
| 5381 notifier.WaitForSurfaceReady(); | 5381 notifier.WaitForSurfaceReady(); |
| 5382 | 5382 |
| 5383 // There's no intrinsic reason the following values can't be equal, but they | 5383 // There's no intrinsic reason the following values can't be equal, but they |
| 5384 // aren't at present, and if they become the same this test will need to be | 5384 // aren't at present, and if they become the same this test will need to be |
| 5385 // updated to accommodate. | 5385 // updated to accommodate. |
| 5386 EXPECT_NE(TOUCH_ACTION_AUTO, TOUCH_ACTION_NONE); | 5386 EXPECT_NE(TOUCH_ACTION_AUTO, TOUCH_ACTION_NONE); |
| 5387 |
| 5387 // Verify the child's input router is initially set for TOUCH_ACTION_AUTO. The | 5388 // Verify the child's input router is initially set for TOUCH_ACTION_AUTO. The |
| 5388 // TouchStart event will trigger TOUCH_ACTION_NONE being sent back to the | 5389 // TouchStart event will trigger TOUCH_ACTION_NONE being sent back to the |
| 5389 // browser. | 5390 // browser. |
| 5390 RenderWidgetHostImpl* child_render_widget_host = | 5391 RenderWidgetHostImpl* child_render_widget_host = |
| 5391 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 5392 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 5392 InputRouterImpl* child_input_router = | 5393 InputRouterImpl* child_input_router = |
| 5393 static_cast<InputRouterImpl*>(child_render_widget_host->input_router()); | 5394 static_cast<InputRouterImpl*>(child_render_widget_host->input_router()); |
| 5394 EXPECT_EQ(TOUCH_ACTION_AUTO, child_input_router->allowed_touch_action()); | 5395 EXPECT_EQ(TOUCH_ACTION_AUTO, |
| 5396 child_input_router->touch_action_filter_.allowed_touch_action()); |
| 5395 | 5397 |
| 5396 // Simulate touch event to sub-frame. | 5398 // Simulate touch event to sub-frame. |
| 5397 gfx::Point child_center(150, 150); | 5399 gfx::Point child_center(150, 150); |
| 5398 auto* rwhv = static_cast<RenderWidgetHostViewAura*>( | 5400 auto* rwhv = static_cast<RenderWidgetHostViewAura*>( |
| 5399 contents->GetRenderWidgetHostView()); | 5401 contents->GetRenderWidgetHostView()); |
| 5400 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, | 5402 ui::TouchEvent touch_event(ui::ET_TOUCH_PRESSED, child_center, 0, 0, |
| 5401 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); | 5403 ui::EventTimeForNow(), 30.f, 30.f, 0.f, 0.f); |
| 5402 rwhv->OnTouchEvent(&touch_event); | 5404 rwhv->OnTouchEvent(&touch_event); |
| 5403 | 5405 |
| 5404 // Verify touch handler in subframe was invoked | 5406 // Verify touch handler in subframe was invoked |
| 5405 std::string result; | 5407 std::string result; |
| 5406 EXPECT_TRUE(ExecuteScriptAndExtractString( | 5408 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 5407 root->child_at(0), | 5409 root->child_at(0), |
| 5408 "window.domAutomationController.send(getLastTouchEvent());", &result)); | 5410 "window.domAutomationController.send(getLastTouchEvent());", &result)); |
| 5409 EXPECT_EQ("touchstart", result); | 5411 EXPECT_EQ("touchstart", result); |
| 5410 | 5412 |
| 5411 // Verify the presence of the touch handler in the child frame correctly | 5413 // Verify the presence of the touch handler in the child frame correctly |
| 5412 // propagates touch-action:none information back to the child's input router. | 5414 // propagates touch-action:none information back to the child's input router. |
| 5413 EXPECT_EQ(TOUCH_ACTION_NONE, child_input_router->allowed_touch_action()); | 5415 EXPECT_EQ(TOUCH_ACTION_NONE, |
| 5416 child_input_router->touch_action_filter_.allowed_touch_action()); |
| 5414 } | 5417 } |
| 5415 | 5418 |
| 5416 namespace { | 5419 namespace { |
| 5417 | 5420 |
| 5418 // Declared here to be close to the SubframeGestureEventRouting test. | 5421 // Declared here to be close to the SubframeGestureEventRouting test. |
| 5419 void OnSyntheticGestureCompleted(scoped_refptr<MessageLoopRunner> runner, | 5422 void OnSyntheticGestureCompleted(scoped_refptr<MessageLoopRunner> runner, |
| 5420 SyntheticGesture::Result result) { | 5423 SyntheticGesture::Result result) { |
| 5421 EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result); | 5424 EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result); |
| 5422 runner->Quit(); | 5425 runner->Quit(); |
| 5423 } | 5426 } |
| (...skipping 3635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9059 | 9062 |
| 9060 std::string result; | 9063 std::string result; |
| 9061 EXPECT_TRUE(ExecuteScriptAndExtractString( | 9064 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 9062 root, | 9065 root, |
| 9063 "window.domAutomationController.send(frames[0].document.body.innerText);", | 9066 "window.domAutomationController.send(frames[0].document.body.innerText);", |
| 9064 &result)); | 9067 &result)); |
| 9065 EXPECT_EQ("This page has no title.", result); | 9068 EXPECT_EQ("This page has no title.", result); |
| 9066 } | 9069 } |
| 9067 | 9070 |
| 9068 } // namespace content | 9071 } // namespace content |
| OLD | NEW |