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

Unified Diff: content/browser/renderer_host/input/touch_input_browsertest.cc

Issue 2624783002: Fix movementX/Y attributes for touch pointer events (Closed)
Patch Set: Wrap ForwardTouchEventWithLatencyInfo to always reset points Created 3 years, 10 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
Index: content/browser/renderer_host/input/touch_input_browsertest.cc
diff --git a/content/browser/renderer_host/input/touch_input_browsertest.cc b/content/browser/renderer_host/input/touch_input_browsertest.cc
index 0088a4ff5a176f2662163b63f4ff6bed36bc4c4a..baa0af6ad3962d9f237f4092aa37c3d76527e329 100644
--- a/content/browser/renderer_host/input/touch_input_browsertest.cc
+++ b/content/browser/renderer_host/input/touch_input_browsertest.cc
@@ -103,6 +103,11 @@ class TouchInputBrowserTest : public ContentBrowserTest {
}
protected:
+ void SendTouchEvent(SyntheticWebTouchEvent* event) {
+ GetWidgetHost()->ForwardTouchEventWithLatencyInfo(*event,
+ ui::LatencyInfo());
+ event->ResetPoints();
+ }
void LoadURL() {
const GURL data_url(kTouchEventDataURL);
NavigateToURL(shell(), data_url);
@@ -135,15 +140,14 @@ IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_TouchNoHandler) {
// no touch-handler on it.
touch.PressPoint(25, 25);
scoped_refptr<InputMsgWatcher> filter = AddFilter(WebInputEvent::TouchStart);
- GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
+ SendTouchEvent(&touch);
EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, filter->WaitForAck());
// If a touch-press is acked with NO_CONSUMER_EXISTS, then subsequent
// touch-points don't need to be dispatched until the touch point is released.
touch.ReleasePoint(0);
- GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
- touch.ResetPoints();
+ SendTouchEvent(&touch);
}
#if defined(OS_CHROMEOS)
@@ -160,13 +164,12 @@ IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_TouchHandlerNoConsume) {
// touch-handler on |second|, but it doesn't consume the event.
touch.PressPoint(125, 25);
scoped_refptr<InputMsgWatcher> filter = AddFilter(WebInputEvent::TouchStart);
- GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
+ SendTouchEvent(&touch);
EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, filter->WaitForAck());
filter = AddFilter(WebInputEvent::TouchEnd);
touch.ReleasePoint(0);
- GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
- touch.ResetPoints();
+ SendTouchEvent(&touch);
filter->WaitForAck();
}
@@ -184,12 +187,12 @@ IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_TouchHandlerConsume) {
// |third| consimes the event.
touch.PressPoint(25, 125);
scoped_refptr<InputMsgWatcher> filter = AddFilter(WebInputEvent::TouchStart);
- GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
+ SendTouchEvent(&touch);
EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter->WaitForAck());
touch.ReleasePoint(0);
filter = AddFilter(WebInputEvent::TouchEnd);
- GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
+ SendTouchEvent(&touch);
filter->WaitForAck();
}
@@ -210,12 +213,12 @@ IN_PROC_BROWSER_TEST_F(TouchInputBrowserTest, MAYBE_MultiPointTouchPress) {
// on |third|. That point should be acked with CONSUMED.
touch.PressPoint(25, 25);
scoped_refptr<InputMsgWatcher> filter = AddFilter(WebInputEvent::TouchStart);
- GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
+ SendTouchEvent(&touch);
EXPECT_EQ(INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, filter->WaitForAck());
touch.PressPoint(25, 125);
filter = AddFilter(WebInputEvent::TouchStart);
- GetWidgetHost()->ForwardTouchEventWithLatencyInfo(touch, ui::LatencyInfo());
+ SendTouchEvent(&touch);
EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, filter->WaitForAck());
}
« no previous file with comments | « content/browser/renderer_host/input/input_router_impl.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698