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

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

Issue 2015373002: Fix webview crash on attempt to scroll. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed content_tests (handle case when view is not available), added expected event into Fling test … 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 1316dd5527159bc8fdf9847c551a45fb05250ccb..994ef41123fe1186c83f7a7eb665c97846a88693 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -523,6 +523,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