summaryrefslogtreecommitdiffstats
path: root/ui/events/gesture_detection
diff options
context:
space:
mode:
authorlanwei <lanwei@chromium.org>2015-05-25 10:24:54 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-25 17:25:30 +0000
commitc67620d6f857f234404d921fcfd801fb495b5320 (patch)
tree4d9ef4522b5a232639c927dcb68aca855634ec18 /ui/events/gesture_detection
parentf5323f49131b0c99dd61f0fc64f56f40317ccbdb (diff)
downloadchromium_src-c67620d6f857f234404d921fcfd801fb495b5320.zip
chromium_src-c67620d6f857f234404d921fcfd801fb495b5320.tar.gz
chromium_src-c67620d6f857f234404d921fcfd801fb495b5320.tar.bz2
Validate that asynchronous touch acks are associated with the right event
The aura gesture recognizer currently only validates that synchronous touch acks are associated with the right event. Now we also validate this for asynchronous touch acks as well. BUG=457669 Review URL: https://codereview.chromium.org/1135013003 Cr-Commit-Position: refs/heads/master@{#331294}
Diffstat (limited to 'ui/events/gesture_detection')
-rw-r--r--ui/events/gesture_detection/filtered_gesture_provider.cc9
-rw-r--r--ui/events/gesture_detection/filtered_gesture_provider.h10
-rw-r--r--ui/events/gesture_detection/filtered_gesture_provider_unittest.cc1
-rw-r--r--ui/events/gesture_detection/gesture_event_data_packet.cc25
-rw-r--r--ui/events/gesture_detection/gesture_event_data_packet.h5
-rw-r--r--ui/events/gesture_detection/touch_disposition_gesture_filter.cc40
-rw-r--r--ui/events/gesture_detection/touch_disposition_gesture_filter.h6
-rw-r--r--ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc362
8 files changed, 241 insertions, 217 deletions
diff --git a/ui/events/gesture_detection/filtered_gesture_provider.cc b/ui/events/gesture_detection/filtered_gesture_provider.cc
index 7be795a..d8faf80 100644
--- a/ui/events/gesture_detection/filtered_gesture_provider.cc
+++ b/ui/events/gesture_detection/filtered_gesture_provider.cc
@@ -47,12 +47,9 @@ FilteredGestureProvider::OnTouchEvent(const MotionEvent& event) {
return result;
}
-void FilteredGestureProvider::OnAsyncTouchEventAck(bool event_consumed) {
- gesture_filter_.OnTouchEventAckForQueueFront(event_consumed);
-}
-
-void FilteredGestureProvider::OnSyncTouchEventAck(bool event_consumed) {
- gesture_filter_.OnTouchEventAckForQueueBack(event_consumed);
+void FilteredGestureProvider::OnTouchEventAck(uint32 unique_event_id,
+ bool event_consumed) {
+ gesture_filter_.OnTouchEventAck(unique_event_id, event_consumed);
}
void FilteredGestureProvider::ResetDetection() {
diff --git a/ui/events/gesture_detection/filtered_gesture_provider.h b/ui/events/gesture_detection/filtered_gesture_provider.h
index 21b9a96..ad71e52 100644
--- a/ui/events/gesture_detection/filtered_gesture_provider.h
+++ b/ui/events/gesture_detection/filtered_gesture_provider.h
@@ -40,13 +40,9 @@ class GESTURE_DETECTION_EXPORT FilteredGestureProvider
};
TouchHandlingResult OnTouchEvent(const MotionEvent& event) WARN_UNUSED_RESULT;
- // To be called upon asynchronous ack of an event that was forwarded
- // after a successful call to |OnTouchEvent()|.
- void OnAsyncTouchEventAck(bool event_consumed);
-
- // To be called upon synchronous ack of an event that was forwarded
- // after a successful call to |OnTouchEvent()|.
- void OnSyncTouchEventAck(bool event_consumed);
+ // To be called upon asynchronous and synchronous ack of an event that was
+ // forwarded after a successful call to |OnTouchEvent()|.
+ void OnTouchEventAck(uint32 unique_event_id, bool event_consumed);
// Methods delegated to |gesture_provider_|.
void ResetDetection();
diff --git a/ui/events/gesture_detection/filtered_gesture_provider_unittest.cc b/ui/events/gesture_detection/filtered_gesture_provider_unittest.cc
index d60490c..9a9c58a 100644
--- a/ui/events/gesture_detection/filtered_gesture_provider_unittest.cc
+++ b/ui/events/gesture_detection/filtered_gesture_provider_unittest.cc
@@ -48,6 +48,7 @@ TEST_F(FilteredGestureProviderTest, TouchDidGenerateScroll) {
EXPECT_TRUE(result.did_generate_scroll);
// No movement should indicate no scrolling.
+ event.MovePoint(0, kSlopRegion * 2.f, 0);
result = provider.OnTouchEvent(event);
EXPECT_TRUE(result.succeeded);
EXPECT_FALSE(result.did_generate_scroll);
diff --git a/ui/events/gesture_detection/gesture_event_data_packet.cc b/ui/events/gesture_detection/gesture_event_data_packet.cc
index aac1d4e..04cec5c 100644
--- a/ui/events/gesture_detection/gesture_event_data_packet.cc
+++ b/ui/events/gesture_detection/gesture_event_data_packet.cc
@@ -33,19 +33,23 @@ GestureEventDataPacket::GestureSource ToGestureSource(
} // namespace
GestureEventDataPacket::GestureEventDataPacket()
- : gesture_source_(UNDEFINED), ack_state_(AckState::PENDING) {
+ : gesture_source_(UNDEFINED),
+ ack_state_(AckState::PENDING),
+ unique_touch_event_id_(0) {
}
GestureEventDataPacket::GestureEventDataPacket(
base::TimeTicks timestamp,
GestureSource source,
const gfx::PointF& touch_location,
- const gfx::PointF& raw_touch_location)
+ const gfx::PointF& raw_touch_location,
+ uint32 unique_touch_event_id)
: timestamp_(timestamp),
touch_location_(touch_location),
raw_touch_location_(raw_touch_location),
gesture_source_(source),
- ack_state_(AckState::PENDING) {
+ ack_state_(AckState::PENDING),
+ unique_touch_event_id_(unique_touch_event_id) {
DCHECK_NE(gesture_source_, UNDEFINED);
}
@@ -56,7 +60,8 @@ GestureEventDataPacket::GestureEventDataPacket(
touch_location_(other.touch_location_),
raw_touch_location_(other.raw_touch_location_),
gesture_source_(other.gesture_source_),
- ack_state_(AckState::PENDING) {
+ ack_state_(AckState::PENDING),
+ unique_touch_event_id_(other.unique_touch_event_id_) {
}
GestureEventDataPacket::~GestureEventDataPacket() {
@@ -70,6 +75,7 @@ GestureEventDataPacket& GestureEventDataPacket::operator=(
raw_touch_location_ = other.raw_touch_location_;
gestures_ = other.gestures_;
ack_state_ = other.ack_state_;
+ unique_touch_event_id_ = other.unique_touch_event_id_;
return *this;
}
@@ -80,18 +86,17 @@ void GestureEventDataPacket::Push(const GestureEventData& gesture) {
GestureEventDataPacket GestureEventDataPacket::FromTouch(
const ui::MotionEvent& touch) {
- return GestureEventDataPacket(touch.GetEventTime(),
- ToGestureSource(touch),
+ return GestureEventDataPacket(touch.GetEventTime(), ToGestureSource(touch),
gfx::PointF(touch.GetX(), touch.GetY()),
- gfx::PointF(touch.GetRawX(), touch.GetRawY()));
+ gfx::PointF(touch.GetRawX(), touch.GetRawY()),
+ touch.GetUniqueEventId());
}
GestureEventDataPacket GestureEventDataPacket::FromTouchTimeout(
const GestureEventData& gesture) {
- GestureEventDataPacket packet(gesture.time,
- TOUCH_TIMEOUT,
+ GestureEventDataPacket packet(gesture.time, TOUCH_TIMEOUT,
gfx::PointF(gesture.x, gesture.y),
- gfx::PointF(gesture.raw_x, gesture.raw_y));
+ gfx::PointF(gesture.raw_x, gesture.raw_y), 0);
packet.Push(gesture);
return packet;
}
diff --git a/ui/events/gesture_detection/gesture_event_data_packet.h b/ui/events/gesture_detection/gesture_event_data_packet.h
index 25424b6..8b0c63f 100644
--- a/ui/events/gesture_detection/gesture_event_data_packet.h
+++ b/ui/events/gesture_detection/gesture_event_data_packet.h
@@ -58,12 +58,14 @@ class GESTURE_DETECTION_EXPORT GestureEventDataPacket {
// head of the queue, and then we handle the ack.
void Ack(bool event_consumed);
AckState ack_state() { return ack_state_; }
+ uint32 unique_touch_event_id() const { return unique_touch_event_id_; }
private:
GestureEventDataPacket(base::TimeTicks timestamp,
GestureSource source,
const gfx::PointF& touch_location,
- const gfx::PointF& raw_touch_location);
+ const gfx::PointF& raw_touch_location,
+ uint32 unique_touch_event_id);
enum { kTypicalMaxGesturesPerTouch = 5 };
base::TimeTicks timestamp_;
@@ -72,6 +74,7 @@ class GESTURE_DETECTION_EXPORT GestureEventDataPacket {
gfx::PointF raw_touch_location_;
GestureSource gesture_source_;
AckState ack_state_;
+ uint32 unique_touch_event_id_;
};
} // namespace ui
diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
index b4c25cad..cda3103 100644
--- a/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
+++ b/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
@@ -166,12 +166,22 @@ TouchDispositionGestureFilter::OnGesturePacket(
return SUCCESS;
}
+ // Check the packet's unique_touch_event_id is valid and unique.
+ if (!Tail().empty()) {
+ DCHECK_NE(packet.unique_touch_event_id(),
+ Tail().back().unique_touch_event_id());
+ }
+ if (!Head().empty()) {
+ DCHECK_NE(packet.unique_touch_event_id(),
+ Head().front().unique_touch_event_id());
+ }
+
Tail().push(packet);
return SUCCESS;
}
-void TouchDispositionGestureFilter::OnTouchEventAckForQueueFront(
- bool event_consumed) {
+void TouchDispositionGestureFilter::OnTouchEventAck(uint32 unique_event_id,
+ bool event_consumed) {
// Spurious asynchronous acks should not trigger a crash.
if (IsEmpty() || (Head().empty() && sequences_.size() == 1))
return;
@@ -179,23 +189,17 @@ void TouchDispositionGestureFilter::OnTouchEventAckForQueueFront(
if (Head().empty())
PopGestureSequence();
- Head().front().Ack(event_consumed);
- SendAckedEvents();
-}
-
-void TouchDispositionGestureFilter::OnTouchEventAckForQueueBack(
- bool event_consumed) {
- // Make sure there is an event to ack.
- CHECK(!IsEmpty());
- CHECK(!Tail().empty());
-
- Tail().back().Ack(event_consumed);
-
- if (Head().empty())
- PopGestureSequence();
-
- if (sequences_.size() == 1 && Tail().size() == 1)
+ if (!Tail().empty() &&
+ Tail().back().unique_touch_event_id() == unique_event_id) {
+ Tail().back().Ack(event_consumed);
+ if (sequences_.size() == 1 && Tail().size() == 1)
+ SendAckedEvents();
+ } else {
+ DCHECK(!Head().empty());
+ DCHECK_EQ(Head().front().unique_touch_event_id(), unique_event_id);
+ Head().front().Ack(event_consumed);
SendAckedEvents();
+ }
}
void TouchDispositionGestureFilter::SendAckedEvents() {
diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter.h b/ui/events/gesture_detection/touch_disposition_gesture_filter.h
index d2d8583..201dc02 100644
--- a/ui/events/gesture_detection/touch_disposition_gesture_filter.h
+++ b/ui/events/gesture_detection/touch_disposition_gesture_filter.h
@@ -42,10 +42,8 @@ class GESTURE_DETECTION_EXPORT TouchDispositionGestureFilter {
};
PacketResult OnGesturePacket(const GestureEventDataPacket& packet);
- // One of |OnTouchEventAckForQueue*| must be called upon receipt of
- // every touch event ack.
- void OnTouchEventAckForQueueFront(bool event_consumed);
- void OnTouchEventAckForQueueBack(bool event_consumed);
+ // OnTouchEventAck must be called upon receipt of every touch event ack.
+ void OnTouchEventAck(uint32 unique_event_id, bool event_consumed);
// Whether there are any active gesture sequences still queued in the filter.
bool IsEmpty() const;
diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
index b01a69f..43a4e24 100644
--- a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
+++ b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
@@ -43,7 +43,7 @@ class TouchDispositionGestureFilterTest
if (cancel_after_next_gesture_) {
cancel_after_next_gesture_ = false;
SendPacket(CancelTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
}
}
@@ -106,9 +106,9 @@ class TouchDispositionGestureFilterTest
return gestures;
}
- TouchDispositionGestureFilter::PacketResult
- SendTouchGestures(const MotionEvent& touch,
- const GestureEventDataPacket& packet) {
+ TouchDispositionGestureFilter::PacketResult SendTouchGesturesWithResult(
+ const MotionEvent& touch,
+ const GestureEventDataPacket& packet) {
GestureEventDataPacket touch_packet =
GestureEventDataPacket::FromTouch(touch);
for (size_t i = 0; i < packet.gesture_count(); ++i)
@@ -116,6 +116,13 @@ class TouchDispositionGestureFilterTest
return queue_->OnGesturePacket(touch_packet);
}
+ uint32 SendTouchGestures(const MotionEvent& touch,
+ const GestureEventDataPacket& packet) {
+ SendTouchGesturesWithResult(touch, packet);
+ last_sent_touch_event_id_ = touch.GetUniqueEventId();
+ return touch.GetUniqueEventId();
+ }
+
TouchDispositionGestureFilter::PacketResult
SendTimeoutGesture(EventType type) {
return queue_->OnGesturePacket(
@@ -127,24 +134,24 @@ class TouchDispositionGestureFilterTest
return queue_->OnGesturePacket(packet);
}
- void SendTouchEventAck(bool event_consumed) {
- queue_->OnTouchEventAckForQueueFront(event_consumed);
+ void SendTouchEventAck(uint32 touch_event_id, bool event_consumed) {
+ queue_->OnTouchEventAck(touch_event_id, event_consumed);
}
- void SendTouchConsumedAck() { SendTouchEventAck(true); }
-
- void SendTouchNotConsumedAck() { SendTouchEventAck(false); }
+ void SendTouchConsumedAck(uint32 touch_event_id) {
+ SendTouchEventAck(touch_event_id, true);
+ }
- void SendTouchEventAckForQueueBack(bool event_consumed) {
- queue_->OnTouchEventAckForQueueBack(event_consumed);
+ void SendTouchNotConsumedAck(uint32 touch_event_id) {
+ SendTouchEventAck(touch_event_id, false);
}
- void SendTouchConsumedAckForQueueBack() {
- SendTouchEventAckForQueueBack(true);
+ void SendTouchConsumedAckForLastTouch() {
+ SendTouchEventAck(last_sent_touch_event_id_, true);
}
- void SendTouchNotConsumedAckForQueueBack() {
- SendTouchEventAckForQueueBack(false);
+ void SendTouchNotConsumedAckForLastTouch() {
+ SendTouchEventAck(last_sent_touch_event_id_, false);
}
void PushGesture(EventType type) {
@@ -181,14 +188,15 @@ class TouchDispositionGestureFilterTest
return touch_event_;
}
- void SendPacket(const MockMotionEvent& touch_event,
- GestureList gesture_list) {
+ uint32 SendPacket(const MockMotionEvent& touch_event,
+ GestureList gesture_list) {
GestureEventDataPacket gesture_packet;
for (EventType type : gesture_list)
gesture_packet.Push(CreateGesture(type));
-
+ last_sent_touch_event_id_ = touch_event.GetUniqueEventId();
EXPECT_EQ(TouchDispositionGestureFilter::SUCCESS,
- SendTouchGestures(touch_event, gesture_packet));
+ SendTouchGesturesWithResult(touch_event, gesture_packet));
+ return touch_event.GetUniqueEventId();
}
void SetRawTouchOffset(const gfx::Vector2dF& raw_offset) {
@@ -268,24 +276,25 @@ class TouchDispositionGestureFilterTest
gfx::Vector2dF raw_offset_;
scoped_ptr<GestureEventData> last_sent_gesture_;
gfx::RectF show_press_bounding_box_;
+ uint32 last_sent_touch_event_id_;
};
TEST_F(TouchDispositionGestureFilterTest, BasicNoGestures) {
- PressTouchPoint();
+ uint32 touch_press_event_id = PressTouchPoint().GetUniqueEventId();
EXPECT_FALSE(GesturesSent());
- MoveTouchPoint();
+ uint32 touch_move_event_id = MoveTouchPoint().GetUniqueEventId();
EXPECT_FALSE(GesturesSent());
// No gestures should be dispatched by the ack, as the queued packets
// contained no gestures.
- SendTouchConsumedAck();
+ SendTouchConsumedAck(touch_press_event_id);
EXPECT_FALSE(GesturesSent());
// Release the touch gesture.
- ReleaseTouchPoint();
- SendTouchConsumedAck();
- SendTouchConsumedAck();
+ uint32 touch_release_event_id = ReleaseTouchPoint().GetUniqueEventId();
+ SendTouchConsumedAck(touch_move_event_id);
+ SendTouchConsumedAck(touch_release_event_id);
EXPECT_FALSE(GesturesSent());
}
@@ -295,7 +304,7 @@ TEST_F(TouchDispositionGestureFilterTest, BasicGestures) {
// An unconsumed touch's gesture should be sent.
SendPacket(PressTouchPoint(), press_gestures);
EXPECT_FALSE(GesturesSent());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(press_gestures, GetAndResetSentGestures()));
// Multiple gestures can be queued for a single event.
@@ -303,7 +312,7 @@ TEST_F(TouchDispositionGestureFilterTest, BasicGestures) {
Gestures(ET_SCROLL_FLING_START, ET_SCROLL_FLING_CANCEL, ET_GESTURE_END);
SendPacket(ReleaseTouchPoint(), release_gestures);
EXPECT_FALSE(GesturesSent());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(release_gestures, GetAndResetSentGestures()));
}
@@ -311,63 +320,63 @@ TEST_F(TouchDispositionGestureFilterTest, BasicGesturesConsumed) {
// A consumed touch's gesture should not be sent.
SendPacket(PressTouchPoint(),
Gestures(ET_GESTURE_BEGIN, ET_GESTURE_SCROLL_BEGIN));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(
ReleaseTouchPoint(),
Gestures(ET_SCROLL_FLING_START, ET_SCROLL_FLING_CANCEL, ET_GESTURE_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
}
TEST_F(TouchDispositionGestureFilterTest, ConsumedThenNotConsumed) {
// A consumed touch's gesture should not be sent.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
// Even if the subsequent touch is not consumed, continue dropping gestures.
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
// Even if the subsequent touch had no consumer, continue dropping gestures.
SendPacket(ReleaseTouchPoint(), Gestures(ET_SCROLL_FLING_START));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
}
TEST_F(TouchDispositionGestureFilterTest, NotConsumedThenConsumed) {
// A not consumed touch's gesture should be sent.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
// A newly consumed gesture should not be sent.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_PINCH_BEGIN));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
// And subsequent non-consumed pinch updates should not be sent.
SendPacket(MoveTouchPoint(),
Gestures(ET_GESTURE_SCROLL_UPDATE, ET_GESTURE_PINCH_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_UPDATE),
GetAndResetSentGestures()));
// End events dispatched only when their start events were.
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_PINCH_END));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_SCROLL_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
}
@@ -375,23 +384,23 @@ TEST_F(TouchDispositionGestureFilterTest, NotConsumedThenConsumed) {
TEST_F(TouchDispositionGestureFilterTest, ScrollAlternatelyConsumed) {
// A consumed touch's gesture should not be sent.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
for (size_t i = 0; i < 3; ++i) {
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_UPDATE),
GetAndResetSentGestures()));
}
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_SCROLL_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
}
@@ -399,63 +408,63 @@ TEST_F(TouchDispositionGestureFilterTest, ScrollAlternatelyConsumed) {
TEST_F(TouchDispositionGestureFilterTest, NotConsumedThenNoConsumer) {
// An unconsumed touch's gesture should be sent.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
// If the subsequent touch has no consumer (e.g., a secondary pointer is
// pressed but not on a touch handling rect), send the gesture.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_PINCH_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_BEGIN),
GetAndResetSentGestures()));
// End events should be dispatched when their start events were, independent
// of the ack state.
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_PINCH_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_END),
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_SCROLL_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
}
TEST_F(TouchDispositionGestureFilterTest, EndingEventsSent) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_PINCH_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_BEGIN),
GetAndResetSentGestures()));
// Consuming the touchend event can't suppress the match end gesture.
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_PINCH_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_END),
GetAndResetSentGestures()));
// But other events in the same packet are still suppressed.
SendPacket(ReleaseTouchPoint(),
Gestures(ET_GESTURE_SCROLL_UPDATE, ET_GESTURE_SCROLL_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
// ET_GESTURE_SCROLL_END and ET_SCROLL_FLING_START behave the same in this
// regard.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_SCROLL_FLING_START));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_SCROLL_FLING_START),
GetAndResetSentGestures()));
}
@@ -463,107 +472,111 @@ TEST_F(TouchDispositionGestureFilterTest, EndingEventsSent) {
TEST_F(TouchDispositionGestureFilterTest, EndingEventsNotSent) {
// Consuming a begin event ensures no end events are sent.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_PINCH_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_PINCH_END));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_SCROLL_END));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
}
TEST_F(TouchDispositionGestureFilterTest, UpdateEventsSuppressedPerEvent) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
// Consuming a single scroll or pinch update should suppress only that event.
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_PINCH_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_BEGIN),
GetAndResetSentGestures()));
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_PINCH_UPDATE));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
// Subsequent updates should not be affected.
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_UPDATE),
GetAndResetSentGestures()));
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_PINCH_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_UPDATE),
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_PINCH_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_END),
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_SCROLL_END));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
}
TEST_F(TouchDispositionGestureFilterTest, UpdateEventsDependOnBeginEvents) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
// Scroll and pinch gestures depend on the scroll begin gesture being
// dispatched.
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_PINCH_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_PINCH_UPDATE));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_PINCH_END));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_SCROLL_END));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
}
TEST_F(TouchDispositionGestureFilterTest, MultipleTouchSequences) {
// Queue two touch-to-gestures sequences.
- SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_TAP));
- SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_SCROLL_END));
+ uint32 touch_press_event_id1 =
+ SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
+ uint32 touch_release_event_id1 =
+ SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_TAP));
+ uint32 touch_press_event_id2 =
+ SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
+ uint32 touch_release_event_id2 =
+ SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_SCROLL_END));
// The first gesture sequence should not be allowed.
- SendTouchConsumedAck();
- SendTouchNotConsumedAck();
+ SendTouchConsumedAck(touch_press_event_id1);
+ SendTouchNotConsumedAck(touch_release_event_id1);
EXPECT_FALSE(GesturesSent());
// The subsequent sequence should "reset" allowance.
- SendTouchNotConsumedAck();
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAck(touch_press_event_id2);
+ SendTouchNotConsumedAck(touch_release_event_id2);
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN,
ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
@@ -576,26 +589,26 @@ TEST_F(TouchDispositionGestureFilterTest, FlingCancelledOnNewTouchSequence) {
// Simulate a fling.
SendPacket(PressTouchPoint(),
Gestures(ET_GESTURE_TAP_DOWN, ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(
Gestures(
ET_GESTURE_TAP_DOWN, ET_GESTURE_TAP_CANCEL, ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_SCROLL_FLING_START));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_SCROLL_FLING_START),
GetAndResetSentGestures()));
// A new touch sequence should cancel the outstanding fling.
SendPacket(PressTouchPoint(1, 1), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_SCROLL_FLING_CANCEL),
GetAndResetSentGestures()));
EXPECT_EQ(CurrentTouchTime(), LastSentGestureTime());
EXPECT_EQ(LastSentGestureLocation(), gfx::PointF(1, 1));
EXPECT_EQ(LastSentGestureRawLocation(), gfx::PointF(1, 1) + raw_offset);
SendPacket(ReleaseTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
}
@@ -604,13 +617,13 @@ TEST_F(TouchDispositionGestureFilterTest, ScrollEndedOnTouchReleaseIfNoFling) {
// Touch position will be used for synthesized scroll end gesture.
SendPacket(PressTouchPoint(2, 3),
Gestures(ET_GESTURE_TAP_DOWN, ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(
Gestures(
ET_GESTURE_TAP_DOWN, ET_GESTURE_TAP_CANCEL, ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
EXPECT_EQ(CurrentTouchTime(), LastSentGestureTime());
@@ -621,7 +634,7 @@ TEST_F(TouchDispositionGestureFilterTest, ScrollEndedOnNewTouchSequence) {
// Simulate a scroll.
SendPacket(PressTouchPoint(),
Gestures(ET_GESTURE_TAP_DOWN, ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(
Gestures(
ET_GESTURE_TAP_DOWN, ET_GESTURE_TAP_CANCEL, ET_GESTURE_SCROLL_BEGIN),
@@ -632,7 +645,7 @@ TEST_F(TouchDispositionGestureFilterTest, ScrollEndedOnNewTouchSequence) {
// Touch position will be used for synthesized scroll end gesture.
SendPacket(PressTouchPoint(2, 3), NoGestures());
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
EXPECT_EQ(CurrentTouchTime(), LastSentGestureTime());
@@ -644,7 +657,7 @@ TEST_F(TouchDispositionGestureFilterTest, FlingCancelledOnScrollBegin) {
SendPacket(PressTouchPoint(),
Gestures(ET_GESTURE_TAP_DOWN, ET_GESTURE_SCROLL_BEGIN,
ET_SCROLL_FLING_START));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN,
ET_GESTURE_TAP_CANCEL,
ET_GESTURE_SCROLL_BEGIN,
@@ -654,7 +667,7 @@ TEST_F(TouchDispositionGestureFilterTest, FlingCancelledOnScrollBegin) {
// The new fling should cancel the preceding one.
SendPacket(ReleaseTouchPoint(),
Gestures(ET_GESTURE_SCROLL_BEGIN, ET_SCROLL_FLING_START));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_SCROLL_FLING_CANCEL,
ET_GESTURE_SCROLL_BEGIN,
ET_SCROLL_FLING_START),
@@ -664,13 +677,13 @@ TEST_F(TouchDispositionGestureFilterTest, FlingCancelledOnScrollBegin) {
TEST_F(TouchDispositionGestureFilterTest, FlingNotCancelledIfGFCEventReceived) {
// Simulate a fling that is started then cancelled.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
SendPacket(MoveTouchPoint(), Gestures(ET_SCROLL_FLING_START));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
GestureEventDataPacket packet;
packet.Push(CreateGesture(ET_SCROLL_FLING_CANCEL, 2, 3, 0));
SendTouchGestures(ReleaseTouchPoint(), packet);
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN,
ET_SCROLL_FLING_START,
ET_SCROLL_FLING_CANCEL),
@@ -680,21 +693,21 @@ TEST_F(TouchDispositionGestureFilterTest, FlingNotCancelledIfGFCEventReceived) {
// A new touch sequence will not inject a ET_SCROLL_FLING_CANCEL, as the fling
// has already been cancelled.
SendPacket(PressTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
SendPacket(ReleaseTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
}
TEST_F(TouchDispositionGestureFilterTest, TapCancelledWhenScrollBegins) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
// If the subsequent touch turns into a scroll, the tap should be cancelled.
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL,
ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
@@ -702,7 +715,7 @@ TEST_F(TouchDispositionGestureFilterTest, TapCancelledWhenScrollBegins) {
TEST_F(TouchDispositionGestureFilterTest, TapCancelledWhenTouchConsumed) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
@@ -711,7 +724,7 @@ TEST_F(TouchDispositionGestureFilterTest, TapCancelledWhenTouchConsumed) {
packet.Push(CreateGesture(ET_GESTURE_SCROLL_BEGIN, 2, 3, 0));
SendTouchGestures(MoveTouchPoint(), packet);
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(
GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL, ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
@@ -721,18 +734,18 @@ TEST_F(TouchDispositionGestureFilterTest, TapCancelledWhenTouchConsumed) {
TEST_F(TouchDispositionGestureFilterTest,
TapNotCancelledIfTapEndingEventReceived) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(
GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN), GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_TAP));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SHOW_PRESS, ET_GESTURE_TAP),
GetAndResetSentGestures()));
// The tap should not be cancelled as it was terminated by a |ET_GESTURE_TAP|.
SendPacket(PressTouchPoint(), NoGestures());
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
}
@@ -740,7 +753,7 @@ TEST_F(TouchDispositionGestureFilterTest, TimeoutGestures) {
// If the sequence is allowed, and there are no preceding gestures, the
// timeout gestures should be forwarded immediately.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
@@ -753,7 +766,7 @@ TEST_F(TouchDispositionGestureFilterTest, TimeoutGestures) {
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_LONG_TAP));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL,
ET_GESTURE_LONG_TAP),
GetAndResetSentGestures()));
@@ -761,13 +774,13 @@ TEST_F(TouchDispositionGestureFilterTest, TimeoutGestures) {
// If the sequence is disallowed, and there are no preceding gestures, the
// timeout gestures should be dropped immediately.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendTimeoutGesture(ET_GESTURE_SHOW_PRESS);
EXPECT_FALSE(GesturesSent());
SendPacket(ReleaseTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
// If the sequence has a pending ack, the timeout gestures should
// remain queued until the ack is received.
@@ -777,7 +790,7 @@ TEST_F(TouchDispositionGestureFilterTest, TimeoutGestures) {
SendTimeoutGesture(ET_GESTURE_LONG_PRESS);
EXPECT_FALSE(GesturesSent());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN,
ET_GESTURE_LONG_PRESS),
GetAndResetSentGestures()));
@@ -786,13 +799,15 @@ TEST_F(TouchDispositionGestureFilterTest, TimeoutGestures) {
TEST_F(TouchDispositionGestureFilterTest, SpuriousAcksIgnored) {
// Acks received when the queue is empty will be safely ignored.
ASSERT_TRUE(IsEmpty());
- SendTouchConsumedAck();
+ SendTouchConsumedAck(0);
EXPECT_FALSE(GesturesSent());
- SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAck();
- SendTouchNotConsumedAck();
+ uint32 touch_press_event_id =
+ SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
+ uint32 touch_move_event_id =
+ SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
+ SendTouchNotConsumedAck(touch_press_event_id);
+ SendTouchNotConsumedAck(touch_move_event_id);
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN,
ET_GESTURE_SCROLL_UPDATE),
GetAndResetSentGestures()));
@@ -801,7 +816,7 @@ TEST_F(TouchDispositionGestureFilterTest, SpuriousAcksIgnored) {
// there could be follow-up timeout events. Spurious acks in such cases
// should also be safely ignored.
ASSERT_FALSE(IsEmpty());
- SendTouchConsumedAck();
+ SendTouchConsumedAck(0);
EXPECT_FALSE(GesturesSent());
}
@@ -822,14 +837,14 @@ TEST_F(TouchDispositionGestureFilterTest, ConsumedTouchCancel) {
// An unconsumed touch's gesture should be sent.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
EXPECT_FALSE(GesturesSent());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
SendPacket(CancelTouchPoint(),
Gestures(ET_GESTURE_TAP_CANCEL, ET_GESTURE_SCROLL_END));
EXPECT_FALSE(GesturesSent());
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL,
ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
@@ -837,11 +852,11 @@ TEST_F(TouchDispositionGestureFilterTest, ConsumedTouchCancel) {
TEST_F(TouchDispositionGestureFilterTest, TimeoutEventAfterRelease) {
SendPacket(PressTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(ReleaseTouchPoint(),
Gestures(ET_GESTURE_TAP_DOWN, ET_GESTURE_TAP_UNCONFIRMED));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(
GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN, ET_GESTURE_TAP_UNCONFIRMED),
GetAndResetSentGestures()));
@@ -853,7 +868,7 @@ TEST_F(TouchDispositionGestureFilterTest, TimeoutEventAfterRelease) {
TEST_F(TouchDispositionGestureFilterTest, ShowPressInsertedBeforeTap) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
@@ -862,7 +877,7 @@ TEST_F(TouchDispositionGestureFilterTest, ShowPressInsertedBeforeTap) {
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_TAP));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SHOW_PRESS,
ET_GESTURE_TAP),
GetAndResetSentGestures()));
@@ -870,7 +885,7 @@ TEST_F(TouchDispositionGestureFilterTest, ShowPressInsertedBeforeTap) {
TEST_F(TouchDispositionGestureFilterTest, ShowPressNotInsertedIfAlreadySent) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
@@ -879,7 +894,7 @@ TEST_F(TouchDispositionGestureFilterTest, ShowPressNotInsertedIfAlreadySent) {
GetAndResetSentGestures()));
SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_TAP));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP),
GetAndResetSentGestures()));
}
@@ -889,13 +904,13 @@ TEST_F(TouchDispositionGestureFilterTest, TapAndScrollCancelledOnTouchCancel) {
SetRawTouchOffset(raw_offset);
SendPacket(PressTouchPoint(1, 1), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
// A cancellation motion event should cancel the tap.
SendPacket(CancelTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL),
GetAndResetSentGestures()));
EXPECT_EQ(CurrentTouchTime(), LastSentGestureTime());
@@ -903,14 +918,14 @@ TEST_F(TouchDispositionGestureFilterTest, TapAndScrollCancelledOnTouchCancel) {
EXPECT_EQ(LastSentGestureRawLocation(), gfx::PointF(1, 1) + raw_offset);
SendPacket(PressTouchPoint(1, 1), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
// A cancellation motion event should end the scroll, even if the touch was
// consumed.
SendPacket(CancelTouchPoint(), NoGestures());
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END),
GetAndResetSentGestures()));
EXPECT_EQ(CurrentTouchTime(), LastSentGestureTime());
@@ -923,14 +938,14 @@ TEST_F(TouchDispositionGestureFilterTest,
// A consumed touch's gesture should not be sent.
SendPacket(PressTouchPoint(),
Gestures(ET_GESTURE_BEGIN, ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(
GesturesMatch(Gestures(ET_GESTURE_BEGIN, ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
GestureEventDataPacket packet;
@@ -939,14 +954,14 @@ TEST_F(TouchDispositionGestureFilterTest,
packet.Push(CreateGesture(ET_GESTURE_END, 2, 3, 0));
SendTouchGestures(ReleaseTouchPoint(), packet);
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_END, ET_GESTURE_END),
GetAndResetSentGestures()));
EXPECT_EQ(LastSentGestureLocation(), gfx::PointF(2, 3));
SendPacket(PressTouchPoint(),
Gestures(ET_GESTURE_BEGIN, ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_BEGIN, ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
}
@@ -954,13 +969,13 @@ TEST_F(TouchDispositionGestureFilterTest,
TEST_F(TouchDispositionGestureFilterTest, TapCancelledOnTouchCancel) {
// Touch position is used for synthesized tap cancel.
SendPacket(PressTouchPoint(2, 3), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
// A cancellation motion event should cancel the tap.
SendPacket(CancelTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL),
GetAndResetSentGestures()));
EXPECT_EQ(CurrentTouchTime(), LastSentGestureTime());
@@ -973,7 +988,7 @@ TEST_F(TouchDispositionGestureFilterTest, TestCancelMidGesture) {
SetCancelAfterNextGesture(true);
// Synthesized tap cancel uses touch position.
SendPacket(PressTouchPoint(1, 1), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN,
ET_GESTURE_TAP_CANCEL),
GetAndResetSentGestures()));
@@ -983,17 +998,17 @@ TEST_F(TouchDispositionGestureFilterTest, TestCancelMidGesture) {
// Test that a MultiFingerSwipe event is dispatched when appropriate.
TEST_F(TouchDispositionGestureFilterTest, TestAllowedMultiFingerSwipe) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_PINCH_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_BEGIN),
GetAndResetSentGestures()));
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SWIPE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SWIPE),
GetAndResetSentGestures()));
}
@@ -1001,31 +1016,31 @@ TEST_F(TouchDispositionGestureFilterTest, TestAllowedMultiFingerSwipe) {
// Test that a MultiFingerSwipe event is dispatched when appropriate.
TEST_F(TouchDispositionGestureFilterTest, TestDisallowedMultiFingerSwipe) {
SendPacket(PressTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
GetAndResetSentGestures()));
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_PINCH_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_BEGIN),
GetAndResetSentGestures()));
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_SWIPE));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
}
TEST_F(TouchDispositionGestureFilterTest, TapCancelOnSecondFingerDown) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
SendPacket(PressTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL),
GetAndResetSentGestures()));
}
@@ -1035,7 +1050,7 @@ TEST_F(TouchDispositionGestureFilterTest, ShowPressBoundingBox) {
press_packet.Push(CreateGesture(ET_GESTURE_TAP_DOWN, 9, 9, 8));
SendTouchGestures(PressTouchPoint(), press_packet);
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(
GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN), GetAndResetSentGestures()));
@@ -1043,7 +1058,7 @@ TEST_F(TouchDispositionGestureFilterTest, ShowPressBoundingBox) {
release_packet.Push(CreateGesture(ET_GESTURE_TAP, 10, 10, 10));
SendTouchGestures(ReleaseTouchPoint(), release_packet);
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SHOW_PRESS, ET_GESTURE_TAP),
GetAndResetSentGestures()));
EXPECT_EQ(gfx::RectF(5, 5, 10, 10), ShowPressBoundingBox());
@@ -1052,7 +1067,7 @@ TEST_F(TouchDispositionGestureFilterTest, ShowPressBoundingBox) {
TEST_F(TouchDispositionGestureFilterTest, TapCancelledBeforeGestureEnd) {
SendPacket(PressTouchPoint(),
Gestures(ET_GESTURE_BEGIN, ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_BEGIN, ET_GESTURE_TAP_DOWN),
GetAndResetSentGestures()));
SendTimeoutGesture(ET_GESTURE_SHOW_PRESS);
@@ -1063,7 +1078,7 @@ TEST_F(TouchDispositionGestureFilterTest, TapCancelledBeforeGestureEnd) {
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_LONG_PRESS),
GetAndResetSentGestures()));
SendPacket(CancelTouchPoint(), Gestures(ET_GESTURE_END));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL, ET_GESTURE_END),
GetAndResetSentGestures()));
}
@@ -1071,14 +1086,14 @@ TEST_F(TouchDispositionGestureFilterTest, TapCancelledBeforeGestureEnd) {
TEST_F(TouchDispositionGestureFilterTest, EventFlagPropagation) {
// Real gestures should propagate flags from their causal touches.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_TAP_DOWN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(
GesturesMatch(Gestures(ET_GESTURE_TAP_DOWN), GetAndResetSentGestures()));
EXPECT_EQ(kDefaultEventFlags, LastSentGestureFlags());
// Synthetic gestures lack flags.
SendPacket(PressTouchPoint(), NoGestures());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL),
GetAndResetSentGestures()));
EXPECT_EQ(0, LastSentGestureFlags());
@@ -1088,32 +1103,32 @@ TEST_F(TouchDispositionGestureFilterTest, EventFlagPropagation) {
TEST_F(TouchDispositionGestureFilterTest, PreviousScrollPrevented) {
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_BEGIN));
EXPECT_FALSE(GesturesSent());
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
EXPECT_TRUE(
GesturesMatch(Gestures(ET_GESTURE_BEGIN), GetAndResetSentGestures()));
// The sent scroll update should always reflect whether any preceding scroll
// update has been dropped.
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
ASSERT_TRUE(GesturesSent());
EXPECT_FALSE(last_sent_gesture()
.details.previous_scroll_update_in_sequence_prevented());
GetAndResetSentGestures();
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchConsumedAck();
+ SendTouchConsumedAckForLastTouch();
EXPECT_FALSE(GesturesSent());
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
ASSERT_TRUE(GesturesSent());
EXPECT_TRUE(last_sent_gesture()
.details.previous_scroll_update_in_sequence_prevented());
GetAndResetSentGestures();
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
ASSERT_TRUE(GesturesSent());
EXPECT_TRUE(last_sent_gesture()
.details.previous_scroll_update_in_sequence_prevented());
@@ -1121,27 +1136,27 @@ TEST_F(TouchDispositionGestureFilterTest, PreviousScrollPrevented) {
TEST_F(TouchDispositionGestureFilterTest, AckQueueBack) {
SendPacket(PressTouchPoint(1, 1), Gestures(ET_GESTURE_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_BEGIN));
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAckForLastTouch();
GetAndResetSentGestures();
// Pending touch move.
GestureEventDataPacket packet1;
packet1.Push(CreateGesture(ET_GESTURE_SCROLL_UPDATE, 2, 3, 0));
- SendTouchGestures(MoveTouchPoint(), packet1);
+ uint32 touch_event_id = SendTouchGestures(MoveTouchPoint(), packet1);
EXPECT_FALSE(GesturesSent());
// Additional pending touch move.
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
// Ack back of the queue consumed.
- SendTouchConsumedAckForQueueBack();
+ SendTouchConsumedAckForLastTouch();
// Ack the pending touch.
GetAndResetSentGestures();
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAck(touch_event_id);
// The consumed touch doesn't produce a gesture.
EXPECT_TRUE(GesturesMatch(
@@ -1150,23 +1165,24 @@ TEST_F(TouchDispositionGestureFilterTest, AckQueueBack) {
EXPECT_EQ(gfx::PointF(2, 3), LastSentGestureLocation());
// Pending touch move.
- SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
+ touch_event_id =
+ SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
EXPECT_FALSE(GesturesSent());
// Ack back of the queue unconsumed (twice).
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAckForQueueBack();
+ SendTouchNotConsumedAckForLastTouch();
GestureEventDataPacket packet2;
packet2.Push(CreateGesture(ET_GESTURE_SCROLL_UPDATE, 7, 8, 0));
SendTouchGestures(MoveTouchPoint(), packet2);
EXPECT_FALSE(GesturesSent());
- SendTouchNotConsumedAckForQueueBack();
+ SendTouchNotConsumedAckForLastTouch();
// Ack the pending touch.
GetAndResetSentGestures();
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAck(touch_event_id);
// Both touches have now been acked.
EXPECT_TRUE(
@@ -1178,23 +1194,25 @@ TEST_F(TouchDispositionGestureFilterTest, AckQueueBack) {
TEST_F(TouchDispositionGestureFilterTest, AckQueueGestureAtBack) {
// Send gesture sequence
- SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_BEGIN));
- SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_END));
+ uint32 touch_press_event_id1 =
+ SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_BEGIN));
+ uint32 touch_release_event_id1 =
+ SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_END));
// Send second gesture sequence, and synchronously ack it.
SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_BEGIN));
- SendTouchNotConsumedAckForQueueBack();
+ SendTouchNotConsumedAckForLastTouch();
GestureEventDataPacket packet;
packet.Push(CreateGesture(ET_GESTURE_END, 2, 3, 0));
SendTouchGestures(ReleaseTouchPoint(), packet);
- SendTouchNotConsumedAckForQueueBack();
+ SendTouchNotConsumedAckForLastTouch();
// The second gesture sequence is blocked on the first.
EXPECT_FALSE(GesturesSent());
- SendTouchNotConsumedAck();
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAck(touch_press_event_id1);
+ SendTouchNotConsumedAck(touch_release_event_id1);
// Both gestures have now been acked.
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_BEGIN, ET_GESTURE_END,
@@ -1206,28 +1224,30 @@ TEST_F(TouchDispositionGestureFilterTest, AckQueueGestureAtBack) {
TEST_F(TouchDispositionGestureFilterTest,
SyncAcksOnlyTriggerAppropriateGestures) {
// Queue a touch press.
- SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_BEGIN));
+ uint32 touch_press_event_id =
+ SendPacket(PressTouchPoint(), Gestures(ET_GESTURE_BEGIN));
// Send and synchronously ack two touch moves.
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAckForQueueBack();
+ SendTouchNotConsumedAckForLastTouch();
SendPacket(MoveTouchPoint(), Gestures(ET_GESTURE_SCROLL_UPDATE));
- SendTouchNotConsumedAckForQueueBack();
+ SendTouchNotConsumedAckForLastTouch();
// Queue a touch release.
- SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_END));
+ uint32 touch_release_event_id =
+ SendPacket(ReleaseTouchPoint(), Gestures(ET_GESTURE_END));
EXPECT_FALSE(GesturesSent());
// Ack the touch press. All events but the release should be acked.
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAck(touch_press_event_id);
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_BEGIN, ET_GESTURE_SCROLL_UPDATE,
ET_GESTURE_SCROLL_UPDATE),
GetAndResetSentGestures()));
// The touch release still requires an ack.
- SendTouchNotConsumedAck();
+ SendTouchNotConsumedAck(touch_release_event_id);
EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_END),
GetAndResetSentGestures()));
}