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

Side by Side Diff: ui/events/blink/input_handler_proxy_unittest.cc

Issue 2040543002: Take MT jank into account when animating the scroll offset on CC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test + apply suggested improvement Created 4 years, 3 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 | « ui/events/blink/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 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 "ui/events/blink/input_handler_proxy.h" 5 #include "ui/events/blink/input_handler_proxy.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/test/histogram_tester.h" 10 #include "base/test/histogram_tester.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 MOCK_METHOD0(SetNeedsAnimateInput, void()); 101 MOCK_METHOD0(SetNeedsAnimateInput, void());
102 102
103 MOCK_METHOD2(ScrollBegin, 103 MOCK_METHOD2(ScrollBegin,
104 ScrollStatus(cc::ScrollState*, 104 ScrollStatus(cc::ScrollState*,
105 cc::InputHandler::ScrollInputType type)); 105 cc::InputHandler::ScrollInputType type));
106 MOCK_METHOD2(RootScrollBegin, 106 MOCK_METHOD2(RootScrollBegin,
107 ScrollStatus(cc::ScrollState*, 107 ScrollStatus(cc::ScrollState*,
108 cc::InputHandler::ScrollInputType type)); 108 cc::InputHandler::ScrollInputType type));
109 MOCK_METHOD1(ScrollAnimatedBegin, 109 MOCK_METHOD1(ScrollAnimatedBegin,
110 ScrollStatus(const gfx::Point& viewport_point)); 110 ScrollStatus(const gfx::Point& viewport_point));
111 MOCK_METHOD2(ScrollAnimated, 111 MOCK_METHOD3(ScrollAnimated,
112 ScrollStatus(const gfx::Point& viewport_point, 112 ScrollStatus(const gfx::Point& viewport_point,
113 const gfx::Vector2dF& scroll_delta)); 113 const gfx::Vector2dF& scroll_delta,
114 base::TimeDelta));
114 MOCK_METHOD1(ScrollBy, cc::InputHandlerScrollResult(cc::ScrollState*)); 115 MOCK_METHOD1(ScrollBy, cc::InputHandlerScrollResult(cc::ScrollState*));
115 MOCK_METHOD2(ScrollVerticallyByPage, 116 MOCK_METHOD2(ScrollVerticallyByPage,
116 bool(const gfx::Point& viewport_point, 117 bool(const gfx::Point& viewport_point,
117 cc::ScrollDirection direction)); 118 cc::ScrollDirection direction));
118 MOCK_METHOD1(ScrollEnd, void(cc::ScrollState*)); 119 MOCK_METHOD1(ScrollEnd, void(cc::ScrollState*));
119 MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus()); 120 MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus());
120 121
121 std::unique_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( 122 std::unique_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
122 ui::LatencyInfo* latency) override { 123 ui::LatencyInfo* latency) override {
123 return std::unique_ptr<cc::SwapPromiseMonitor>(); 124 return std::unique_ptr<cc::SwapPromiseMonitor>();
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 gesture_.type = WebInputEvent::GestureScrollBegin; 589 gesture_.type = WebInputEvent::GestureScrollBegin;
589 gesture_.data.scrollBegin.deltaHintUnits = 590 gesture_.data.scrollBegin.deltaHintUnits =
590 WebGestureEvent::ScrollUnits::Pixels; 591 WebGestureEvent::ScrollUnits::Pixels;
591 EXPECT_CALL(mock_input_handler_, ScrollAnimatedBegin(::testing::_)) 592 EXPECT_CALL(mock_input_handler_, ScrollAnimatedBegin(::testing::_))
592 .WillOnce(testing::Return(kImplThreadScrollState)); 593 .WillOnce(testing::Return(kImplThreadScrollState));
593 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 594 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
594 595
595 gesture_.type = WebInputEvent::GestureScrollUpdate; 596 gesture_.type = WebInputEvent::GestureScrollUpdate;
596 gesture_.data.scrollUpdate.deltaUnits = WebGestureEvent::ScrollUnits::Pixels; 597 gesture_.data.scrollUpdate.deltaUnits = WebGestureEvent::ScrollUnits::Pixels;
597 598
598 EXPECT_CALL(mock_input_handler_, ScrollAnimated(::testing::_, ::testing::_)) 599 EXPECT_CALL(mock_input_handler_,
600 ScrollAnimated(::testing::_, ::testing::_, ::testing::_))
599 .WillOnce(testing::Return(kImplThreadScrollState)); 601 .WillOnce(testing::Return(kImplThreadScrollState));
600 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 602 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
601 603
602 VERIFY_AND_RESET_MOCKS(); 604 VERIFY_AND_RESET_MOCKS();
603 } 605 }
604 606
605 TEST_P(InputHandlerProxyTest, GestureScrollBeginThatTargetViewport) { 607 TEST_P(InputHandlerProxyTest, GestureScrollBeginThatTargetViewport) {
606 // We shouldn't send any events to the widget for this gesture. 608 // We shouldn't send any events to the widget for this gesture.
607 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 609 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
608 VERIFY_AND_RESET_MOCKS(); 610 VERIFY_AND_RESET_MOCKS();
(...skipping 2192 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1), 2803 testing::ElementsAre(base::Bucket(1, 1), base::Bucket(3, 1),
2802 base::Bucket(5, 1), base::Bucket(14, 1))); 2804 base::Bucket(5, 1), base::Bucket(14, 1)));
2803 } 2805 }
2804 2806
2805 2807
2806 INSTANTIATE_TEST_CASE_P(AnimateInput, 2808 INSTANTIATE_TEST_CASE_P(AnimateInput,
2807 InputHandlerProxyTest, 2809 InputHandlerProxyTest,
2808 testing::ValuesIn(test_types)); 2810 testing::ValuesIn(test_types));
2809 } // namespace test 2811 } // namespace test
2810 } // namespace ui 2812 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/blink/input_handler_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698