Commit 810fa82b authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Fix missing test that was added while the new input router was written.

A new test was added to the legacy_input_router_impl_unittest but wasn't
cloned over to the new input_router_impl. Add the missing code.

BUG=727866

Change-Id: Id7df047f173be06e4447d9ff99c383b85f2e3fed
Reviewed-on: https://chromium-review.googlesource.com/598545
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491793}
parent 207b12dd
......@@ -344,6 +344,8 @@ bool InputRouterImpl::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
OnHasTouchEventHandlers)
IPC_MESSAGE_HANDLER(InputHostMsg_SetTouchAction, OnSetTouchAction)
IPC_MESSAGE_HANDLER(InputHostMsg_SetWhiteListedTouchAction,
OnSetWhiteListedTouchAction)
IPC_MESSAGE_HANDLER(InputHostMsg_DidStopFlinging, OnDidStopFlinging)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
......@@ -478,6 +480,17 @@ void InputRouterImpl::OnSetTouchAction(cc::TouchAction touch_action) {
UpdateTouchAckTimeoutEnabled();
}
void InputRouterImpl::OnSetWhiteListedTouchAction(
cc::TouchAction white_listed_touch_action,
uint32_t unique_touch_event_id,
InputEventAckState ack_result) {
// TODO(hayleyferr): Catch the cases that we have filtered out sending the
// touchstart.
touch_action_filter_.OnSetWhiteListedTouchAction(white_listed_touch_action);
client_->OnSetWhiteListedTouchAction(white_listed_touch_action);
}
void InputRouterImpl::OnDidStopFlinging() {
DCHECK_GT(active_renderer_fling_count_, 0);
// Note that we're only guaranteed to get a fling end notification from the
......
......@@ -152,6 +152,9 @@ class CONTENT_EXPORT InputRouterImpl
void OnDidOverscroll(const ui::DidOverscrollParams& params);
void OnHasTouchEventHandlers(bool has_handlers);
void OnSetTouchAction(cc::TouchAction touch_action);
void OnSetWhiteListedTouchAction(cc::TouchAction white_listed_touch_action,
uint32_t unique_touch_event_id,
InputEventAckState ack_result);
void OnDidStopFlinging();
// Dispatches the ack'ed event to |ack_handler_|.
......
......@@ -165,6 +165,10 @@ class MockInputRouterImplClient : public InputRouterImplClient {
return input_router_client_.GetAndResetOverscroll();
}
cc::TouchAction GetAndResetWhiteListedTouchAction() {
return input_router_client_.GetAndResetWhiteListedTouchAction();
}
void set_input_router(InputRouter* input_router) {
input_router_client_.set_input_router(input_router);
}
......@@ -420,6 +424,13 @@ class InputRouterImplTest : public testing::Test {
InputHostMsg_SetTouchAction(0, touch_action));
}
void OnSetWhiteListedTouchAction(cc::TouchAction white_listed_touch_action,
uint32_t unique_touch_event_id,
InputEventAckState ack_result) {
input_router_->OnMessageReceived(InputHostMsg_SetWhiteListedTouchAction(
0, white_listed_touch_action, unique_touch_event_id, ack_result));
}
DispatchedEvents GetAndResetDispatchedEvents() {
return client_->GetAndResetDispatchedEvents();
}
......@@ -1841,6 +1852,17 @@ TEST_F(InputRouterImplAsyncWheelEventEnabledTest, OverscrollDispatch) {
OverscrollDispatch();
}
// Test proper routing of whitelisted touch action notifications received from
// |SetWhiteListedTouchAction| IPC messages.
TEST_F(InputRouterImplTest, OnSetWhiteListedTouchAction) {
cc::TouchAction touch_action = cc::kTouchActionPanY;
OnSetWhiteListedTouchAction(touch_action, 0,
INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
cc::TouchAction white_listed_touch_action =
client_->GetAndResetWhiteListedTouchAction();
EXPECT_EQ(touch_action, white_listed_touch_action);
}
// Tests that touch event stream validation passes when events are filtered
// out. See crbug.com/581231 for details.
TEST_F(InputRouterImplTest, TouchValidationPassesWithFilteredInputEvents) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment