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

Unified Diff: ui/events/blink/input_handler_proxy_unittest.cc

Issue 2050033002: Revert of Remove enable/disable wheel gestures setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@can_scroll_remove
Patch Set: Created 4 years, 6 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
« no previous file with comments | « ui/events/blink/input_handler_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/blink/input_handler_proxy_unittest.cc
diff --git a/ui/events/blink/input_handler_proxy_unittest.cc b/ui/events/blink/input_handler_proxy_unittest.cc
index fbb5dddeba5a2f985936e50865c8870545ac2d72..c14d13f4f225a61601c3429f1a485368dbd90f06 100644
--- a/ui/events/blink/input_handler_proxy_unittest.cc
+++ b/ui/events/blink/input_handler_proxy_unittest.cc
@@ -385,6 +385,10 @@
input_handler_->smooth_scroll_enabled_ = value;
}
+ void SetMouseWheelGesturesOn(bool value) {
+ input_handler_->set_use_gesture_events_for_mouse_wheel(value);
+ }
+
base::HistogramTester& histogram_tester() {
return histogram_tester_;
}
@@ -404,6 +408,28 @@
cc::InputHandlerScrollResult scroll_result_did_not_scroll_;
};
+TEST_P(InputHandlerProxyTest, MouseWheelByPageMainThread) {
+ expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
+ SetMouseWheelGesturesOn(false);
+ WebMouseWheelEvent wheel;
+ wheel.type = WebInputEvent::MouseWheel;
+ wheel.scrollByPage = true;
+
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
+ VERIFY_AND_RESET_MOCKS();
+}
+
+TEST_P(InputHandlerProxyTest, MouseWheelWithCtrlNotScroll) {
+ expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
+ SetMouseWheelGesturesOn(false);
+ WebMouseWheelEvent wheel;
+ wheel.type = WebInputEvent::MouseWheel;
+ wheel.modifiers = WebInputEvent::ControlKey;
+ wheel.canScroll = false;
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
+ VERIFY_AND_RESET_MOCKS();
+}
+
TEST_P(InputHandlerProxyTest, MouseWheelNoListener) {
expected_disposition_ = InputHandlerProxy::DROP_EVENT;
EXPECT_CALL(mock_input_handler_,
@@ -439,6 +465,59 @@
WebMouseWheelEvent wheel;
wheel.type = WebInputEvent::MouseWheel;
wheel.modifiers = WebInputEvent::ControlKey;
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
+ VERIFY_AND_RESET_MOCKS();
+}
+
+// Mac does not smooth scroll wheel events (crbug.com/574283).
+#if !defined(OS_MACOSX)
+TEST_P(InputHandlerProxyTest, MouseWheelWithPreciseScrollingDeltas) {
+#else
+TEST_P(InputHandlerProxyTest, DISABLED_MouseWheelWithPreciseScrollingDeltas) {
+#endif
+ SetSmoothScrollEnabled(true);
+ SetMouseWheelGesturesOn(false);
+ expected_disposition_ = InputHandlerProxy::DID_HANDLE;
+ WebMouseWheelEvent wheel;
+ wheel.type = WebInputEvent::MouseWheel;
+
+ VERIFY_AND_RESET_MOCKS();
+
+ // Smooth scroll because hasPreciseScrollingDeltas is set to false.
+ wheel.hasPreciseScrollingDeltas = false;
+ EXPECT_CALL(mock_input_handler_, ScrollAnimated(::testing::_, ::testing::_))
+ .WillOnce(testing::Return(kImplThreadScrollState));
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
+
+ VERIFY_AND_RESET_MOCKS();
+
+ // No smooth scroll because hasPreciseScrollingDeltas is set to true.
+ wheel.hasPreciseScrollingDeltas = true;
+ EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
+ .WillOnce(testing::Return(kImplThreadScrollState));
+ EXPECT_CALL(mock_input_handler_, ScrollBy(::testing::_))
+ .WillOnce(testing::Return(scroll_result_did_scroll_));
+ EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
+ EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
+
+ VERIFY_AND_RESET_MOCKS();
+}
+
+// Mac does not smooth scroll wheel events (crbug.com/574283).
+#if !defined(OS_MACOSX)
+TEST_P(InputHandlerProxyTest, MouseWheelScrollIgnored) {
+#else
+TEST_P(InputHandlerProxyTest, DISABLED_MouseWheelScrollIgnored) {
+#endif
+ SetSmoothScrollEnabled(true);
+ SetMouseWheelGesturesOn(false);
+ expected_disposition_ = InputHandlerProxy::DROP_EVENT;
+ WebMouseWheelEvent wheel;
+ wheel.type = WebInputEvent::MouseWheel;
+
+ EXPECT_CALL(mock_input_handler_, ScrollAnimated(testing::_, testing::_))
+ .WillOnce(testing::Return(kScrollIgnoredScrollState));
+
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
VERIFY_AND_RESET_MOCKS();
}
« no previous file with comments | « ui/events/blink/input_handler_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698