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

Side by Side Diff: content/renderer/gpu/input_handler_proxy_unittest.cc

Issue 15651006: cc: Disable LastInputEventForBeginFrame (Closed) Base URL: http://git.chromium.org/chromium/src.git@nobfafteri
Patch Set: Remove HandleInputEventInternal Created 7 years, 6 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 unified diff | Download patch
« no previous file with comments | « content/renderer/gpu/input_handler_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/gpu/input_handler_proxy.h" 5 #include "content/renderer/gpu/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 "content/renderer/gpu/input_handler_proxy_client.h" 9 #include "content/renderer/gpu/input_handler_proxy_client.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ScrollStatus(gfx::Point viewport_point, 43 ScrollStatus(gfx::Point viewport_point,
44 cc::InputHandler::ScrollInputType type)); 44 cc::InputHandler::ScrollInputType type));
45 MOCK_METHOD2(ScrollBy, 45 MOCK_METHOD2(ScrollBy,
46 bool(gfx::Point viewport_point, gfx::Vector2dF scroll_delta)); 46 bool(gfx::Point viewport_point, gfx::Vector2dF scroll_delta));
47 MOCK_METHOD2(ScrollVerticallyByPage, 47 MOCK_METHOD2(ScrollVerticallyByPage,
48 bool(gfx::Point viewport_point, 48 bool(gfx::Point viewport_point,
49 cc::ScrollDirection direction)); 49 cc::ScrollDirection direction));
50 MOCK_METHOD0(ScrollEnd, void()); 50 MOCK_METHOD0(ScrollEnd, void());
51 MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus()); 51 MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus());
52 52
53 MOCK_METHOD1(DidReceiveLastInputEventForBeginFrame,
54 void(base::TimeTicks time));
55
56 virtual void BindToClient(cc::InputHandlerClient* client) OVERRIDE {} 53 virtual void BindToClient(cc::InputHandlerClient* client) OVERRIDE {}
57 54
58 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset, 55 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
59 bool anchor_point, 56 bool anchor_point,
60 float page_scale, 57 float page_scale,
61 base::TimeTicks start_time, 58 base::TimeTicks start_time,
62 base::TimeDelta duration) OVERRIDE {} 59 base::TimeDelta duration) OVERRIDE {}
63 60
64 virtual void NotifyCurrentFlingVelocity(gfx::Vector2dF velocity) OVERRIDE {} 61 virtual void NotifyCurrentFlingVelocity(gfx::Vector2dF velocity) OVERRIDE {}
65 62
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 942
946 EXPECT_CALL(mock_input_handler_, ScrollEnd()); 943 EXPECT_CALL(mock_input_handler_, ScrollEnd());
947 gesture_.type = WebInputEvent::GestureFlingCancel; 944 gesture_.type = WebInputEvent::GestureFlingCancel;
948 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 945 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
949 946
950 // |gesture_scroll_on_impl_thread_| should be false once 947 // |gesture_scroll_on_impl_thread_| should be false once
951 // the fling has finished (note no GestureScrollEnd has been sent). 948 // the fling has finished (note no GestureScrollEnd has been sent).
952 EXPECT_TRUE(!input_handler_->gesture_scroll_on_impl_thread_for_testing()); 949 EXPECT_TRUE(!input_handler_->gesture_scroll_on_impl_thread_for_testing());
953 } 950 }
954 951
955 TEST_F(InputHandlerProxyTest, LastInputEventForVSync) {
956 expected_disposition_ = InputHandlerProxy::DROP_EVENT;
957 VERIFY_AND_RESET_MOCKS();
958
959 gesture_.type = WebInputEvent::GestureFlingCancel;
960 gesture_.timeStampSeconds = 1234;
961 base::TimeTicks time =
962 base::TimeTicks() +
963 base::TimeDelta::FromSeconds(gesture_.timeStampSeconds);
964 gesture_.modifiers |= WebInputEvent::IsLastInputEventForCurrentVSync;
965 EXPECT_CALL(mock_input_handler_, DidReceiveLastInputEventForBeginFrame(time));
966 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
967 }
968
969 TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) { 952 TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
970 // We shouldn't send any events to the widget for this gesture. 953 // We shouldn't send any events to the widget for this gesture.
971 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 954 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
972 VERIFY_AND_RESET_MOCKS(); 955 VERIFY_AND_RESET_MOCKS();
973 956
974 // On the fling start, we should schedule an animation but not actually start 957 // On the fling start, we should schedule an animation but not actually start
975 // scrolling. 958 // scrolling.
976 gesture_.type = WebInputEvent::GestureFlingStart; 959 gesture_.type = WebInputEvent::GestureFlingStart;
977 WebFloatPoint fling_delta = WebFloatPoint(1000, 1000); 960 WebFloatPoint fling_delta = WebFloatPoint(1000, 1000);
978 gesture_.data.flingStart.velocityX = fling_delta.x; 961 gesture_.data.flingStart.velocityX = fling_delta.x;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 testing::Property(&gfx::Vector2dF::y, testing::Eq(0)))) 1000 testing::Property(&gfx::Vector2dF::y, testing::Eq(0))))
1018 .WillOnce(testing::Return(true)); 1001 .WillOnce(testing::Return(true));
1019 EXPECT_CALL(mock_input_handler_, ScrollEnd()); 1002 EXPECT_CALL(mock_input_handler_, ScrollEnd());
1020 time += base::TimeDelta::FromMilliseconds(100); 1003 time += base::TimeDelta::FromMilliseconds(100);
1021 input_handler_->Animate(time); 1004 input_handler_->Animate(time);
1022 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); 1005 testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
1023 } 1006 }
1024 1007
1025 } // namespace 1008 } // namespace
1026 } // namespace content 1009 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/input_handler_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698