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

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: Tweak include for moved synthetic_web_input_event_builders.h Created 7 years 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
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.cc ('k') | content/common/input/touch_action.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3e756566eda2d0b852c2cc7d012f7181a5901a3c..3780ae8dd5995778b8c767aefb816db95f7d0d77 100644
--- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc
+++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc
@@ -127,6 +127,10 @@ class TouchEventQueueTest : public testing::Test,
return count;
}
+ bool IsPendingAckTouchStart() const {
+ return queue_->IsPendingAckTouchStart();
+ }
+
void Flush() {
queue_->FlushQueue();
}
@@ -836,4 +840,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
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.cc ('k') | content/common/input/touch_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698