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

Unified Diff: content/common/input/web_input_event_traits_unittest.cc

Issue 835523006: Explicitly suppress scrolling for wheel events that will trigger zooming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DCHECK Created 5 years, 11 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 | « content/common/input/web_input_event_traits.cc ('k') | content/renderer/input/input_handler_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/input/web_input_event_traits_unittest.cc
diff --git a/content/common/input/web_input_event_traits_unittest.cc b/content/common/input/web_input_event_traits_unittest.cc
index 7a7cb7ff8b3e878eec275c8445494fbb8a6aefa4..62417dba063fe5bb787aa4a2206c67204d67b485 100644
--- a/content/common/input/web_input_event_traits_unittest.cc
+++ b/content/common/input/web_input_event_traits_unittest.cc
@@ -51,6 +51,17 @@ class WebInputEventTraitsTest : public testing::Test {
event.y = y;
return event;
}
+
+ static WebMouseWheelEvent CreateMouseWheel(float deltaX,
+ float deltaY,
+ bool canScroll) {
+ WebMouseWheelEvent event;
+ event.type = WebInputEvent::MouseWheel;
+ event.deltaX = deltaX;
+ event.deltaY = deltaY;
+ event.canScroll = canScroll;
+ return event;
+ }
};
TEST_F(WebInputEventTraitsTest, TouchEventCoalescing) {
@@ -162,6 +173,31 @@ TEST_F(WebInputEventTraitsTest, PinchEventCoalescing) {
EXPECT_EQ(numeric_limits<float>::max(), pinch1.data.pinchUpdate.scale);
}
+TEST_F(WebInputEventTraitsTest, WebMouseWheelEventCoalescing) {
+ WebMouseWheelEvent mouse_wheel_0 =
+ CreateMouseWheel(1, 1, true);
+ WebMouseWheelEvent mouse_wheel_1 =
+ CreateMouseWheel(2, 2, true);
+
+ // WebMouseWheelEvent objects with same values except different deltaX and
+ // deltaY should coalesce.
+ EXPECT_TRUE(WebInputEventTraits::CanCoalesce(mouse_wheel_0, mouse_wheel_1));
+
+ mouse_wheel_0 = CreateMouseWheel(1, 1, true);
+ mouse_wheel_1 = CreateMouseWheel(1, 1, false);
+
+ // WebMouseWheelEvent objects with different canScroll values should not
+ // coalesce.
+ EXPECT_FALSE(WebInputEventTraits::CanCoalesce(mouse_wheel_0, mouse_wheel_1));
+
+ // WebMouseWheelEvent objects with different modifiers should not coalesce.
+ mouse_wheel_0 = CreateMouseWheel(1, 1, true);
+ mouse_wheel_1 = CreateMouseWheel(1, 1, true);
+ mouse_wheel_0.modifiers = blink::WebInputEvent::ControlKey;
+ mouse_wheel_1.modifiers = blink::WebInputEvent::ShiftKey;
+ EXPECT_FALSE(WebInputEventTraits::CanCoalesce(mouse_wheel_0, mouse_wheel_1));
+}
+
// Very basic smoke test to ensure stringification doesn't explode.
TEST_F(WebInputEventTraitsTest, ToString) {
WebKeyboardEvent key;
« no previous file with comments | « content/common/input/web_input_event_traits.cc ('k') | content/renderer/input/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698