| Index: content/browser/renderer_host/input/input_router_impl_unittest.cc
|
| diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc
|
| index 7655f222f4d45cafeb7fe26aff3480d76708fff5..bdd293746df5b4a51976a4d8dea4f1798a6ba725 100644
|
| --- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
|
| +++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
|
| @@ -167,6 +167,18 @@ class InputRouterImplTest : public testing::Test {
|
| browser_context_.reset();
|
| }
|
|
|
| + void SetUpForGestureBasedWheelScrolling(bool enabled) {
|
| + CHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kDisableWheelGestures) &&
|
| + !base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableWheelGestures));
|
| + base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
| + enabled ? switches::kEnableWheelGestures
|
| + : switches::kDisableWheelGestures);
|
| + TearDown();
|
| + SetUp();
|
| + }
|
| +
|
| void SetUpForTouchAckTimeoutTest(int desktop_timeout_ms,
|
| int mobile_timeout_ms) {
|
| config_.touch_config.desktop_touch_ack_timeout_delay =
|
| @@ -936,6 +948,8 @@ TEST_F(InputRouterImplTest, AckedTouchEventState) {
|
| #endif // defined(USE_AURA)
|
|
|
| TEST_F(InputRouterImplTest, UnhandledWheelEvent) {
|
| + SetUpForGestureBasedWheelScrolling(false);
|
| +
|
| // Simulate wheel events.
|
| SimulateWheelEvent(0, 0, 0, -5, 0, false); // sent directly
|
| SimulateWheelEvent(0, 0, 0, -10, 0, false); // enqueued
|
| @@ -959,8 +973,49 @@ TEST_F(InputRouterImplTest, UnhandledWheelEvent) {
|
| InputMsg_HandleInputEvent::ID));
|
| EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
|
|
|
| + // Indicate that the wheel event was unhandled.
|
| + SendInputEventACK(WebInputEvent::MouseWheel,
|
| + INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| +
|
| // Check that the correct unhandled wheel event was received.
|
| + EXPECT_EQ(1U, ack_handler_->GetAndResetAckCount());
|
| + EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, ack_handler_->ack_state());
|
| + EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -10);
|
| +}
|
| +
|
| +TEST_F(InputRouterImplTest, UnhandledWheelEventWithGestureScrolling) {
|
| + SetUpForGestureBasedWheelScrolling(true);
|
| +
|
| + // Simulate wheel events.
|
| + SimulateWheelEvent(0, 0, 0, -5, 0, false); // sent directly
|
| + SimulateWheelEvent(0, 0, 0, -10, 0, false); // enqueued
|
| +
|
| + // Check that only the first event was sent.
|
| + EXPECT_TRUE(
|
| + process_->sink().GetUniqueMessageMatching(InputMsg_HandleInputEvent::ID));
|
| + EXPECT_EQ(1U, GetSentMessageCountAndResetSink());
|
| +
|
| + // Indicate that the wheel event was unhandled.
|
| + SendInputEventACK(WebInputEvent::MouseWheel,
|
| + INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| +
|
| + // Check that the ack for the MouseWheel and ScrollBegin
|
| + // were processed.
|
| + EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
|
| +
|
| + // There should be a ScrollBegin and ScrollUpdate, MouseWheel sent
|
| + EXPECT_EQ(3U, GetSentMessageCountAndResetSink());
|
| +
|
| EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -5);
|
| + SendInputEventACK(WebInputEvent::GestureScrollUpdate,
|
| + INPUT_EVENT_ACK_STATE_CONSUMED);
|
| + SendInputEventACK(WebInputEvent::MouseWheel,
|
| + INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
|
| +
|
| + // Check that the correct unhandled wheel event was received.
|
| + EXPECT_EQ(2U, ack_handler_->GetAndResetAckCount());
|
| + EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED, ack_handler_->ack_state());
|
| + EXPECT_EQ(ack_handler_->acked_wheel_event().deltaY, -10);
|
| }
|
|
|
| TEST_F(InputRouterImplTest, TouchTypesIgnoringAck) {
|
|
|