Chromium Code Reviews| 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; |