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

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

Issue 2257023004: Coalesced mouse wheel event has the position of the most recent event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: a more verbose unittest. Created 4 years, 4 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/event_with_latency_info.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/input/event_with_latency_info_unittest.cc
diff --git a/content/common/input/event_with_latency_info_unittest.cc b/content/common/input/event_with_latency_info_unittest.cc
index 45907f7117b11d39e2b7bb7b1b33b9d729671047..f9ce1ed23df72ceba6bae8f67369ce3a426831ac 100644
--- a/content/common/input/event_with_latency_info_unittest.cc
+++ b/content/common/input/event_with_latency_info_unittest.cc
@@ -302,7 +302,6 @@ TEST_F(EventWithLatencyInfoTest, PinchEventCoalescing) {
TEST_F(EventWithLatencyInfoTest, WebMouseWheelEventCoalescing) {
MouseWheelEventWithLatencyInfo mouse_wheel_0 = CreateMouseWheel(1, 1);
MouseWheelEventWithLatencyInfo mouse_wheel_1 = CreateMouseWheel(2, 2);
-
// WebMouseWheelEvent objects with same values except different deltaX and
// deltaY should coalesce.
EXPECT_TRUE(CanCoalesce(mouse_wheel_0, mouse_wheel_1));
@@ -313,6 +312,45 @@ TEST_F(EventWithLatencyInfoTest, WebMouseWheelEventCoalescing) {
mouse_wheel_0.event.modifiers = WebInputEvent::ControlKey;
mouse_wheel_1.event.modifiers = WebInputEvent::ShiftKey;
EXPECT_FALSE(CanCoalesce(mouse_wheel_0, mouse_wheel_1));
+
+ // Coalesce old and new events.
+ mouse_wheel_0 = CreateMouseWheel(1, 1);
+ mouse_wheel_0.event.x = 1;
+ mouse_wheel_0.event.y = 1;
+ mouse_wheel_1 = CreateMouseWheel(2, 2);
+ mouse_wheel_1.event.x = 2;
+ mouse_wheel_1.event.y = 2;
+ MouseWheelEventWithLatencyInfo mouse_wheel_1_copy = mouse_wheel_1;
+ EXPECT_TRUE(CanCoalesce(mouse_wheel_0, mouse_wheel_1));
+ EXPECT_EQ(mouse_wheel_0.event.modifiers, mouse_wheel_1.event.modifiers);
+ EXPECT_EQ(mouse_wheel_0.event.scrollByPage, mouse_wheel_1.event.scrollByPage);
+ EXPECT_EQ(mouse_wheel_0.event.phase, mouse_wheel_1.event.phase);
+ EXPECT_EQ(mouse_wheel_0.event.momentumPhase,
+ mouse_wheel_1.event.momentumPhase);
+ EXPECT_EQ(mouse_wheel_0.event.hasPreciseScrollingDeltas,
+ mouse_wheel_1.event.hasPreciseScrollingDeltas);
+ Coalesce(mouse_wheel_0, &mouse_wheel_1);
+
+ // Coalesced event has the position of the most recent event.
+ EXPECT_EQ(1, mouse_wheel_1.event.x);
+ EXPECT_EQ(1, mouse_wheel_1.event.y);
+
+ // deltaX/Y, wheelTicksX/Y, and movementX/Y of the coalesced event are
+ // calculated properly.
+ EXPECT_EQ(mouse_wheel_1_copy.event.deltaX + mouse_wheel_0.event.deltaX,
+ mouse_wheel_1.event.deltaX);
+ EXPECT_EQ(mouse_wheel_1_copy.event.deltaY + mouse_wheel_0.event.deltaY,
+ mouse_wheel_1.event.deltaY);
+ EXPECT_EQ(
+ mouse_wheel_1_copy.event.wheelTicksX + mouse_wheel_0.event.wheelTicksX,
+ mouse_wheel_1.event.wheelTicksX);
+ EXPECT_EQ(
+ mouse_wheel_1_copy.event.wheelTicksY + mouse_wheel_0.event.wheelTicksY,
+ mouse_wheel_1.event.wheelTicksY);
+ EXPECT_EQ(mouse_wheel_1_copy.event.movementX + mouse_wheel_0.event.movementX,
+ mouse_wheel_1.event.movementX);
+ EXPECT_EQ(mouse_wheel_1_copy.event.movementY + mouse_wheel_0.event.movementY,
+ mouse_wheel_1.event.movementY);
}
// Coalescing preserves the newer timestamp.
« no previous file with comments | « content/common/input/event_with_latency_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698