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

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

Issue 739013008: Explicitly suppress scrolling for wheel events that will trigger zooming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit tests Created 6 years 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/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..98a7a2b1ec03df4821a554cb0737220b940f0ca8 100644
--- a/content/common/input/web_input_event_traits_unittest.cc
+++ b/content/common/input/web_input_event_traits_unittest.cc
@@ -51,6 +51,14 @@ class WebInputEventTraitsTest : public testing::Test {
event.y = y;
return event;
}
+
+ static WebMouseWheelEvent CreateMouseWheel(WebInputEvent::Type type,
Rick Byers 2014/12/12 22:20:29 no need to take a 'type' here - unlike touch/gestu
lanwei 2014/12/17 23:16:40 Done.
+ bool canScroll) {
+ WebMouseWheelEvent event;
+ event.type = type;
+ event.canScroll = canScroll;
+ return event;
+ }
};
TEST_F(WebInputEventTraitsTest, TouchEventCoalescing) {
@@ -162,6 +170,24 @@ TEST_F(WebInputEventTraitsTest, PinchEventCoalescing) {
EXPECT_EQ(numeric_limits<float>::max(), pinch1.data.pinchUpdate.scale);
}
+TEST_F(WebInputEventTraitsTest, WebMouseWheelEventCoalescing) {
+ WebMouseWheelEvent mouseWheel0 =
+ CreateMouseWheel(WebInputEvent::MouseWheel, true);
+ WebMouseWheelEvent mouseWheel1 =
+ CreateMouseWheel(WebInputEvent::MouseWheel, false);
+
+ // WebMouseWheelEvent objects with different canScroll values should not
Rick Byers 2014/12/12 22:20:29 please add a baseline that verifies CanCoalesce ev
lanwei 2014/12/17 23:16:40 Done.
+ // coalesce.
+ EXPECT_FALSE(WebInputEventTraits::CanCoalesce(mouseWheel0, mouseWheel1));
+
+ // WebMouseWheelEvent objects with different modifiers should not coalesce.
+ mouseWheel0 = CreateMouseWheel(WebInputEvent::MouseWheel, true);
+ mouseWheel1 = CreateMouseWheel(WebInputEvent::MouseWheel, true);
+ mouseWheel0.modifiers = blink::WebInputEvent::ControlKey;
+ mouseWheel1.modifiers = blink::WebInputEvent::ShiftKey;
+ EXPECT_FALSE(WebInputEventTraits::CanCoalesce(mouseWheel0, mouseWheel1));
+}
+
// Very basic smoke test to ensure stringification doesn't explode.
TEST_F(WebInputEventTraitsTest, ToString) {
WebKeyboardEvent key;

Powered by Google App Engine
This is Rietveld 408576698