| Index: content/browser/renderer_host/input/touch_event_queue_unittest.cc
|
| diff --git a/content/browser/renderer_host/input/touch_event_queue_unittest.cc b/content/browser/renderer_host/input/touch_event_queue_unittest.cc
|
| index c57cbbe40d42f940d11e0d5bce03ae9aa8c720a2..0ea5ba3d77060f22ecd417b24c169bf1f53f76ef 100644
|
| --- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc
|
| +++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc
|
| @@ -117,6 +117,10 @@ class TouchEventQueueTest : public testing::Test,
|
| return count;
|
| }
|
|
|
| + bool IsPendingAckTouchStart(int touch_id) const {
|
| + return queue_->IsPendingAckTouchStart(touch_id);
|
| + }
|
| +
|
| void Flush() {
|
| queue_->FlushQueue();
|
| }
|
| @@ -780,4 +784,66 @@ TEST_F(TouchEventQueueTest, NoTouchOnScroll) {
|
| EXPECT_EQ(1U, GetAndResetAckedEventCount());
|
| }
|
|
|
| +// Tests that IsTouchStartPendingAck works correctly.
|
| +TEST_F(TouchEventQueueTest, PendingStart) {
|
| +
|
| + EXPECT_FALSE(IsPendingAckTouchStart(0));
|
| +
|
| + // Send the touchstart for id 0.
|
| + PressTouchPoint(1, 1);
|
| + SendTouchEvent();
|
| + EXPECT_EQ(1U, queued_event_count());
|
| + EXPECT_TRUE(IsPendingAckTouchStart(0));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(1));
|
| +
|
| + // Send a touchmove for id 0.
|
| + MoveTouchPoint(0, 5, 5);
|
| + SendTouchEvent();
|
| + EXPECT_EQ(2U, queued_event_count());
|
| + EXPECT_TRUE(IsPendingAckTouchStart(0));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(1));
|
| +
|
| + // Ack the touchstart for id 0.
|
| + SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| + EXPECT_EQ(1U, queued_event_count());
|
| + EXPECT_FALSE(IsPendingAckTouchStart(0));
|
| +
|
| + // Send a touchstart for id 1.
|
| + PressTouchPoint(10, 10);
|
| + SendTouchEvent();
|
| + EXPECT_EQ(2U, queued_event_count());
|
| + EXPECT_FALSE(IsPendingAckTouchStart(0));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(1));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(2));
|
| +
|
| + // Ack the touchmove for id 0.
|
| + SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| + EXPECT_EQ(1U, queued_event_count());
|
| + EXPECT_FALSE(IsPendingAckTouchStart(0));
|
| + EXPECT_TRUE(IsPendingAckTouchStart(1));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(2));
|
| +
|
| + // Send a touchstart for id 2.
|
| + PressTouchPoint(15, 15);
|
| + SendTouchEvent();
|
| + EXPECT_EQ(2U, queued_event_count());
|
| + EXPECT_FALSE(IsPendingAckTouchStart(0));
|
| + EXPECT_TRUE(IsPendingAckTouchStart(1));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(2));
|
| +
|
| + // Ack the touchstart for id 1.
|
| + SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| + EXPECT_EQ(1U, queued_event_count());
|
| + EXPECT_FALSE(IsPendingAckTouchStart(0));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(1));
|
| + EXPECT_TRUE(IsPendingAckTouchStart(2));
|
| +
|
| + // Ack the touchstart for id 2.
|
| + SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| + EXPECT_EQ(0U, queued_event_count());
|
| + EXPECT_FALSE(IsPendingAckTouchStart(0));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(1));
|
| + EXPECT_FALSE(IsPendingAckTouchStart(2));
|
| +}
|
| +
|
| } // namespace content
|
|
|