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

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

Issue 67383002: Initial browser-side implementation for touch-action (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update for new blink API - no touch ID for now Created 7 years, 1 month 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_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..d7348555221c59ad87506ad3c692ba87f0e21396 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() const {
+ return queue_->IsPendingAckTouchStart();
+ }
+
void Flush() {
queue_->FlushQueue();
}
@@ -780,4 +784,54 @@ TEST_F(TouchEventQueueTest, NoTouchOnScroll) {
EXPECT_EQ(1U, GetAndResetAckedEventCount());
}
+// Tests that IsTouchStartPendingAck works correctly.
+TEST_F(TouchEventQueueTest, PendingStart) {
+
+ EXPECT_FALSE(IsPendingAckTouchStart());
+
+ // Send the touchstart for one point (#1).
+ PressTouchPoint(1, 1);
+ SendTouchEvent();
+ EXPECT_EQ(1U, queued_event_count());
+ EXPECT_TRUE(IsPendingAckTouchStart());
+
+ // Send a touchmove for that point (#2).
+ MoveTouchPoint(0, 5, 5);
+ SendTouchEvent();
+ EXPECT_EQ(2U, queued_event_count());
+ EXPECT_TRUE(IsPendingAckTouchStart());
+
+ // Ack the touchstart (#1).
+ SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ EXPECT_EQ(1U, queued_event_count());
+ EXPECT_FALSE(IsPendingAckTouchStart());
+
+ // Send a touchstart for another point (#3).
+ PressTouchPoint(10, 10);
+ SendTouchEvent();
+ EXPECT_EQ(2U, queued_event_count());
+ EXPECT_FALSE(IsPendingAckTouchStart());
+
+ // Ack the touchmove (#2).
+ SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ EXPECT_EQ(1U, queued_event_count());
+ EXPECT_TRUE(IsPendingAckTouchStart());
+
+ // Send a touchstart for a third point (#4).
+ PressTouchPoint(15, 15);
+ SendTouchEvent();
+ EXPECT_EQ(2U, queued_event_count());
+ EXPECT_TRUE(IsPendingAckTouchStart());
+
+ // Ack the touchstart for the second point (#3).
+ SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ EXPECT_EQ(1U, queued_event_count());
+ EXPECT_TRUE(IsPendingAckTouchStart());
+
+ // Ack the touchstart for the third point (#4).
+ SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
+ EXPECT_EQ(0U, queued_event_count());
+ EXPECT_FALSE(IsPendingAckTouchStart());
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698