Add support for sending touch events in DRT.

As part of this, make it possible for DRT to configure the timeout threshold between sending touch events to WebCore as the Layout Tests only synthesize single events, not a stream. Because of this, they often get dropped by the WebView for coming too quickly.

Skip the multi touch test as we don't support multi touch in the Browser.

Change-Id: I7b9830f43181fea33206825b49ef2e294269b4dd
This commit is contained in:
Ben Murdoch
2010-01-13 10:54:56 +00:00
parent ecbfb2104f
commit ecbc65cf8f
6 changed files with 294 additions and 8 deletions

View File

@@ -342,6 +342,7 @@ public class WebView extends AbsoluteLayout
* choice. Maybe make this in the buildspec later.
*/
private static final int TOUCH_SENT_INTERVAL = 50;
private int mCurrentTouchInterval = TOUCH_SENT_INTERVAL;
/**
* Helper class to get velocity for fling
@@ -4343,7 +4344,7 @@ public class WebView extends AbsoluteLayout
// pass the touch events from UI thread to WebCore thread
if (mForwardTouchEvents && (action != MotionEvent.ACTION_MOVE
|| eventTime - mLastSentTouchTime > TOUCH_SENT_INTERVAL)) {
|| eventTime - mLastSentTouchTime > mCurrentTouchInterval)) {
WebViewCore.TouchEventData ted = new WebViewCore.TouchEventData();
ted.mAction = action;
ted.mX = viewToContentX((int) x + mScrollX);
@@ -6633,6 +6634,16 @@ public class WebView extends AbsoluteLayout
mWebViewCore.drawContentPicture(canvas, 0, false, false);
}
/**
* Set the time to wait between passing touches to WebCore. See also the
* TOUCH_SENT_INTERVAL member for further discussion.
*
* @hide This is only used by the DRT test application.
*/
public void setTouchInterval(int interval) {
mCurrentTouchInterval = interval;
}
/**
* Update our cache with updatedText.
* @param updatedText The new text to put in our cache.