Chromium Code Reviews| Index: content/public/test/browser_test_utils.cc |
| diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc |
| index 0de234dae34df88f010a4c3216cb70616e108045..f373a5c5123c43fd71057d3eb936bbdec4faee62 100644 |
| --- a/content/public/test/browser_test_utils.cc |
| +++ b/content/public/test/browser_test_utils.cc |
| @@ -25,8 +25,10 @@ |
| #include "content/browser/accessibility/accessibility_mode_helper.h" |
| #include "content/browser/accessibility/browser_accessibility.h" |
| #include "content/browser/accessibility/browser_accessibility_manager.h" |
| +#include "content/browser/browser_plugin/browser_plugin_guest.h" |
| #include "content/browser/frame_host/frame_tree_node.h" |
| #include "content/browser/frame_host/render_frame_host_impl.h" |
| +#include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| #include "content/browser/renderer_host/render_widget_host_impl.h" |
| #include "content/browser/web_contents/web_contents_impl.h" |
| #include "content/browser/web_contents/web_contents_view.h" |
| @@ -1003,6 +1005,62 @@ ui::AXTreeUpdate GetAccessibilityTreeSnapshot(WebContents* web_contents) { |
| return manager->SnapshotAXTreeForTesting(); |
| } |
| +bool IsWebContentsBrowserPluginFocused(content::WebContents* web_contents) { |
| + WebContentsImpl* web_contents_impl = |
| + static_cast<WebContentsImpl*>(web_contents); |
| + BrowserPluginGuest* browser_plugin_guest = |
| + web_contents_impl->GetBrowserPluginGuest(); |
| + return browser_plugin_guest ? browser_plugin_guest->focused() : false; |
| +} |
| + |
| +#if defined(USE_AURA) |
| +void SendRoutedTouchTapSequence(content::WebContents* web_contents, |
| + gfx::Point point) { |
| + RenderWidgetHostViewAura* rwhva = static_cast<RenderWidgetHostViewAura*>( |
| + web_contents->GetRenderWidgetHostView()); |
| + ui::TouchEvent touch_start(ui::ET_TOUCH_PRESSED, point, 0, |
| + base::TimeTicks::Now()); |
| + rwhva->OnTouchEvent(&touch_start); |
| + ui::TouchEvent touch_end(ui::ET_TOUCH_RELEASED, point, 0, |
| + base::TimeTicks::Now()); |
| + rwhva->OnTouchEvent(&touch_end); |
| +} |
| + |
| +void SendRoutedGestureTapSequence(content::WebContents* web_contents, |
| + gfx::Point point) { |
| + RenderWidgetHostViewAura* rwhva = static_cast<RenderWidgetHostViewAura*>( |
| + web_contents->GetRenderWidgetHostView()); |
| + ui::GestureEventDetails gesture_tap_down_details(ui::ET_GESTURE_TAP_DOWN); |
| + gesture_tap_down_details.set_device_type( |
| + ui::GestureDeviceType::DEVICE_TOUCHSCREEN); |
| + ui::GestureEvent gesture_tap_down(point.x(), point.y(), 0, |
| + base::TimeTicks::Now(), |
| + gesture_tap_down_details); |
| + rwhva->OnGestureEvent(&gesture_tap_down); |
| + ui::GestureEventDetails gesture_tap_details(ui::ET_GESTURE_TAP); |
| + gesture_tap_details.set_device_type( |
| + ui::GestureDeviceType::DEVICE_TOUCHSCREEN); |
| + gesture_tap_details.set_tap_count(1); |
| + ui::GestureEvent gesture_tap(point.x(), point.y(), 0, base::TimeTicks::Now(), |
| + gesture_tap_details); |
| + rwhva->OnGestureEvent(&gesture_tap); |
| +} |
| +#endif |
| + |
| +void WaitForSurfaceReady(content::WebContents* web_contents) { |
|
kenrb
2016/07/05 14:30:57
I know we talked about this earlier, but I don't r
wjmaclean
2016/07/05 15:04:22
Moving the SurfaceHitTestReady relies on a cc DEP
kenrb
2016/07/05 15:32:01
If we change SurfaceHitTestReady to use surface_fr
|
| + RenderWidgetHostViewChildFrame* child_view = |
| + static_cast<RenderWidgetHostViewChildFrame*>( |
| + web_contents->GetRenderWidgetHostView()); |
| + while (true) { |
| + base::RunLoop run_loop; |
| + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| + FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); |
| + run_loop.Run(); |
| + if (child_view->frame_count() > 0) |
| + break; |
| + } |
| +} |
| + |
| TitleWatcher::TitleWatcher(WebContents* web_contents, |
| const base::string16& expected_title) |
| : WebContentsObserver(web_contents), |