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

Unified Diff: content/public/test/browser_test_utils.cc

Issue 2046843003: Merge "Fix webview crash on attempt to scroll." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f24c5f4ba08ac33e3fadb40627838b36845638a6..f089d737fbec0f9d4a850cded53d0880cb825e6a 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -509,6 +509,37 @@ void SimulateGestureScrollSequence(WebContents* web_contents,
widget_host->ForwardGestureEvent(scroll_end);
}
+void SimulateGestureFlingSequence(WebContents* web_contents,
+ const gfx::Point& point,
+ const gfx::Vector2dF& velocity) {
+ RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From(
+ web_contents->GetRenderViewHost()->GetWidget());
+
+ blink::WebGestureEvent scroll_begin;
+ scroll_begin.type = blink::WebGestureEvent::GestureScrollBegin;
+ scroll_begin.sourceDevice = blink::WebGestureDeviceTouchpad;
+ scroll_begin.x = point.x();
+ scroll_begin.y = point.y();
+ widget_host->ForwardGestureEvent(scroll_begin);
+
+ blink::WebGestureEvent scroll_end;
+ scroll_end.type = blink::WebGestureEvent::GestureScrollEnd;
+ scroll_end.sourceDevice = blink::WebGestureDeviceTouchpad;
+ scroll_end.x = point.x();
+ scroll_end.y = point.y();
+ widget_host->ForwardGestureEvent(scroll_end);
+
+ blink::WebGestureEvent fling_start;
+ fling_start.type = blink::WebGestureEvent::GestureFlingStart;
+ fling_start.sourceDevice = blink::WebGestureDeviceTouchpad;
+ fling_start.x = point.x();
+ fling_start.y = point.y();
+ fling_start.data.flingStart.targetViewport = false;
+ fling_start.data.flingStart.velocityX = velocity.x();
+ fling_start.data.flingStart.velocityY = velocity.y();
+ widget_host->ForwardGestureEvent(fling_start);
+}
+
void SimulateTapAt(WebContents* web_contents, const gfx::Point& point) {
blink::WebGestureEvent tap;
tap.type = blink::WebGestureEvent::GestureTap;
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698