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

Unified Diff: content/renderer/input/input_handler_proxy_unittest.cc

Issue 692483002: Hook up DidReceiveInputEvent to the blink scheduler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding some input event filter logic Created 6 years, 1 month 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/renderer/input/input_handler_proxy_client.h ('k') | content/renderer/input/input_handler_wrapper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/input/input_handler_proxy_unittest.cc
diff --git a/content/renderer/input/input_handler_proxy_unittest.cc b/content/renderer/input/input_handler_proxy_unittest.cc
index 59f3efd206df96454bdd7641e9fd66fb58da9213..bb2570b116e332888741fc9bbba585c396d4106a 100644
--- a/content/renderer/input/input_handler_proxy_unittest.cc
+++ b/content/renderer/input/input_handler_proxy_unittest.cc
@@ -174,7 +174,8 @@ class MockInputHandlerProxyClient
MOCK_METHOD1(DidOverscroll, void(const DidOverscrollParams&));
virtual void DidStopFlinging() override {}
- virtual void DidReceiveInputEvent() override {}
+ virtual void DidReceiveInputEvent(blink::WebInputEvent::Type) override {}
+ virtual void DidAnimateForInput() override {}
private:
DISALLOW_COPY_AND_ASSIGN(MockInputHandlerProxyClient);
@@ -186,7 +187,8 @@ class MockInputHandlerProxyClientWithDidReceiveInputEvent
MockInputHandlerProxyClientWithDidReceiveInputEvent() {}
virtual ~MockInputHandlerProxyClientWithDidReceiveInputEvent() {}
- MOCK_METHOD0(DidReceiveInputEvent, void());
+ MOCK_METHOD1(DidReceiveInputEvent, void(blink::WebInputEvent::Type type));
+ MOCK_METHOD0(DidAnimateForInput, void());
private:
DISALLOW_COPY_AND_ASSIGN(MockInputHandlerProxyClientWithDidReceiveInputEvent);
@@ -1996,11 +1998,40 @@ TEST_F(InputHandlerProxyTest, DidReceiveInputEvent) {
wheel.type = WebInputEvent::MouseWheel;
wheel.scrollByPage = true;
- EXPECT_CALL(mock_client, DidReceiveInputEvent());
+ EXPECT_CALL(mock_client, DidReceiveInputEvent(WebInputEvent::MouseWheel));
input_handler_->HandleInputEvent(wheel);
testing::Mock::VerifyAndClearExpectations(&mock_client);
}
+TEST_F(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
+ testing::StrictMock<
+ MockInputHandlerProxyClientWithDidReceiveInputEvent> mock_client;
+ input_handler_.reset(
+ new content::InputHandlerProxy(&mock_input_handler_, &mock_client));
+
+ gesture_.type = WebInputEvent::GestureFlingStart;
+ WebFloatPoint fling_delta = WebFloatPoint(100, 100);
+ gesture_.data.flingStart.velocityX = fling_delta.x;
+ gesture_.data.flingStart.velocityY = fling_delta.y;
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
+ .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
+ EXPECT_CALL(mock_input_handler_, ScrollEnd());
+ EXPECT_CALL(mock_client,
+ DidReceiveInputEvent(WebInputEvent::GestureFlingStart));
+ EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
+ input_handler_->HandleInputEvent(gesture_));
+ testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
+ testing::Mock::VerifyAndClearExpectations(&mock_client);
+
+ EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
+ EXPECT_CALL(mock_client, DidAnimateForInput());
+ base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
+ input_handler_->Animate(time);
+
+ testing::Mock::VerifyAndClearExpectations(&mock_client);
+}
+
} // namespace
} // namespace content
« no previous file with comments | « content/renderer/input/input_handler_proxy_client.h ('k') | content/renderer/input/input_handler_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698