Index: content/browser/renderer_host/input/input_router_impl_unittest.cc |
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc |
index 90ece24297b6a576d8001d00dcc9da431076ea42..d212442a6ef4c3659398f2b67a37c980c8ff902a 100644 |
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc |
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc |
@@ -247,9 +247,11 @@ class InputRouterImplTest : public testing::Test { |
touch_event_.SetTimestamp(timestamp); |
} |
- void SendTouchEvent() { |
+ uint32 SendTouchEvent() { |
+ uint32 touch_event_id = touch_event_.uniqueTouchEventId; |
input_router_->SendTouchEvent(TouchEventWithLatencyInfo(touch_event_)); |
touch_event_.ResetPoints(); |
+ return touch_event_id; |
} |
int PressTouchPoint(int x, int y) { |
@@ -270,9 +272,16 @@ class InputRouterImplTest : public testing::Test { |
void SendInputEventACK(blink::WebInputEvent::Type type, |
InputEventAckState ack_result) { |
- InputHostMsg_HandleInputEvent_ACK_Params ack; |
- ack.type = type; |
- ack.state = ack_result; |
+ DCHECK(!WebInputEvent::isTouchEventType(type)); |
+ InputEventAck ack(type, ack_result); |
+ input_router_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); |
+ } |
+ |
+ void SendTouchEventACK(blink::WebInputEvent::Type type, |
+ InputEventAckState ack_result, |
+ uint32 touch_event_id) { |
+ DCHECK(WebInputEvent::isTouchEventType(type)); |
+ InputEventAck ack(type, ack_result, touch_event_id); |
input_router_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); |
} |
@@ -780,29 +789,29 @@ TEST_F(InputRouterImplTest, TouchEventQueue) { |
OnHasTouchEventHandlers(true); |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id = SendTouchEvent(); |
EXPECT_TRUE(client_->GetAndResetFilterEventCalled()); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
EXPECT_FALSE(TouchEventQueueEmpty()); |
// The second touch should not be sent since one is already in queue. |
MoveTouchPoint(0, 5, 5); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id = SendTouchEvent(); |
EXPECT_FALSE(client_->GetAndResetFilterEventCalled()); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
EXPECT_FALSE(TouchEventQueueEmpty()); |
// Receive an ACK for the first touch-event. |
- SendInputEventACK(WebInputEvent::TouchStart, |
- INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id); |
EXPECT_FALSE(TouchEventQueueEmpty()); |
EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
EXPECT_EQ(WebInputEvent::TouchStart, |
ack_handler_->acked_touch_event().event.type); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
- SendInputEventACK(WebInputEvent::TouchMove, |
- INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchMove, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_move_event_id); |
EXPECT_TRUE(TouchEventQueueEmpty()); |
EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
EXPECT_EQ(WebInputEvent::TouchMove, |
@@ -820,7 +829,7 @@ TEST_F(InputRouterImplTest, TouchEventQueueFlush) { |
// Send a touch-press event. |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id = SendTouchEvent(); |
MoveTouchPoint(0, 2, 2); |
MoveTouchPoint(0, 3, 3); |
EXPECT_FALSE(TouchEventQueueEmpty()); |
@@ -835,7 +844,8 @@ TEST_F(InputRouterImplTest, TouchEventQueueFlush) { |
// After the ack, the touch-event queue should be empty, and none of the |
// flushed touch-events should have been sent to the renderer. |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
EXPECT_TRUE(TouchEventQueueEmpty()); |
} |
@@ -859,7 +869,7 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) { |
// Press the first finger. |
PressTouchPoint(1, 1); |
SetTouchTimestamp(timestamp); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id1 = SendTouchEvent(); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, |
gfx::Point(1, 1), 0, timestamp)); |
@@ -868,7 +878,7 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) { |
timestamp += base::TimeDelta::FromSeconds(10); |
MoveTouchPoint(0, 500, 500); |
SetTouchTimestamp(timestamp); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id1 = SendTouchEvent(); |
EXPECT_FALSE(TouchEventQueueEmpty()); |
expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_MOVED, |
gfx::Point(500, 500), 0, timestamp)); |
@@ -877,7 +887,7 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) { |
timestamp += base::TimeDelta::FromSeconds(10); |
PressTouchPoint(2, 2); |
SetTouchTimestamp(timestamp); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id2 = SendTouchEvent(); |
EXPECT_FALSE(TouchEventQueueEmpty()); |
expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, |
gfx::Point(2, 2), 1, timestamp)); |
@@ -887,7 +897,7 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) { |
MoveTouchPoint(0, 10, 10); |
MoveTouchPoint(1, 20, 20); |
SetTouchTimestamp(timestamp); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id2 = SendTouchEvent(); |
EXPECT_FALSE(TouchEventQueueEmpty()); |
expected_events.push_back(new ui::TouchEvent(ui::ET_TOUCH_MOVED, |
gfx::Point(10, 10), 0, timestamp)); |
@@ -901,13 +911,18 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) { |
WebInputEvent::TouchStart, |
WebInputEvent::TouchMove }; |
+ uint32 touch_event_ids[] = {touch_press_event_id1, |
+ touch_move_event_id1, |
+ touch_press_event_id2, |
+ touch_move_event_id2}; |
+ |
TouchEventCoordinateSystem coordinate_system = LOCAL_COORDINATES; |
#if !defined(OS_WIN) |
coordinate_system = SCREEN_COORDINATES; |
#endif |
for (size_t i = 0; i < arraysize(acks); ++i) { |
- SendInputEventACK(acks[i], |
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+ SendTouchEventACK(acks[i], INPUT_EVENT_ACK_STATE_NOT_CONSUMED, |
+ touch_event_ids[i]); |
EXPECT_EQ(acks[i], ack_handler_->acked_touch_event().event.type); |
ScopedVector<ui::TouchEvent> acked; |
@@ -957,30 +972,31 @@ TEST_F(InputRouterImplTest, UnhandledWheelEvent) { |
TEST_F(InputRouterImplTest, TouchTypesIgnoringAck) { |
OnHasTouchEventHandlers(true); |
// Only acks for TouchCancel should always be ignored. |
- ASSERT_FALSE(WebInputEventTraits::IgnoresAckDisposition( |
+ ASSERT_TRUE(WebInputEventTraits::WillReceiveAckFromRenderer( |
GetEventWithType(WebInputEvent::TouchStart))); |
- ASSERT_FALSE(WebInputEventTraits::IgnoresAckDisposition( |
+ ASSERT_TRUE(WebInputEventTraits::WillReceiveAckFromRenderer( |
GetEventWithType(WebInputEvent::TouchMove))); |
- ASSERT_FALSE(WebInputEventTraits::IgnoresAckDisposition( |
+ ASSERT_TRUE(WebInputEventTraits::WillReceiveAckFromRenderer( |
GetEventWithType(WebInputEvent::TouchEnd))); |
// Precede the TouchCancel with an appropriate TouchStart; |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ uint32 touch_press_event_id = SendTouchEvent(); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id); |
ASSERT_EQ(1U, GetSentMessageCountAndResetSink()); |
ASSERT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
ASSERT_EQ(0, client_->in_flight_event_count()); |
// The TouchCancel ack is always ignored. |
CancelTouchPoint(0); |
- SendTouchEvent(); |
+ uint32 touch_cancel_event_id = SendTouchEvent(); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
EXPECT_EQ(0, client_->in_flight_event_count()); |
EXPECT_FALSE(HasPendingEvents()); |
- SendInputEventACK(WebInputEvent::TouchCancel, |
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchCancel, |
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED, touch_cancel_event_id); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
EXPECT_FALSE(HasPendingEvents()); |
@@ -1019,7 +1035,8 @@ TEST_F(InputRouterImplTest, GestureTypesIgnoringAck) { |
WebInputEvent::GestureScrollEnd}; |
for (size_t i = 0; i < arraysize(eventTypes); ++i) { |
WebInputEvent::Type type = eventTypes[i]; |
- if (!WebInputEventTraits::IgnoresAckDisposition(GetEventWithType(type))) { |
+ if (WebInputEventTraits::WillReceiveAckFromRenderer( |
+ GetEventWithType(type))) { |
SimulateGestureEvent(type, blink::WebGestureDeviceTouchscreen); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
@@ -1049,8 +1066,9 @@ TEST_F(InputRouterImplTest, MouseTypesIgnoringAck) { |
for (int i = start_type; i <= end_type; ++i) { |
WebInputEvent::Type type = static_cast<WebInputEvent::Type>(i); |
int expected_in_flight_event_count = |
- WebInputEventTraits::IgnoresAckDisposition(GetEventWithType(type)) ? 0 |
- : 1; |
+ !WebInputEventTraits::WillReceiveAckFromRenderer(GetEventWithType(type)) |
+ ? 0 |
+ : 1; |
// Note: Mouse event acks are never forwarded to the ack handler, so the key |
// result here is that ignored ack types don't affect the in-flight count. |
@@ -1068,7 +1086,7 @@ TEST_F(InputRouterImplTest, MouseTypesIgnoringAck) { |
} |
// Guard against breaking changes to the list of ignored event ack types in |
-// |WebInputEventTraits::IgnoresAckDisposition|. |
+// |WebInputEventTraits::WillReceiveAckFromRenderer|. |
TEST_F(InputRouterImplTest, RequiredEventAckTypes) { |
const WebInputEvent::Type kRequiredEventAckTypes[] = { |
WebInputEvent::MouseMove, |
@@ -1086,7 +1104,7 @@ TEST_F(InputRouterImplTest, RequiredEventAckTypes) { |
}; |
for (size_t i = 0; i < arraysize(kRequiredEventAckTypes); ++i) { |
const WebInputEvent::Type required_ack_type = kRequiredEventAckTypes[i]; |
- EXPECT_FALSE(WebInputEventTraits::IgnoresAckDisposition( |
+ ASSERT_TRUE(WebInputEventTraits::WillReceiveAckFromRenderer( |
GetEventWithType(required_ack_type))); |
} |
} |
@@ -1212,7 +1230,7 @@ TEST_F(InputRouterImplTest, TouchAckTimeoutConfigured) { |
// Verify that the touch ack timeout fires upon the delayed ack. |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id1 = SendTouchEvent(); |
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
RunTasksAndWait(base::TimeDelta::FromMilliseconds(timeout_ms + 1)); |
@@ -1222,7 +1240,8 @@ TEST_F(InputRouterImplTest, TouchAckTimeoutConfigured) { |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
// Ack'ing the timed-out event should fire a TouchCancel. |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id1); |
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
@@ -1253,22 +1272,26 @@ TEST_F(InputRouterImplTest, TouchAckTimeoutConfigured) { |
// TOUCH_ACTION_NONE (and no other touch-action) should disable the timeout. |
OnHasTouchEventHandlers(true); |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id2 = SendTouchEvent(); |
OnSetTouchAction(TOUCH_ACTION_PAN_Y); |
EXPECT_TRUE(TouchEventTimeoutEnabled()); |
ReleaseTouchPoint(0); |
- SendTouchEvent(); |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ uint32 touch_release_event_id2 = SendTouchEvent(); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id2); |
+ SendTouchEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_release_event_id2); |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id3 = SendTouchEvent(); |
OnSetTouchAction(TOUCH_ACTION_NONE); |
EXPECT_FALSE(TouchEventTimeoutEnabled()); |
ReleaseTouchPoint(0); |
- SendTouchEvent(); |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ uint32 touch_release_event_id3 = SendTouchEvent(); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id3); |
+ SendTouchEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_release_event_id3); |
// As the touch-action is reset by a new touch sequence, the timeout behavior |
// should be restored. |
@@ -1288,17 +1311,18 @@ TEST_F(InputRouterImplTest, |
// Start a touch sequence. |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id = SendTouchEvent(); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
// TOUCH_ACTION_NONE should disable the timeout. |
OnSetTouchAction(TOUCH_ACTION_NONE); |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id); |
EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
EXPECT_FALSE(TouchEventTimeoutEnabled()); |
MoveTouchPoint(0, 1, 2); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id = SendTouchEvent(); |
EXPECT_FALSE(TouchEventTimeoutEnabled()); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
@@ -1306,13 +1330,15 @@ TEST_F(InputRouterImplTest, |
RunTasksAndWait(base::TimeDelta::FromMilliseconds(timeout_ms + 1)); |
EXPECT_EQ(0U, ack_handler_->GetAndResetAckCount()); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchMove, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_move_event_id); |
EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount()); |
// End the touch sequence. |
ReleaseTouchPoint(0); |
- SendTouchEvent(); |
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ uint32 touch_release_event_id = SendTouchEvent(); |
+ SendTouchEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_release_event_id); |
EXPECT_FALSE(TouchEventTimeoutEnabled()); |
ack_handler_->GetAndResetAckCount(); |
GetSentMessageCountAndResetSink(); |
@@ -1336,23 +1362,25 @@ TEST_F(InputRouterImplTest, TouchActionResetBeforeEventReachesRenderer) { |
// Sequence 1. |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id1 = SendTouchEvent(); |
OnSetTouchAction(TOUCH_ACTION_NONE); |
MoveTouchPoint(0, 50, 50); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id1 = SendTouchEvent(); |
ReleaseTouchPoint(0); |
- SendTouchEvent(); |
+ uint32 touch_release_event_id1 = SendTouchEvent(); |
// Sequence 2. |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id2 = SendTouchEvent(); |
MoveTouchPoint(0, 50, 50); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id2 = SendTouchEvent(); |
ReleaseTouchPoint(0); |
- SendTouchEvent(); |
+ uint32 touch_release_event_id2 = SendTouchEvent(); |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
- SendInputEventACK(WebInputEvent::TouchMove, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id1); |
+ SendTouchEventACK(WebInputEvent::TouchMove, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_move_event_id1); |
// Ensure touch action is still none, as the next touch start hasn't been |
// acked yet. ScrollBegin and ScrollEnd don't require acks. |
@@ -1365,12 +1393,15 @@ TEST_F(InputRouterImplTest, TouchActionResetBeforeEventReachesRenderer) { |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
// This allows the next touch sequence to start. |
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_release_event_id1); |
// Ensure touch action has been set to auto, as a new touch sequence has |
// started. |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
- SendInputEventACK(WebInputEvent::TouchMove, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id2); |
+ SendTouchEventACK(WebInputEvent::TouchMove, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_move_event_id2); |
EXPECT_EQ(3U, GetSentMessageCountAndResetSink()); |
SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
blink::WebGestureDeviceTouchscreen); |
@@ -1378,7 +1409,8 @@ TEST_F(InputRouterImplTest, TouchActionResetBeforeEventReachesRenderer) { |
SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
blink::WebGestureDeviceTouchscreen); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_release_event_id2); |
} |
// Test that TouchActionFilter::ResetTouchAction is called when a new touch |
@@ -1388,19 +1420,21 @@ TEST_F(InputRouterImplTest, TouchActionResetWhenTouchHasNoConsumer) { |
// Sequence 1. |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id1 = SendTouchEvent(); |
MoveTouchPoint(0, 50, 50); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id1 = SendTouchEvent(); |
OnSetTouchAction(TOUCH_ACTION_NONE); |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
- SendInputEventACK(WebInputEvent::TouchMove, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id1); |
+ SendTouchEventACK(WebInputEvent::TouchMove, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_move_event_id1); |
ReleaseTouchPoint(0); |
- SendTouchEvent(); |
+ uint32 touch_release_event_id1 = SendTouchEvent(); |
// Sequence 2 |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id2 = SendTouchEvent(); |
MoveTouchPoint(0, 50, 50); |
SendTouchEvent(); |
ReleaseTouchPoint(0); |
@@ -1416,9 +1450,11 @@ TEST_F(InputRouterImplTest, TouchActionResetWhenTouchHasNoConsumer) { |
blink::WebGestureDeviceTouchscreen); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
- SendInputEventACK(WebInputEvent::TouchStart, |
- INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
+ SendTouchEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_release_event_id1); |
+ SendTouchEventACK(WebInputEvent::TouchStart, |
+ INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, |
+ touch_press_event_id2); |
// Ensure touch action has been set to auto, as the touch had no consumer. |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
@@ -1436,26 +1472,27 @@ TEST_F(InputRouterImplTest, TouchActionResetWhenTouchHandlerRemoved) { |
// Touch sequence with touch handler. |
OnHasTouchEventHandlers(true); |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id = SendTouchEvent(); |
MoveTouchPoint(0, 50, 50); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id = SendTouchEvent(); |
OnSetTouchAction(TOUCH_ACTION_NONE); |
ReleaseTouchPoint(0); |
- SendTouchEvent(); |
+ uint32 touch_release_event_id = SendTouchEvent(); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
// Ensure we have touch-action:none, suppressing scroll events. |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
- SendInputEventACK(WebInputEvent::TouchMove, |
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchMove, |
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED, touch_move_event_id); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
blink::WebGestureDeviceTouchscreen); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
- SendInputEventACK(WebInputEvent::TouchEnd, |
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_NOT_CONSUMED, |
+ touch_release_event_id); |
SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
blink::WebGestureDeviceTouchscreen); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
@@ -1481,16 +1518,17 @@ TEST_F(InputRouterImplTest, DoubleTapGestureDependsOnFirstTap) { |
// Sequence 1. |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id1 = SendTouchEvent(); |
OnSetTouchAction(TOUCH_ACTION_NONE); |
- SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_press_event_id1); |
ReleaseTouchPoint(0); |
- SendTouchEvent(); |
+ uint32 touch_release_event_id = SendTouchEvent(); |
// Sequence 2 |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id2 = SendTouchEvent(); |
// First tap. |
EXPECT_EQ(2U, GetSentMessageCountAndResetSink()); |
@@ -1504,7 +1542,7 @@ TEST_F(InputRouterImplTest, DoubleTapGestureDependsOnFirstTap) { |
blink::WebGestureDeviceTouchscreen); |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
// This test will become invalid if GestureTap stops requiring an ack. |
- ASSERT_FALSE(WebInputEventTraits::IgnoresAckDisposition( |
+ ASSERT_TRUE(WebInputEventTraits::WillReceiveAckFromRenderer( |
GetEventWithType(WebInputEvent::GestureTap))); |
EXPECT_EQ(2, client_->in_flight_event_count()); |
SendInputEventACK(WebInputEvent::GestureTap, |
@@ -1517,9 +1555,11 @@ TEST_F(InputRouterImplTest, DoubleTapGestureDependsOnFirstTap) { |
blink::WebGestureDeviceTouchscreen); |
EXPECT_EQ(0U, GetSentMessageCountAndResetSink()); |
- SendInputEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED); |
- SendInputEventACK(WebInputEvent::TouchStart, |
- INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
+ SendTouchEventACK(WebInputEvent::TouchEnd, INPUT_EVENT_ACK_STATE_CONSUMED, |
+ touch_release_event_id); |
+ SendTouchEventACK(WebInputEvent::TouchStart, |
+ INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS, |
+ touch_press_event_id2); |
// Second Tap. |
EXPECT_EQ(1U, GetSentMessageCountAndResetSink()); |
@@ -1532,7 +1572,7 @@ TEST_F(InputRouterImplTest, DoubleTapGestureDependsOnFirstTap) { |
SimulateGestureEvent(WebInputEvent::GestureDoubleTap, |
blink::WebGestureDeviceTouchscreen); |
// This test will become invalid if GestureDoubleTap stops requiring an ack. |
- ASSERT_FALSE(WebInputEventTraits::IgnoresAckDisposition( |
+ ASSERT_TRUE(WebInputEventTraits::WillReceiveAckFromRenderer( |
GetEventWithType(WebInputEvent::GestureDoubleTap))); |
EXPECT_EQ(1, client_->in_flight_event_count()); |
SendInputEventACK(WebInputEvent::GestureTap, INPUT_EVENT_ACK_STATE_CONSUMED); |
@@ -1552,20 +1592,20 @@ TEST_F(InputRouterImplTest, InputFlush) { |
// Queue a TouchStart. |
OnHasTouchEventHandlers(true); |
PressTouchPoint(1, 1); |
- SendTouchEvent(); |
+ uint32 touch_press_event_id = SendTouchEvent(); |
EXPECT_TRUE(HasPendingEvents()); |
// DidFlush should be called only after the event is ack'ed. |
RequestNotificationWhenFlushed(); |
EXPECT_EQ(0U, GetAndResetDidFlushCount()); |
- SendInputEventACK(WebInputEvent::TouchStart, |
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchStart, |
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED, touch_press_event_id); |
EXPECT_EQ(1U, GetAndResetDidFlushCount()); |
// Ensure different types of enqueued events will prevent the DidFlush call |
// until all such events have been fully dispatched. |
MoveTouchPoint(0, 50, 50); |
- SendTouchEvent(); |
+ uint32 touch_move_event_id = SendTouchEvent(); |
ASSERT_TRUE(HasPendingEvents()); |
SimulateGestureEvent(WebInputEvent::GestureScrollBegin, |
blink::WebGestureDeviceTouchscreen); |
@@ -1583,8 +1623,8 @@ TEST_F(InputRouterImplTest, InputFlush) { |
EXPECT_EQ(0U, GetAndResetDidFlushCount()); |
// There are still pending gestures. |
- SendInputEventACK(WebInputEvent::TouchMove, |
- INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+ SendTouchEventACK(WebInputEvent::TouchMove, |
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED, touch_move_event_id); |
EXPECT_EQ(0U, GetAndResetDidFlushCount()); |
EXPECT_TRUE(HasPendingEvents()); |
@@ -1771,9 +1811,8 @@ TEST_F(InputRouterImplTest, OverscrollDispatch) { |
wheel_overscroll.current_fling_velocity = gfx::Vector2dF(1, 0); |
SimulateWheelEvent(3, 0, 0, false); |
- InputHostMsg_HandleInputEvent_ACK_Params ack; |
- ack.type = WebInputEvent::MouseWheel; |
- ack.state = INPUT_EVENT_ACK_STATE_NOT_CONSUMED; |
+ InputEventAck ack(WebInputEvent::MouseWheel, |
+ INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
ack.overscroll.reset(new DidOverscrollParams(wheel_overscroll)); |
input_router_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack)); |