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

Side by Side 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: Added a test 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/input/input_handler_proxy.h" 5 #include "content/renderer/input/input_handler_proxy.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/swap_promise_monitor.h" 9 #include "cc/base/swap_promise_monitor.h"
10 #include "content/common/input/did_overscroll_params.h" 10 #include "content/common/input/did_overscroll_params.h"
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 WebMouseWheelEvent wheel; 1995 WebMouseWheelEvent wheel;
1996 wheel.type = WebInputEvent::MouseWheel; 1996 wheel.type = WebInputEvent::MouseWheel;
1997 wheel.scrollByPage = true; 1997 wheel.scrollByPage = true;
1998 1998
1999 EXPECT_CALL(mock_client, DidReceiveInputEvent()); 1999 EXPECT_CALL(mock_client, DidReceiveInputEvent());
2000 2000
2001 input_handler_->HandleInputEvent(wheel); 2001 input_handler_->HandleInputEvent(wheel);
2002 testing::Mock::VerifyAndClearExpectations(&mock_client); 2002 testing::Mock::VerifyAndClearExpectations(&mock_client);
2003 } 2003 }
2004 2004
2005 TEST_F(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
2006 testing::StrictMock<
2007 MockInputHandlerProxyClientWithDidReceiveInputEvent> mock_client;
2008 input_handler_.reset(
2009 new content::InputHandlerProxy(&mock_input_handler_, &mock_client));
2010
2011 // Both the initial gesture and the animate should call DidReceiveInputEvent.
2012 gesture_.type = WebInputEvent::GestureFlingStart;
2013 WebFloatPoint fling_delta = WebFloatPoint(100, 100);
2014 gesture_.data.flingStart.velocityX = fling_delta.x;
2015 gesture_.data.flingStart.velocityY = fling_delta.y;
2016 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
2017 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
2018 .WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
2019 EXPECT_CALL(mock_input_handler_, ScrollEnd());
2020 EXPECT_CALL(mock_client, DidReceiveInputEvent());
2021 EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
2022 input_handler_->HandleInputEvent(gesture_));
2023 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
2024 testing::Mock::VerifyAndClearExpectations(&mock_client);
2025
2026 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
2027 EXPECT_CALL(mock_client, DidReceiveInputEvent());
2028 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
2029 input_handler_->Animate(time);
2030
2031 testing::Mock::VerifyAndClearExpectations(&mock_client);
2032 }
2033
2005 } // namespace 2034 } // namespace
2006 } // namespace content 2035 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698