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 2ced9d9253ffdb79bd31a8987068b8b2d89c8a29..227e191a93ddbc06e395e49167fb801126c4ee83 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc |
+++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc |
@@ -28,14 +28,20 @@ class TouchEventQueueTest : public testing::Test, |
TouchEventQueueTest() |
: sent_event_count_(0), |
acked_event_count_(0), |
- last_acked_event_state_(INPUT_EVENT_ACK_STATE_UNKNOWN) {} |
+ last_acked_event_state_(INPUT_EVENT_ACK_STATE_UNKNOWN), |
+ touch_scrolling_mode_(TouchEventQueue::TOUCH_SCROLLING_MODE_DEFAULT), |
+ slop_length_dips_(0) {} |
virtual ~TouchEventQueueTest() {} |
// testing::Test |
virtual void SetUp() OVERRIDE { |
- queue_.reset(new TouchEventQueue(this, 0)); |
- queue_->OnHasTouchEventHandlers(true); |
+ ResetQueueWithParameters(touch_scrolling_mode_, slop_length_dips_); |
+ } |
+ |
+ virtual void SetTouchScrollingMode(TouchEventQueue::TouchScrollingMode mode) { |
+ touch_scrolling_mode_ = mode; |
+ ResetQueueWithParameters(touch_scrolling_mode_, slop_length_dips_); |
} |
virtual void TearDown() OVERRIDE { |
@@ -78,8 +84,8 @@ class TouchEventQueueTest : public testing::Test, |
} |
void SetUpForTouchMoveSlopTesting(double slop_length_dips) { |
- queue_.reset(new TouchEventQueue(this, slop_length_dips)); |
- queue_->OnHasTouchEventHandlers(true); |
+ slop_length_dips_ = slop_length_dips; |
+ ResetQueueWithParameters(touch_scrolling_mode_, slop_length_dips_); |
} |
void SendTouchEvent(const WebTouchEvent& event) { |
@@ -185,6 +191,12 @@ class TouchEventQueueTest : public testing::Test, |
touch_event_.ResetPoints(); |
} |
+ void ResetQueueWithParameters(TouchEventQueue::TouchScrollingMode mode, |
+ double slop_length_dips) { |
+ queue_.reset(new TouchEventQueue(this, mode, slop_length_dips)); |
+ queue_->OnHasTouchEventHandlers(true); |
+ } |
+ |
scoped_ptr<TouchEventQueue> queue_; |
size_t sent_event_count_; |
size_t acked_event_count_; |
@@ -195,6 +207,8 @@ class TouchEventQueueTest : public testing::Test, |
scoped_ptr<WebTouchEvent> followup_touch_event_; |
scoped_ptr<WebGestureEvent> followup_gesture_event_; |
scoped_ptr<InputEventAckState> sync_ack_result_; |
+ double slop_length_dips_; |
+ TouchEventQueue::TouchScrollingMode touch_scrolling_mode_; |
base::MessageLoopForUI message_loop_; |
}; |
@@ -1394,4 +1408,55 @@ TEST_F(TouchEventQueueTest, NoTouchMoveSuppressionAfterMultiTouch) { |
EXPECT_EQ(0U, GetAndResetAckedEventCount()); |
} |
+//TEST_F(TouchEventQueueTest, SyncTouchMoveDoesntCancelTouchOnScroll) { |
+// SetTouchScrollingMode(TouchEventQueue::TOUCH_SCROLLING_MODE_SYNC_TOUCHMOVE); |
+// // Queue a TouchStart. |
+// PressTouchPoint(0, 1); |
+// EXPECT_EQ(1U, GetAndResetSentEventCount()); |
+// SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+// EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
+// |
+// MoveTouchPoint(0, 20, 5); |
+// EXPECT_EQ(1U, queued_event_count()); |
+// EXPECT_EQ(1U, GetAndResetSentEventCount()); |
+// |
+// // GestureScrollBegin doesn't insert a synthetic TouchCancel. |
+// WebGestureEvent followup_scroll; |
+// followup_scroll.type = WebInputEvent::GestureScrollBegin; |
+// SetFollowupEvent(followup_scroll); |
+// SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+// EXPECT_EQ(0U, GetAndResetSentEventCount()); |
+// EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
+// EXPECT_EQ(0U, queued_event_count()); |
+//} |
+// |
+//TEST_F(TouchEventQueueTest, TouchAbsorption) { |
+// SetTouchScrollingMode( |
+// TouchEventQueue::TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE); |
+// // Queue a TouchStart. |
+// PressTouchPoint(0, 1); |
+// EXPECT_EQ(1U, GetAndResetSentEventCount()); |
+// SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+// EXPECT_EQ(1U, GetAndResetAckedEventCount()); |
+// |
+// for (int i = 0; i < 3; ++i) { |
+// SendGestureEventACK(WebInputEvent::GestureScrollUpdate, |
+// INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+// |
+// MoveTouchPoint(0, 20, 5); |
+// SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+// EXPECT_EQ(0U, queued_event_count()); |
+// EXPECT_EQ(1U, GetAndResetSentEventCount()); |
+// |
+// // Consuming a scroll event prevents the next touch moves from being |
+// // dispatched. |
+// SendGestureEventACK(WebInputEvent::GestureScrollUpdate, |
+// INPUT_EVENT_ACK_STATE_CONSUMED); |
+// MoveTouchPoint(0, 20, 5); |
+// SendTouchEventACK(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); |
+// EXPECT_EQ(0U, queued_event_count()); |
+// EXPECT_EQ(0U, GetAndResetSentEventCount()); |
+// } |
+//} |
+ |
} // namespace content |