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

Unified Diff: content/browser/renderer_host/input/input_router_impl_unittest.cc

Issue 281723010: Bundle DidOverscrollParams with the InputEventAck (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 6 years, 7 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
Index: content/browser/renderer_host/input/input_router_impl_unittest.cc
diff --git a/content/browser/renderer_host/input/input_router_impl_unittest.cc b/content/browser/renderer_host/input/input_router_impl_unittest.cc
index 1039e70804e57d4e5e33a330186a5266641b253e..34e58a3e5232b7df341a07419a4f2d15c771c872 100644
--- a/content/browser/renderer_host/input/input_router_impl_unittest.cc
+++ b/content/browser/renderer_host/input/input_router_impl_unittest.cc
@@ -293,10 +293,10 @@ class InputRouterImplTest : public testing::Test {
void SendInputEventACK(blink::WebInputEvent::Type type,
InputEventAckState ack_result) {
- scoped_ptr<IPC::Message> response(
- new InputHostMsg_HandleInputEvent_ACK(0, type, ack_result,
- ui::LatencyInfo()));
- input_router_->OnMessageReceived(*response);
+ InputHostMsg_HandleInputEvent_ACK_Params ack;
+ ack.type = type;
+ ack.state = ack_result;
+ input_router_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack));
}
InputRouterImpl* input_router() const {
@@ -1653,4 +1653,42 @@ TEST_F(InputRouterImplTest, TouchpadPinchAndScrollUpdate) {
EXPECT_EQ(0, client_->in_flight_event_count());
}
+// Test proper routing of overscroll notifications received either from
+// event acks or from |DidOverscroll| IPC messages.
+TEST_F(InputRouterImplTest, OverscrollDispatch) {
+ DidOverscrollParams overscroll;
+ overscroll.accumulated_overscroll = gfx::Vector2dF(-14, 14);
+ overscroll.latest_overscroll_delta = gfx::Vector2dF(-7, 0);
+ overscroll.current_fling_velocity = gfx::Vector2dF(-1, 0);
+
+ input_router_->OnMessageReceived(InputHostMsg_DidOverscroll(0, overscroll));
+ DidOverscrollParams client_overscroll = client_->GetAndResetOverscroll();
+ EXPECT_EQ(overscroll.accumulated_overscroll,
+ client_overscroll.accumulated_overscroll);
+ EXPECT_EQ(overscroll.latest_overscroll_delta,
+ client_overscroll.latest_overscroll_delta);
+ EXPECT_EQ(overscroll.current_fling_velocity,
+ client_overscroll.current_fling_velocity);
+
+ DidOverscrollParams wheel_overscroll;
+ wheel_overscroll.accumulated_overscroll = gfx::Vector2dF(7, -7);
+ wheel_overscroll.latest_overscroll_delta = gfx::Vector2dF(3, 0);
+ wheel_overscroll.current_fling_velocity = gfx::Vector2dF(1, 0);
+
+ SimulateWheelEvent(3, 0, 0, false);
+ InputHostMsg_HandleInputEvent_ACK_Params ack;
+ ack.type = WebInputEvent::MouseWheel;
+ ack.state = INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
+ ack.overscroll.reset(new DidOverscrollParams(wheel_overscroll));
+ input_router_->OnMessageReceived(InputHostMsg_HandleInputEvent_ACK(0, ack));
+
+ client_overscroll = client_->GetAndResetOverscroll();
+ EXPECT_EQ(wheel_overscroll.accumulated_overscroll,
+ client_overscroll.accumulated_overscroll);
+ EXPECT_EQ(wheel_overscroll.latest_overscroll_delta,
+ client_overscroll.latest_overscroll_delta);
+ EXPECT_EQ(wheel_overscroll.current_fling_velocity,
+ client_overscroll.current_fling_velocity);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698