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

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

Issue 235003005: Consolidate all touch/gesture related constants in content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 8 months 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/gesture_event_queue_unittest.cc
diff --git a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
index 412dae9255619583f8cf8e9b56e01177c44a7eee..af97bd2174348dca3b89d4aeb24219a211be6330 100644
--- a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
+++ b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc
@@ -34,7 +34,7 @@ class GestureEventQueueTest : public testing::Test,
// testing::Test
virtual void SetUp() OVERRIDE {
- queue_.reset(new GestureEventQueue(this, this));
+ queue_.reset(new GestureEventQueue(this, this, DefaultConfig()));
}
virtual void TearDown() OVERRIDE {
@@ -68,6 +68,16 @@ class GestureEventQueueTest : public testing::Test,
}
protected:
+ static GestureEventQueue::Config DefaultConfig() {
+ return GestureEventQueue::Config();
+ }
+
+ void SetUpForDebounce(int interval_ms) {
+ GestureEventQueue::Config config = DefaultConfig();
+ config.enable_debounce_during_scroll = true;
+ config.debounce_interval = base::TimeDelta::FromMilliseconds(interval_ms);
+ queue_.reset(new GestureEventQueue(this, this, config));
+ }
// Returns the result of |GestureEventQueue::ShouldForward()|.
bool SimulateGestureEvent(const WebGestureEvent& gesture) {
@@ -137,14 +147,6 @@ class GestureEventQueueTest : public testing::Test,
return last_acked_event_;
}
- void DisableDebounce() {
- queue()->set_debounce_enabled_for_testing(false);
- }
-
- void set_debounce_interval_time_ms(int ms) {
- queue()->set_debounce_interval_time_ms_for_testing(ms);
- }
-
void set_synchronous_ack(InputEventAckState ack_result) {
sync_ack_result_.reset(new InputEventAckState(ack_result));
}
@@ -211,9 +213,6 @@ class GestureEventQueueWithSourceTest
#endif // GTEST_HAS_PARAM_TEST
TEST_F(GestureEventQueueTest, CoalescesScrollGestureEvents) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
// Test coalescing of only GestureScrollUpdate events.
// Simulate gesture events.
@@ -289,9 +288,6 @@ TEST_F(GestureEventQueueTest, CoalescesScrollGestureEvents) {
TEST_F(GestureEventQueueTest,
DoesNotCoalesceScrollGestureEventsFromDifferentDevices) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
// Test that GestureScrollUpdate events from Touchscreen and Touchpad do not
// coalesce.
@@ -336,9 +332,6 @@ TEST_F(GestureEventQueueTest,
}
TEST_F(GestureEventQueueTest, CoalescesScrollAndPinchEvents) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
// Test coalescing of only GestureScrollUpdate events.
// Simulate gesture events.
@@ -571,9 +564,6 @@ TEST_F(GestureEventQueueTest, CoalescesScrollAndPinchEvents) {
}
TEST_F(GestureEventQueueTest, CoalescesMultiplePinchEventSequences) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
// Simulate a pinch sequence.
SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
WebGestureEvent::Touchscreen);
@@ -664,9 +654,6 @@ TEST_F(GestureEventQueueTest, CoalescesMultiplePinchEventSequences) {
}
TEST_F(GestureEventQueueTest, CoalescesPinchSequencesWithEarlyAck) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
WebGestureEvent::Touchscreen);
SendInputEventACK(WebInputEvent::GestureScrollBegin,
@@ -730,9 +717,6 @@ TEST_F(GestureEventQueueTest, CoalescesPinchSequencesWithEarlyAck) {
TEST_F(GestureEventQueueTest,
DoesNotCoalescePinchGestureEventsWithDifferentModifiers) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
// Insert an event to force queueing of gestures.
SimulateGestureEvent(WebInputEvent::GestureTapCancel,
WebGestureEvent::Touchscreen);
@@ -796,9 +780,6 @@ TEST_F(GestureEventQueueTest,
}
TEST_F(GestureEventQueueTest, CoalescesScrollAndPinchEventsIdentity) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
// Insert an event to force queueing of gestures.
SimulateGestureEvent(WebInputEvent::GestureTapCancel,
WebGestureEvent::Touchscreen);
@@ -913,9 +894,6 @@ TEST_F(GestureEventQueueTest, SyncAckQueuesEvent) {
// Tests an event with an async ack followed by an event with a sync ack.
TEST_F(GestureEventQueueTest, AsyncThenSyncAck) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
SimulateGestureEvent(WebInputEvent::GestureTapDown,
WebGestureEvent::Touchscreen);
@@ -938,9 +916,6 @@ TEST_F(GestureEventQueueTest, AsyncThenSyncAck) {
}
TEST_F(GestureEventQueueTest, CoalescesScrollAndPinchEventWithSyncAck) {
- // Turn off debounce handling for test isolation.
- DisableDebounce();
-
// Simulate a pinch sequence.
SimulateGestureEvent(WebInputEvent::GestureScrollBegin,
WebGestureEvent::Touchscreen);
@@ -987,8 +962,6 @@ TEST_F(GestureEventQueueTest, CoalescesScrollAndPinchEventWithSyncAck) {
TEST_P(GestureEventQueueWithSourceTest, GestureFlingCancelsFiltered) {
WebGestureEvent::SourceDevice source_device = GetParam();
- // Turn off debounce handling for test isolation.
- DisableDebounce();
// GFC without previous GFS is dropped.
SimulateGestureEvent(WebInputEvent::GestureFlingCancel, source_device);
EXPECT_EQ(0U, GetAndResetSentGestureEventCount());
@@ -1084,7 +1057,7 @@ INSTANTIATE_TEST_CASE_P(AllSources,
// debounce interval, that Scrolls are not and that the deferred events are
// sent after that timer fires.
TEST_F(GestureEventQueueTest, DebounceDefersFollowingGestureEvents) {
- set_debounce_interval_time_ms(3);
+ SetUpForDebounce(3);
SimulateGestureEvent(WebInputEvent::GestureScrollUpdate,
WebGestureEvent::Touchscreen);
@@ -1147,7 +1120,8 @@ TEST_F(GestureEventQueueTest, DebounceDefersFollowingGestureEvents) {
// interval and are discarded if a GestureScrollUpdate event arrives before the
// interval end.
TEST_F(GestureEventQueueTest, DebounceDropsDeferredEvents) {
- set_debounce_interval_time_ms(3);
+ SetUpForDebounce(3);
+
EXPECT_FALSE(ScrollingInProgress());
SimulateGestureEvent(WebInputEvent::GestureScrollUpdate,

Powered by Google App Engine
This is Rietveld 408576698