| 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 deb16ec308a28da422e71a30ac033c48aa849504..84bc82d86eb4dd24cc1496299f2093a378c46a12 100644
|
| --- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
|
| +++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
|
| @@ -170,6 +170,18 @@
|
| 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 =
|
| @@ -935,6 +947,44 @@
|
| #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
|
| +
|
| + // 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 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, -5);
|
| +
|
| + // Check that the second 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 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
|
|
|