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

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

Issue 2802993003: Event unittests cover both wheel scroll latching and propagating cases. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | 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/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 cc::InputHandler::ScrollInputType type)); 174 cc::InputHandler::ScrollInputType type));
175 MOCK_METHOD1(ScrollAnimatedBegin, 175 MOCK_METHOD1(ScrollAnimatedBegin,
176 ScrollStatus(const gfx::Point& viewport_point)); 176 ScrollStatus(const gfx::Point& viewport_point));
177 MOCK_METHOD3(ScrollAnimated, 177 MOCK_METHOD3(ScrollAnimated,
178 ScrollStatus(const gfx::Point& viewport_point, 178 ScrollStatus(const gfx::Point& viewport_point,
179 const gfx::Vector2dF& scroll_delta, 179 const gfx::Vector2dF& scroll_delta,
180 base::TimeDelta)); 180 base::TimeDelta));
181 MOCK_METHOD1(ScrollBy, cc::InputHandlerScrollResult(cc::ScrollState*)); 181 MOCK_METHOD1(ScrollBy, cc::InputHandlerScrollResult(cc::ScrollState*));
182 MOCK_METHOD1(ScrollEnd, void(cc::ScrollState*)); 182 MOCK_METHOD1(ScrollEnd, void(cc::ScrollState*));
183 MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus()); 183 MOCK_METHOD0(FlingScrollBegin, cc::InputHandler::ScrollStatus());
184 MOCK_METHOD0(ScrollingShouldSwitchtoMainThread, bool());
184 185
185 std::unique_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( 186 std::unique_ptr<cc::SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
186 ui::LatencyInfo* latency) override { 187 ui::LatencyInfo* latency) override {
187 return nullptr; 188 return nullptr;
188 } 189 }
189 190
190 cc::ScrollElasticityHelper* CreateScrollElasticityHelper() override { 191 cc::ScrollElasticityHelper* CreateScrollElasticityHelper() override {
191 return NULL; 192 return NULL;
192 } 193 }
193 bool GetScrollOffsetForLayer(int layer_id, 194 bool GetScrollOffsetForLayer(int layer_id,
194 gfx::ScrollOffset* offset) override { 195 gfx::ScrollOffset* offset) override {
195 return false; 196 return false;
196 } 197 }
197 bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) override { 198 bool ScrollLayerTo(int layer_id, const gfx::ScrollOffset& offset) override {
198 return false; 199 return false;
199 } 200 }
200 201
201 bool ScrollingShouldSwitchtoMainThread() override { return false; }
202
203 void BindToClient(cc::InputHandlerClient* client, 202 void BindToClient(cc::InputHandlerClient* client,
204 bool touchpad_and_wheel_scroll_latching_enabled) override {} 203 bool touchpad_and_wheel_scroll_latching_enabled) override {}
205 204
206 void MouseDown() override {} 205 void MouseDown() override {}
207 void MouseUp() override {} 206 void MouseUp() override {}
208 void MouseLeave() override {} 207 void MouseLeave() override {}
209 208
210 void MouseMoveAt(const gfx::Point& mouse_position) override {} 209 void MouseMoveAt(const gfx::Point& mouse_position) override {}
211 210
212 MOCK_CONST_METHOD2(IsCurrentlyScrollingLayerAt, 211 MOCK_CONST_METHOD2(IsCurrentlyScrollingLayerAt,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 RecordMainThreadScrollingReasons(device, reasons); 363 RecordMainThreadScrollingReasons(device, reasons);
365 } 364 }
366 }; 365 };
367 366
368 } // namespace 367 } // namespace
369 368
370 class InputHandlerProxyTest 369 class InputHandlerProxyTest
371 : public testing::Test, 370 : public testing::Test,
372 public testing::WithParamInterface<InputHandlerProxyTestType> { 371 public testing::WithParamInterface<InputHandlerProxyTestType> {
373 public: 372 public:
374 InputHandlerProxyTest() 373 InputHandlerProxyTest(bool touchpad_and_wheel_scroll_latching_enabled = true)
375 : synchronous_root_scroll_(GetParam() == ROOT_SCROLL_SYNCHRONOUS_HANDLER), 374 : synchronous_root_scroll_(GetParam() == ROOT_SCROLL_SYNCHRONOUS_HANDLER),
376 install_synchronous_handler_( 375 install_synchronous_handler_(
377 GetParam() == ROOT_SCROLL_SYNCHRONOUS_HANDLER || 376 GetParam() == ROOT_SCROLL_SYNCHRONOUS_HANDLER ||
378 GetParam() == CHILD_SCROLL_SYNCHRONOUS_HANDLER), 377 GetParam() == CHILD_SCROLL_SYNCHRONOUS_HANDLER),
379 expected_disposition_(InputHandlerProxy::DID_HANDLE) { 378 expected_disposition_(InputHandlerProxy::DID_HANDLE),
379 touchpad_and_wheel_scroll_latching_enabled_(
380 touchpad_and_wheel_scroll_latching_enabled) {
380 input_handler_.reset( 381 input_handler_.reset(
381 new TestInputHandlerProxy(&mock_input_handler_, &mock_client_, false)); 382 new TestInputHandlerProxy(&mock_input_handler_, &mock_client_,
383 touchpad_and_wheel_scroll_latching_enabled_));
382 scroll_result_did_scroll_.did_scroll = true; 384 scroll_result_did_scroll_.did_scroll = true;
383 scroll_result_did_not_scroll_.did_scroll = false; 385 scroll_result_did_not_scroll_.did_scroll = false;
384 386
385 if (install_synchronous_handler_) { 387 if (install_synchronous_handler_) {
386 EXPECT_CALL(mock_input_handler_, 388 EXPECT_CALL(mock_input_handler_,
387 RequestUpdateForSynchronousInputHandler()) 389 RequestUpdateForSynchronousInputHandler())
388 .Times(1); 390 .Times(1);
389 input_handler_->SetOnlySynchronouslyAnimateRootFlings( 391 input_handler_->SetOnlySynchronouslyAnimateRootFlings(
390 &mock_synchronous_input_handler_); 392 &mock_synchronous_input_handler_);
391 } 393 }
392 394
393 mock_input_handler_.set_is_scrolling_root(synchronous_root_scroll_); 395 mock_input_handler_.set_is_scrolling_root(synchronous_root_scroll_);
394 396
395 // Set a default device so tests don't always have to set this. 397 // Set a default device so tests don't always have to set this.
396 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad; 398 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
397 } 399 }
398 400
399 ~InputHandlerProxyTest() { 401 virtual ~InputHandlerProxyTest() { input_handler_.reset(); }
400 input_handler_.reset();
401 }
402 402
403 // This is defined as a macro so the line numbers can be traced back to the 403 // This is defined as a macro so the line numbers can be traced back to the
404 // correct spot when it fails. 404 // correct spot when it fails.
405 #define EXPECT_SET_NEEDS_ANIMATE_INPUT(times) \ 405 #define EXPECT_SET_NEEDS_ANIMATE_INPUT(times) \
406 do { \ 406 do { \
407 if (synchronous_root_scroll_) { \ 407 if (synchronous_root_scroll_) { \
408 EXPECT_CALL(mock_synchronous_input_handler_, \ 408 EXPECT_CALL(mock_synchronous_input_handler_, \
409 SetNeedsSynchronousAnimateInput()) \ 409 SetNeedsSynchronousAnimateInput()) \
410 .Times(times); \ 410 .Times(times); \
411 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(0); \ 411 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput()).Times(0); \
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 void SetSmoothScrollEnabled(bool value) { 475 void SetSmoothScrollEnabled(bool value) {
476 input_handler_->smooth_scroll_enabled_ = value; 476 input_handler_->smooth_scroll_enabled_ = value;
477 } 477 }
478 478
479 base::HistogramTester& histogram_tester() { 479 base::HistogramTester& histogram_tester() {
480 return histogram_tester_; 480 return histogram_tester_;
481 } 481 }
482 482
483 protected: 483 protected:
484 void GestureFlingAnimatesTouchpad();
485 void DidReceiveInputEvent_ForFling();
486 void GestureScrollStarted();
487 void GestureFlingPassiveListener();
488 void GestureFlingStartedTouchpad();
489 void GestureFlingStopsAtContentEdge();
490 void GestureFlingTransferResetsTouchpad();
491
484 const bool synchronous_root_scroll_; 492 const bool synchronous_root_scroll_;
485 const bool install_synchronous_handler_; 493 const bool install_synchronous_handler_;
486 testing::StrictMock<MockInputHandler> mock_input_handler_; 494 testing::StrictMock<MockInputHandler> mock_input_handler_;
487 testing::StrictMock<MockSynchronousInputHandler> 495 testing::StrictMock<MockSynchronousInputHandler>
488 mock_synchronous_input_handler_; 496 mock_synchronous_input_handler_;
489 std::unique_ptr<TestInputHandlerProxy> input_handler_; 497 std::unique_ptr<TestInputHandlerProxy> input_handler_;
490 testing::StrictMock<MockInputHandlerProxyClient> mock_client_; 498 testing::StrictMock<MockInputHandlerProxyClient> mock_client_;
491 WebGestureEvent gesture_; 499 WebGestureEvent gesture_;
492 InputHandlerProxy::EventDisposition expected_disposition_; 500 InputHandlerProxy::EventDisposition expected_disposition_;
493 base::HistogramTester histogram_tester_; 501 base::HistogramTester histogram_tester_;
494 cc::InputHandlerScrollResult scroll_result_did_scroll_; 502 cc::InputHandlerScrollResult scroll_result_did_scroll_;
495 cc::InputHandlerScrollResult scroll_result_did_not_scroll_; 503 cc::InputHandlerScrollResult scroll_result_did_not_scroll_;
504 bool touchpad_and_wheel_scroll_latching_enabled_;
505 };
506
507 class InputHandlerProxyWithoutWheelScrollLatchingTest
508 : public InputHandlerProxyTest {
509 public:
510 InputHandlerProxyWithoutWheelScrollLatchingTest()
511 : InputHandlerProxyTest(false) {}
496 }; 512 };
497 513
498 class InputHandlerProxyEventQueueTest : public testing::Test { 514 class InputHandlerProxyEventQueueTest : public testing::Test {
499 public: 515 public:
500 InputHandlerProxyEventQueueTest() : weak_ptr_factory_(this) { 516 InputHandlerProxyEventQueueTest() : weak_ptr_factory_(this) {
501 feature_list_.InitAndEnableFeature(features::kVsyncAlignedInputEvents); 517 feature_list_.InitAndEnableFeature(features::kVsyncAlignedInputEvents);
502 } 518 }
503 519
504 ~InputHandlerProxyEventQueueTest() { input_handler_proxy_.reset(); } 520 ~InputHandlerProxyEventQueueTest() { input_handler_proxy_.reset(); }
505 521
506 void SetUp() override { 522 void SetUp() override {
507 event_disposition_recorder_.clear(); 523 event_disposition_recorder_.clear();
508 input_handler_proxy_ = base::MakeUnique<TestInputHandlerProxy>( 524 input_handler_proxy_ = base::MakeUnique<TestInputHandlerProxy>(
509 &mock_input_handler_, &mock_client_, false); 525 &mock_input_handler_, &mock_client_, true);
sahel 2017/04/06 19:22:29 This test class is independent of wheel scroll lat
dtapuska 2017/04/06 20:11:25 Probably would be best to parameterize it anyway.
sahel 2017/04/07 18:10:24 Done.
510 if (input_handler_proxy_->compositor_event_queue_) 526 if (input_handler_proxy_->compositor_event_queue_)
511 input_handler_proxy_->compositor_event_queue_ = 527 input_handler_proxy_->compositor_event_queue_ =
512 base::MakeUnique<CompositorThreadEventQueue>(); 528 base::MakeUnique<CompositorThreadEventQueue>();
513 } 529 }
514 530
515 void StartTracing() { 531 void StartTracing() {
516 base::trace_event::TraceLog::GetInstance()->SetEnabled( 532 base::trace_event::TraceLog::GetInstance()->SetEnabled(
517 base::trace_event::TraceConfig("*"), 533 base::trace_event::TraceConfig("*"),
518 base::trace_event::TraceLog::RECORDING_MODE); 534 base::trace_event::TraceLog::RECORDING_MODE);
519 } 535 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 EXPECT_CALL(mock_input_handler_, 623 EXPECT_CALL(mock_input_handler_,
608 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 624 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
609 .WillOnce(testing::Return(cc::EventListenerProperties::kBlocking)); 625 .WillOnce(testing::Return(cc::EventListenerProperties::kBlocking));
610 626
611 WebMouseWheelEvent wheel(WebInputEvent::MouseWheel, WebInputEvent::ControlKey, 627 WebMouseWheelEvent wheel(WebInputEvent::MouseWheel, WebInputEvent::ControlKey,
612 WebInputEvent::TimeStampForTesting); 628 WebInputEvent::TimeStampForTesting);
613 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel)); 629 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(wheel));
614 VERIFY_AND_RESET_MOCKS(); 630 VERIFY_AND_RESET_MOCKS();
615 } 631 }
616 632
617 TEST_P(InputHandlerProxyTest, GestureScrollStarted) { 633 void InputHandlerProxyTest::GestureScrollStarted() {
618 // We shouldn't send any events to the widget for this gesture. 634 // We shouldn't send any events to the widget for this gesture.
619 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 635 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
620 VERIFY_AND_RESET_MOCKS(); 636 VERIFY_AND_RESET_MOCKS();
621 637
622 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 638 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
623 .WillOnce(testing::Return(kImplThreadScrollState)); 639 .WillOnce(testing::Return(kImplThreadScrollState));
624 640
625 gesture_.setType(WebInputEvent::GestureScrollBegin); 641 gesture_.setType(WebInputEvent::GestureScrollBegin);
626 EXPECT_EQ(expected_disposition_,input_handler_->HandleInputEvent(gesture_)); 642 EXPECT_EQ(expected_disposition_,input_handler_->HandleInputEvent(gesture_));
627 643
628 // The event should not be marked as handled if scrolling is not possible. 644 // The event should not be marked as handled if scrolling is not possible.
629 expected_disposition_ = InputHandlerProxy::DROP_EVENT; 645 expected_disposition_ = InputHandlerProxy::DROP_EVENT;
630 VERIFY_AND_RESET_MOCKS(); 646 VERIFY_AND_RESET_MOCKS();
631 647
632 gesture_.setType(WebInputEvent::GestureScrollUpdate); 648 gesture_.setType(WebInputEvent::GestureScrollUpdate);
633 gesture_.data.scrollUpdate.deltaY = 649 gesture_.data.scrollUpdate.deltaY =
634 -40; // -Y means scroll down - i.e. in the +Y direction. 650 -40; // -Y means scroll down - i.e. in the +Y direction.
635 EXPECT_CALL( 651 EXPECT_CALL(
636 mock_input_handler_, 652 mock_input_handler_,
637 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0)))) 653 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
638 .WillOnce(testing::Return(scroll_result_did_not_scroll_)); 654 .WillOnce(testing::Return(scroll_result_did_not_scroll_));
655 EXPECT_CALL(mock_input_handler_, ScrollingShouldSwitchtoMainThread())
656 .WillOnce(testing::Return(false));
639 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 657 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
640 658
641 // Mark the event as handled if scroll happens. 659 // Mark the event as handled if scroll happens.
642 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 660 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
643 VERIFY_AND_RESET_MOCKS(); 661 VERIFY_AND_RESET_MOCKS();
644 662
645 gesture_.setType(WebInputEvent::GestureScrollUpdate); 663 gesture_.setType(WebInputEvent::GestureScrollUpdate);
646 gesture_.data.scrollUpdate.deltaY = 664 gesture_.data.scrollUpdate.deltaY =
647 -40; // -Y means scroll down - i.e. in the +Y direction. 665 -40; // -Y means scroll down - i.e. in the +Y direction.
648 EXPECT_CALL( 666 EXPECT_CALL(
649 mock_input_handler_, 667 mock_input_handler_,
650 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0)))) 668 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
651 .WillOnce(testing::Return(scroll_result_did_scroll_)); 669 .WillOnce(testing::Return(scroll_result_did_scroll_));
652 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 670 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
653 671
654 VERIFY_AND_RESET_MOCKS(); 672 VERIFY_AND_RESET_MOCKS();
655 673
656 gesture_.setType(WebInputEvent::GestureScrollEnd); 674 gesture_.setType(WebInputEvent::GestureScrollEnd);
657 gesture_.data.scrollUpdate.deltaY = 0; 675 gesture_.data.scrollUpdate.deltaY = 0;
658 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 676 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
659 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 677 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
660 678
661 VERIFY_AND_RESET_MOCKS(); 679 VERIFY_AND_RESET_MOCKS();
662 } 680 }
681 TEST_P(InputHandlerProxyTest, GestureScrollStarted) {
682 GestureScrollStarted();
683 }
684 TEST_P(InputHandlerProxyWithoutWheelScrollLatchingTest, GestureScrollStarted) {
685 GestureScrollStarted();
686 }
663 687
664 TEST_P(InputHandlerProxyTest, GestureScrollOnMainThread) { 688 TEST_P(InputHandlerProxyTest, GestureScrollOnMainThread) {
665 // We should send all events to the widget for this gesture. 689 // We should send all events to the widget for this gesture.
666 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; 690 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
667 VERIFY_AND_RESET_MOCKS(); 691 VERIFY_AND_RESET_MOCKS();
668 692
669 EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_)) 693 EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
670 .WillOnce(testing::Return(kMainThreadScrollState)); 694 .WillOnce(testing::Return(kMainThreadScrollState));
671 695
672 gesture_.setType(WebInputEvent::GestureScrollBegin); 696 gesture_.setType(WebInputEvent::GestureScrollBegin);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 961
938 gesture_.setType(WebInputEvent::GestureScrollEnd); 962 gesture_.setType(WebInputEvent::GestureScrollEnd);
939 gesture_.data.scrollUpdate.deltaY = 0; 963 gesture_.data.scrollUpdate.deltaY = 0;
940 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)) 964 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
941 .WillOnce(testing::Return()); 965 .WillOnce(testing::Return());
942 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 966 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
943 967
944 VERIFY_AND_RESET_MOCKS(); 968 VERIFY_AND_RESET_MOCKS();
945 } 969 }
946 970
947 TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchpad) { 971 void InputHandlerProxyTest::GestureFlingStartedTouchpad() {
948 // We shouldn't send any events to the widget for this gesture. 972 // We shouldn't send any events to the widget for this gesture.
949 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 973 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
950 VERIFY_AND_RESET_MOCKS(); 974 VERIFY_AND_RESET_MOCKS();
951 975
976 EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
977 .WillOnce(testing::Return(kImplThreadScrollState));
978
979 // HandleGestureScrollBegin will set gesture_scroll_on_impl_thread_.
980 gesture_.setType(WebInputEvent::GestureScrollBegin);
981 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
982 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
983
984 VERIFY_AND_RESET_MOCKS();
985
952 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 986 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
953 .WillOnce(testing::Return(kImplThreadScrollState)); 987 .WillOnce(testing::Return(kImplThreadScrollState));
954 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 988 if (!touchpad_and_wheel_scroll_latching_enabled_)
989 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
955 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 990 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
956 991
957 gesture_.setType(WebInputEvent::GestureFlingStart); 992 gesture_.setType(WebInputEvent::GestureFlingStart);
958 gesture_.data.flingStart.velocityX = 10; 993 gesture_.data.flingStart.velocityX = 10;
959 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad; 994 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
960 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 995 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
961 996
962 VERIFY_AND_RESET_MOCKS(); 997 VERIFY_AND_RESET_MOCKS();
963 998
999 if (touchpad_and_wheel_scroll_latching_enabled_) {
1000 // The fling cancellation shouldn't get deferred because velocityX is less
1001 // than minimum.
1002 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(1);
1003 }
964 // Verify that a GestureFlingCancel during an animation cancels it. 1004 // Verify that a GestureFlingCancel during an animation cancels it.
965 gesture_.setType(WebInputEvent::GestureFlingCancel); 1005 gesture_.setType(WebInputEvent::GestureFlingCancel);
966 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad; 1006 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
967 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1007 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1008
1009 VERIFY_AND_RESET_MOCKS();
1010 }
1011 TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchpad) {
1012 GestureFlingStartedTouchpad();
1013 }
1014 TEST_P(InputHandlerProxyWithoutWheelScrollLatchingTest,
1015 GestureFlingStartedTouchpad) {
1016 GestureFlingStartedTouchpad();
968 } 1017 }
969 1018
970 TEST_P(InputHandlerProxyTest, GestureFlingTouchpadScrollLatchingEnabled) { 1019 TEST_P(InputHandlerProxyTest, GestureFlingTouchpadScrollLatchingEnabled) {
971 // Reset the input_handler_ with wheel scroll latching enabled. 1020 // Reset the input_handler_ with wheel scroll latching enabled.
972 input_handler_.reset( 1021 input_handler_.reset(
973 new TestInputHandlerProxy(&mock_input_handler_, &mock_client_, true)); 1022 new TestInputHandlerProxy(&mock_input_handler_, &mock_client_, true));
974 if (install_synchronous_handler_) { 1023 if (install_synchronous_handler_) {
975 EXPECT_CALL(mock_input_handler_, RequestUpdateForSynchronousInputHandler()) 1024 EXPECT_CALL(mock_input_handler_, RequestUpdateForSynchronousInputHandler())
976 .Times(1); 1025 .Times(1);
977 input_handler_->SetOnlySynchronouslyAnimateRootFlings( 1026 input_handler_->SetOnlySynchronouslyAnimateRootFlings(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 1099 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1051 1100
1052 // When scroll latching is enabled, ScrollBegin shouldn't get called for 1101 // When scroll latching is enabled, ScrollBegin shouldn't get called for
1053 // every tick. 1102 // every tick.
1054 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1103 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1055 .Times(0); 1104 .Times(0);
1056 EXPECT_CALL( 1105 EXPECT_CALL(
1057 mock_input_handler_, 1106 mock_input_handler_,
1058 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0)))) 1107 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
1059 .WillOnce(testing::Return(scroll_result_did_not_scroll_)); 1108 .WillOnce(testing::Return(scroll_result_did_not_scroll_));
1109 EXPECT_CALL(mock_input_handler_, ScrollingShouldSwitchtoMainThread())
1110 .WillOnce(testing::Return(false));
1060 1111
1061 // When scroll latching is enabled, ScrollEnd gets called when the last 1112 // When scroll latching is enabled, ScrollEnd gets called when the last
1062 // ScrollBy did not scroll. 1113 // ScrollBy did not scroll.
1063 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 1114 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1064 time += base::TimeDelta::FromMilliseconds(100); 1115 time += base::TimeDelta::FromMilliseconds(100);
1065 Animate(time); 1116 Animate(time);
1066 1117
1067 VERIFY_AND_RESET_MOCKS(); 1118 VERIFY_AND_RESET_MOCKS();
1068 1119
1069 // Fling has ended, the last Animate won't cause any more wheel ticks. 1120 // Fling has ended, the last Animate won't cause any more wheel ticks.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 expected_disposition_ = InputHandlerProxy::DROP_EVENT; 1164 expected_disposition_ = InputHandlerProxy::DROP_EVENT;
1114 VERIFY_AND_RESET_MOCKS(); 1165 VERIFY_AND_RESET_MOCKS();
1115 1166
1116 // Since the previous fling was ignored, we should also be dropping the next 1167 // Since the previous fling was ignored, we should also be dropping the next
1117 // fling_cancel. 1168 // fling_cancel.
1118 gesture_.setType(WebInputEvent::GestureFlingCancel); 1169 gesture_.setType(WebInputEvent::GestureFlingCancel);
1119 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad; 1170 gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
1120 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1171 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1121 } 1172 }
1122 1173
1123 TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) { 1174 void InputHandlerProxyTest::GestureFlingAnimatesTouchpad() {
1124 // We shouldn't send any events to the widget for this gesture. 1175 // We shouldn't send any events to the widget for this gesture.
1125 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 1176 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1126 VERIFY_AND_RESET_MOCKS(); 1177 VERIFY_AND_RESET_MOCKS();
1127 1178
1179 EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
1180 .WillOnce(testing::Return(kImplThreadScrollState));
1181
1182 // HandleGestureScrollBegin will set gesture_scroll_on_impl_thread_.
1183 gesture_.setType(WebInputEvent::GestureScrollBegin);
1184 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1185 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
sahel 2017/04/06 19:22:29 in latching implementation for handling fling on i
dtapuska 2017/04/06 20:11:25 Seems reasonable to me.
sahel 2017/04/07 18:10:24 Acknowledged.
1186
1187 VERIFY_AND_RESET_MOCKS();
1188
1128 // On the fling start, we should schedule an animation but not actually start 1189 // On the fling start, we should schedule an animation but not actually start
1129 // scrolling. 1190 // scrolling.
1130 gesture_.setType(WebInputEvent::GestureFlingStart); 1191 gesture_.setType(WebInputEvent::GestureFlingStart);
1131 WebFloatPoint fling_delta = WebFloatPoint(1000, 0); 1192 WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
1132 WebPoint fling_point = WebPoint(7, 13); 1193 WebPoint fling_point = WebPoint(7, 13);
1133 WebPoint fling_global_point = WebPoint(17, 23); 1194 WebPoint fling_global_point = WebPoint(17, 23);
1134 // Note that for trackpad, wheel events with the Control modifier are 1195 // Note that for trackpad, wheel events with the Control modifier are
1135 // special (reserved for zoom), so don't set that here. 1196 // special (reserved for zoom), so don't set that here.
1136 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; 1197 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey;
1137 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, 1198 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad,
1138 fling_delta, 1199 fling_delta,
1139 fling_point, 1200 fling_point,
1140 fling_global_point, 1201 fling_global_point,
1141 modifiers); 1202 modifiers);
1142 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1203 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1143 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1204 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1144 .WillOnce(testing::Return(kImplThreadScrollState)); 1205 .WillOnce(testing::Return(kImplThreadScrollState));
1145 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 1206 if (!touchpad_and_wheel_scroll_latching_enabled_)
1207 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1146 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1208 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1147 1209
1148 VERIFY_AND_RESET_MOCKS(); 1210 VERIFY_AND_RESET_MOCKS();
1149 1211
1150 // The first animate call should let us pick up an animation start time, but 1212 // The first animate call should let us pick up an animation start time, but
1151 // we shouldn't actually move anywhere just yet. The first frame after the 1213 // we shouldn't actually move anywhere just yet. The first frame after the
1152 // fling start will typically include the last scroll from the gesture that 1214 // fling start will typically include the last scroll from the gesture that
1153 // lead to the scroll (either wheel or gesture scroll), so there should be no 1215 // lead to the scroll (either wheel or gesture scroll), so there should be no
1154 // visible hitch. 1216 // visible hitch.
1155 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1217 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1156 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1218 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1157 .Times(0); 1219 .Times(0);
1158 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); 1220 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
1159 Animate(time); 1221 Animate(time);
1160 1222
1161 VERIFY_AND_RESET_MOCKS(); 1223 VERIFY_AND_RESET_MOCKS();
1162 1224
1163 // The second call should start scrolling in the -X direction. 1225 // The second call should start scrolling in the -X direction.
1164 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1226 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1165 EXPECT_CALL(mock_input_handler_, 1227 EXPECT_CALL(mock_input_handler_,
1166 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 1228 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1167 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 1229 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1168 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1230 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1169 .WillOnce(testing::Return(kImplThreadScrollState)); 1231 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1232 .WillOnce(testing::Return(kImplThreadScrollState));
1233 }
1170 EXPECT_CALL( 1234 EXPECT_CALL(
1171 mock_input_handler_, 1235 mock_input_handler_,
1172 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0)))) 1236 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
1173 .WillOnce(testing::Return(scroll_result_did_scroll_)); 1237 .WillOnce(testing::Return(scroll_result_did_scroll_));
1174 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 1238 if (!touchpad_and_wheel_scroll_latching_enabled_)
1239 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1175 time += base::TimeDelta::FromMilliseconds(100); 1240 time += base::TimeDelta::FromMilliseconds(100);
1176 Animate(time); 1241 Animate(time);
1177 1242
1178 VERIFY_AND_RESET_MOCKS(); 1243 VERIFY_AND_RESET_MOCKS();
1179 1244
1180 // Let's say on the third call we hit a non-scrollable region. We should abort 1245 // Let's say on the third call we hit a non-scrollable region. We should abort
1181 // the fling and not scroll. 1246 // the fling and not scroll.
1182 // We also should pass the current fling parameters out to the client so the 1247 // We also should pass the current fling parameters out to the client so the
1183 // rest of the fling can be 1248 // rest of the fling can be
1184 // transferred to the main thread. 1249 // transferred to the main thread.
1185 EXPECT_CALL(mock_input_handler_, 1250 EXPECT_CALL(mock_input_handler_,
1186 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 1251 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1187 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 1252 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1188 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1253 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1189 .WillOnce(testing::Return(kMainThreadScrollState)); 1254 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1190 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0); 1255 .WillOnce(testing::Return(kMainThreadScrollState));
1191 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0); 1256
1257 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0);
1258 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0);
1259 } else {
1260 EXPECT_CALL(
1261 mock_input_handler_,
1262 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
1263 .WillOnce(testing::Return(scroll_result_did_not_scroll_));
1264 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1265 EXPECT_CALL(mock_input_handler_, ScrollingShouldSwitchtoMainThread())
1266 .WillOnce(testing::Return(true));
1267 }
1192 // Expected wheel fling animation parameters: 1268 // Expected wheel fling animation parameters:
1193 // *) fling_delta and fling_point should match the original GestureFlingStart 1269 // *) fling_delta and fling_point should match the original GestureFlingStart
1194 // event 1270 // event
1195 // *) startTime should be 10 to match the time parameter of the first 1271 // *) startTime should be 10 to match the time parameter of the first
1196 // Animate() call after the GestureFlingStart 1272 // Animate() call after the GestureFlingStart
1197 // *) cumulativeScroll depends on the curve, but since we've animated in the 1273 // *) cumulativeScroll depends on the curve, but since we've animated in the
1198 // -X direction the X value should be < 0 1274 // -X direction the X value should be < 0
1199 EXPECT_CALL( 1275 EXPECT_CALL(
1200 mock_client_, 1276 mock_client_,
1201 TransferActiveWheelFlingAnimation(testing::AllOf( 1277 TransferActiveWheelFlingAnimation(testing::AllOf(
(...skipping 25 matching lines...) Expand all
1227 1303
1228 // Since we've transferred the fling to the main thread, we need to pass the 1304 // Since we've transferred the fling to the main thread, we need to pass the
1229 // next GestureFlingCancel to the main 1305 // next GestureFlingCancel to the main
1230 // thread as well. 1306 // thread as well.
1231 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; 1307 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
1232 gesture_.setType(WebInputEvent::GestureFlingCancel); 1308 gesture_.setType(WebInputEvent::GestureFlingCancel);
1233 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1309 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1234 1310
1235 VERIFY_AND_RESET_MOCKS(); 1311 VERIFY_AND_RESET_MOCKS();
1236 } 1312 }
1313 TEST_P(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
1314 GestureFlingAnimatesTouchpad();
1315 }
1316 TEST_P(InputHandlerProxyWithoutWheelScrollLatchingTest,
1317 GestureFlingAnimatesTouchpad) {
1318 GestureFlingAnimatesTouchpad();
1319 }
1237 1320
1238 TEST_P(InputHandlerProxyTest, GestureFlingPassiveListener) { 1321 void InputHandlerProxyTest::GestureFlingPassiveListener() {
1239 // We shouldn't send any events to the widget for this gesture. 1322 // We shouldn't send any events to the widget for this gesture.
1240 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 1323 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1241 VERIFY_AND_RESET_MOCKS(); 1324 VERIFY_AND_RESET_MOCKS();
1242 1325
1326 EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
1327 .WillOnce(testing::Return(kImplThreadScrollState));
1328
1329 // HandleGestureScrollBegin will set gesture_scroll_on_impl_thread_.
1330 gesture_.setType(WebInputEvent::GestureScrollBegin);
1331 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1332 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
1333
1334 VERIFY_AND_RESET_MOCKS();
1335
1243 // On the fling start, we should schedule an animation but not actually start 1336 // On the fling start, we should schedule an animation but not actually start
1244 // scrolling. 1337 // scrolling.
1245 gesture_.setType(WebInputEvent::GestureFlingStart); 1338 gesture_.setType(WebInputEvent::GestureFlingStart);
1246 WebFloatPoint fling_delta = WebFloatPoint(1000, 0); 1339 WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
1247 WebPoint fling_point = WebPoint(7, 13); 1340 WebPoint fling_point = WebPoint(7, 13);
1248 WebPoint fling_global_point = WebPoint(17, 23); 1341 WebPoint fling_global_point = WebPoint(17, 23);
1249 // Note that for trackpad, wheel events with the Control modifier are 1342 // Note that for trackpad, wheel events with the Control modifier are
1250 // special (reserved for zoom), so don't set that here. 1343 // special (reserved for zoom), so don't set that here.
1251 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; 1344 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey;
1252 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, fling_delta, 1345 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, fling_delta,
1253 fling_point, fling_global_point, modifiers); 1346 fling_point, fling_global_point, modifiers);
1254 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1347 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1255 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1348 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1256 .WillOnce(testing::Return(kImplThreadScrollState)); 1349 .WillOnce(testing::Return(kImplThreadScrollState));
1257 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 1350 if (!touchpad_and_wheel_scroll_latching_enabled_)
1351 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1258 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1352 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1259 1353
1260 VERIFY_AND_RESET_MOCKS(); 1354 VERIFY_AND_RESET_MOCKS();
1261 1355
1262 // The first animate call should let us pick up an animation start time, but 1356 // The first animate call should let us pick up an animation start time, but
1263 // we shouldn't actually move anywhere just yet. The first frame after the 1357 // we shouldn't actually move anywhere just yet. The first frame after the
1264 // fling start will typically include the last scroll from the gesture that 1358 // fling start will typically include the last scroll from the gesture that
1265 // lead to the scroll (either wheel or gesture scroll), so there should be no 1359 // lead to the scroll (either wheel or gesture scroll), so there should be no
1266 // visible hitch. 1360 // visible hitch.
1267 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1361 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1268 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1362 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1269 .Times(0); 1363 .Times(0);
1270 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); 1364 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
1271 Animate(time); 1365 Animate(time);
1272 1366
1273 VERIFY_AND_RESET_MOCKS(); 1367 VERIFY_AND_RESET_MOCKS();
1274 1368
1275 // The second call should punt activate the fling and call the method 1369 // The second call should punt activate the fling and call the method
1276 // dispatching the events for the passive event listeners. 1370 // dispatching the events for the passive event listeners.
1277 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1371 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1278 EXPECT_CALL(mock_input_handler_, 1372 EXPECT_CALL(mock_input_handler_,
1279 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 1373 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1280 .WillOnce(testing::Return(cc::EventListenerProperties::kPassive)); 1374 .WillOnce(testing::Return(cc::EventListenerProperties::kPassive));
1281 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1375 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1282 .WillOnce(testing::Return(kImplThreadScrollState)); 1376 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1377 .WillOnce(testing::Return(kImplThreadScrollState));
1378 }
1283 EXPECT_CALL( 1379 EXPECT_CALL(
1284 mock_input_handler_, 1380 mock_input_handler_,
1285 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0)))) 1381 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
1286 .WillOnce(testing::Return(scroll_result_did_scroll_)); 1382 .WillOnce(testing::Return(scroll_result_did_scroll_));
1287 WebMouseWheelEvent expected_wheel(WebInputEvent::MouseWheel, modifiers, 1383 WebMouseWheelEvent expected_wheel(WebInputEvent::MouseWheel, modifiers,
1288 WebInputEvent::TimeStampForTesting); 1384 WebInputEvent::TimeStampForTesting);
1289 expected_wheel.setPositionInWidget(fling_point.x, fling_point.y); 1385 expected_wheel.setPositionInWidget(fling_point.x, fling_point.y);
1290 expected_wheel.setPositionInScreen(fling_global_point.x, 1386 expected_wheel.setPositionInScreen(fling_global_point.x,
1291 fling_global_point.y); 1387 fling_global_point.y);
1292 expected_wheel.deltaX = fling_delta.x / 10; 1388 expected_wheel.deltaX = fling_delta.x / 10;
1293 expected_wheel.hasPreciseScrollingDeltas = true; 1389 expected_wheel.hasPreciseScrollingDeltas = true;
1294 1390
1295 EXPECT_CALL(mock_client_, DispatchNonBlockingEventToMainThread_( 1391 EXPECT_CALL(mock_client_, DispatchNonBlockingEventToMainThread_(
1296 WheelEventsMatch(expected_wheel))) 1392 WheelEventsMatch(expected_wheel)))
1297 .Times(1); 1393 .Times(1);
1298 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(1); 1394 if (!touchpad_and_wheel_scroll_latching_enabled_)
1395 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(1);
1299 1396
1300 time += base::TimeDelta::FromMilliseconds(100); 1397 time += base::TimeDelta::FromMilliseconds(100);
1301 Animate(time); 1398 Animate(time);
1302 1399
1303 VERIFY_AND_RESET_MOCKS(); 1400 VERIFY_AND_RESET_MOCKS();
1304 1401
1305 // Ensure we can cancel the gesture. 1402 // Ensure we can cancel the gesture.
1306 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 1403 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1307 gesture_.setType(WebInputEvent::GestureFlingCancel); 1404 gesture_.setType(WebInputEvent::GestureFlingCancel);
1308 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1405 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1406 if (touchpad_and_wheel_scroll_latching_enabled_) {
1407 // The fling cancellation should be deferred.
1408 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0);
1409 }
1309 1410
1310 VERIFY_AND_RESET_MOCKS(); 1411 VERIFY_AND_RESET_MOCKS();
1311 } 1412 }
1413 TEST_P(InputHandlerProxyTest, GestureFlingPassiveListener) {
1414 GestureFlingPassiveListener();
1415 }
1416 TEST_P(InputHandlerProxyWithoutWheelScrollLatchingTest,
1417 GestureFlingPassiveListener) {
1418 GestureFlingPassiveListener();
1419 }
1312 1420
1313 TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) { 1421 void InputHandlerProxyTest::GestureFlingTransferResetsTouchpad() {
1314 // We shouldn't send any events to the widget for this gesture. 1422 // We shouldn't send any events to the widget for this gesture.
1315 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 1423 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1316 VERIFY_AND_RESET_MOCKS(); 1424 VERIFY_AND_RESET_MOCKS();
1317 1425
1426 EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
1427 .WillOnce(testing::Return(kImplThreadScrollState));
1428
1429 // HandleGestureScrollBegin will set gesture_scroll_on_impl_thread_.
1430 gesture_.setType(WebInputEvent::GestureScrollBegin);
1431 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1432 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
1433
1434 VERIFY_AND_RESET_MOCKS();
1435
1318 // Start a gesture fling in the -X direction with zero Y movement. 1436 // Start a gesture fling in the -X direction with zero Y movement.
1319 WebFloatPoint fling_delta = WebFloatPoint(1000, 0); 1437 WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
1320 WebPoint fling_point = WebPoint(7, 13); 1438 WebPoint fling_point = WebPoint(7, 13);
1321 WebPoint fling_global_point = WebPoint(17, 23); 1439 WebPoint fling_global_point = WebPoint(17, 23);
1322 // Note that for trackpad, wheel events with the Control modifier are 1440 // Note that for trackpad, wheel events with the Control modifier are
1323 // special (reserved for zoom), so don't set that here. 1441 // special (reserved for zoom), so don't set that here.
1324 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey; 1442 int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey;
1325 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, 1443 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad,
1326 fling_delta, 1444 fling_delta,
1327 fling_point, 1445 fling_point,
1328 fling_global_point, 1446 fling_global_point,
1329 modifiers); 1447 modifiers);
1330 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1448 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1331 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1449 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1332 .WillOnce(testing::Return(kImplThreadScrollState)); 1450 .WillOnce(testing::Return(kImplThreadScrollState));
1333 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 1451 if (!touchpad_and_wheel_scroll_latching_enabled_)
1452 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1334 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1453 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1335 VERIFY_AND_RESET_MOCKS(); 1454 VERIFY_AND_RESET_MOCKS();
1336 1455
1337 // Start the fling animation at time 10. This shouldn't actually scroll, just 1456 // Start the fling animation at time 10. This shouldn't actually scroll, just
1338 // establish a start time. 1457 // establish a start time.
1339 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1458 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1340 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1459 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1341 .Times(0); 1460 .Times(0);
1342 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); 1461 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
1343 Animate(time); 1462 Animate(time);
1344 1463
1345 VERIFY_AND_RESET_MOCKS(); 1464 VERIFY_AND_RESET_MOCKS();
1346 1465
1347 // The second call should start scrolling in the -X direction. 1466 // The second call should start scrolling in the -X direction.
1348 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1467 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1349 EXPECT_CALL(mock_input_handler_, 1468 EXPECT_CALL(mock_input_handler_,
1350 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 1469 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1351 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 1470 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1352 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1471 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1353 .WillOnce(testing::Return(kImplThreadScrollState)); 1472 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1473 .WillOnce(testing::Return(kImplThreadScrollState));
1474 }
1354 EXPECT_CALL( 1475 EXPECT_CALL(
1355 mock_input_handler_, 1476 mock_input_handler_,
1356 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0)))) 1477 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
1357 .WillOnce(testing::Return(scroll_result_did_scroll_)); 1478 .WillOnce(testing::Return(scroll_result_did_scroll_));
1358 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 1479 if (!touchpad_and_wheel_scroll_latching_enabled_)
1480 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1359 time += base::TimeDelta::FromMilliseconds(100); 1481 time += base::TimeDelta::FromMilliseconds(100);
1360 Animate(time); 1482 Animate(time);
1361 1483
1362 VERIFY_AND_RESET_MOCKS(); 1484 VERIFY_AND_RESET_MOCKS();
1363 1485
1364 // Let's say on the third call we hit a non-scrollable region. We should abort 1486 // Let's say on the third call we hit a non-scrollable region. We should abort
1365 // the fling and not scroll. 1487 // the fling and not scroll.
1366 // We also should pass the current fling parameters out to the client so the 1488 // We also should pass the current fling parameters out to the client so the
1367 // rest of the fling can be 1489 // rest of the fling can be
1368 // transferred to the main thread. 1490 // transferred to the main thread.
1369 EXPECT_CALL(mock_input_handler_, 1491 EXPECT_CALL(mock_input_handler_,
1370 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 1492 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1371 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 1493 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1372 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1494 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1373 .WillOnce(testing::Return(kMainThreadScrollState)); 1495 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1374 1496 .WillOnce(testing::Return(kMainThreadScrollState));
1375 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0); 1497 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0);
1376 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0); 1498 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0);
1499 } else {
1500 EXPECT_CALL(
1501 mock_input_handler_,
1502 ScrollBy(testing::Property(&cc::ScrollState::delta_x, testing::Lt(0))))
1503 .WillOnce(testing::Return(scroll_result_did_not_scroll_));
1504 EXPECT_CALL(mock_input_handler_, ScrollingShouldSwitchtoMainThread())
1505 .WillOnce(testing::Return(true));
1506 }
1377 1507
1378 // Expected wheel fling animation parameters: 1508 // Expected wheel fling animation parameters:
1379 // *) fling_delta and fling_point should match the original GestureFlingStart 1509 // *) fling_delta and fling_point should match the original GestureFlingStart
1380 // event 1510 // event
1381 // *) startTime should be 10 to match the time parameter of the first 1511 // *) startTime should be 10 to match the time parameter of the first
1382 // Animate() call after the GestureFlingStart 1512 // Animate() call after the GestureFlingStart
1383 // *) cumulativeScroll depends on the curve, but since we've animated in the 1513 // *) cumulativeScroll depends on the curve, but since we've animated in the
1384 // -X direction the X value should be < 0 1514 // -X direction the X value should be < 0
1385 EXPECT_CALL( 1515 EXPECT_CALL(
1386 mock_client_, 1516 mock_client_,
1387 TransferActiveWheelFlingAnimation(testing::AllOf( 1517 TransferActiveWheelFlingAnimation(testing::AllOf(
1388 testing::Field(&WebActiveWheelFlingParameters::delta, 1518 testing::Field(&WebActiveWheelFlingParameters::delta,
1389 testing::Eq(fling_delta)), 1519 testing::Eq(fling_delta)),
1390 testing::Field(&WebActiveWheelFlingParameters::point, 1520 testing::Field(&WebActiveWheelFlingParameters::point,
1391 testing::Eq(fling_point)), 1521 testing::Eq(fling_point)),
1392 testing::Field(&WebActiveWheelFlingParameters::globalPoint, 1522 testing::Field(&WebActiveWheelFlingParameters::globalPoint,
1393 testing::Eq(fling_global_point)), 1523 testing::Eq(fling_global_point)),
1394 testing::Field(&WebActiveWheelFlingParameters::modifiers, 1524 testing::Field(&WebActiveWheelFlingParameters::modifiers,
1395 testing::Eq(modifiers)), 1525 testing::Eq(modifiers)),
1396 testing::Field(&WebActiveWheelFlingParameters::startTime, 1526 testing::Field(&WebActiveWheelFlingParameters::startTime,
1397 testing::Eq(10)), 1527 testing::Eq(10)),
1398 testing::Field(&WebActiveWheelFlingParameters::cumulativeScroll, 1528 testing::Field(&WebActiveWheelFlingParameters::cumulativeScroll,
1399 testing::Field(&WebSize::width, testing::Gt(0)))))); 1529 testing::Field(&WebSize::width, testing::Gt(0))))));
1530 if (touchpad_and_wheel_scroll_latching_enabled_)
1531 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1532
1400 time += base::TimeDelta::FromMilliseconds(100); 1533 time += base::TimeDelta::FromMilliseconds(100);
1401 Animate(time); 1534 Animate(time);
1402 1535
1403 VERIFY_AND_RESET_MOCKS(); 1536 VERIFY_AND_RESET_MOCKS();
1404 1537
1405 // Since we've aborted the fling, the next animation should be a no-op and 1538 // Since we've aborted the fling, the next animation should be a no-op and
1406 // should not result in another 1539 // should not result in another
1407 // frame being requested. 1540 // frame being requested.
1408 EXPECT_SET_NEEDS_ANIMATE_INPUT(0); 1541 EXPECT_SET_NEEDS_ANIMATE_INPUT(0);
1409 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1542 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1410 .Times(0); 1543 .Times(0);
1411 time += base::TimeDelta::FromMilliseconds(100); 1544 time += base::TimeDelta::FromMilliseconds(100);
1412 Animate(time); 1545 Animate(time);
1413 1546
1414 VERIFY_AND_RESET_MOCKS(); 1547 VERIFY_AND_RESET_MOCKS();
1415 1548
1416 // Since we've transferred the fling to the main thread, we need to pass the 1549 // Since we've transferred the fling to the main thread, we need to pass the
1417 // next GestureFlingCancel to the main 1550 // next GestureFlingCancel to the main
1418 // thread as well. 1551 // thread as well.
1419 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; 1552 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
1420 gesture_.setType(WebInputEvent::GestureFlingCancel); 1553 gesture_.setType(WebInputEvent::GestureFlingCancel);
1421 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1554 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1422 1555
1423 VERIFY_AND_RESET_MOCKS(); 1556 VERIFY_AND_RESET_MOCKS();
1424 input_handler_->MainThreadHasStoppedFlinging(); 1557 input_handler_->MainThreadHasStoppedFlinging();
1425 1558
1559 EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
1560 .WillOnce(testing::Return(kImplThreadScrollState));
1561
1562 // HandleGestureScrollBegin will set gesture_scroll_on_impl_thread_.
1563 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1564 gesture_.setType(WebInputEvent::GestureScrollBegin);
1565 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1566 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
1567
1568 VERIFY_AND_RESET_MOCKS();
1569
1426 // Start a second gesture fling, this time in the +Y direction with no X. 1570 // Start a second gesture fling, this time in the +Y direction with no X.
1427 fling_delta = WebFloatPoint(0, -1000); 1571 fling_delta = WebFloatPoint(0, -1000);
1428 fling_point = WebPoint(95, 87); 1572 fling_point = WebPoint(95, 87);
1429 fling_global_point = WebPoint(32, 71); 1573 fling_global_point = WebPoint(32, 71);
1430 modifiers = WebInputEvent::AltKey; 1574 modifiers = WebInputEvent::AltKey;
1431 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad, 1575 gesture_ = CreateFling(blink::WebGestureDeviceTouchpad,
1432 fling_delta, 1576 fling_delta,
1433 fling_point, 1577 fling_point,
1434 fling_global_point, 1578 fling_global_point,
1435 modifiers); 1579 modifiers);
1436 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1580 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1437 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1581 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1438 .WillOnce(testing::Return(kImplThreadScrollState)); 1582 .WillOnce(testing::Return(kImplThreadScrollState));
1439 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 1583 if (!touchpad_and_wheel_scroll_latching_enabled_)
1584 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1440 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 1585 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1441 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 1586 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1442 1587
1443 VERIFY_AND_RESET_MOCKS(); 1588 VERIFY_AND_RESET_MOCKS();
1444 1589
1445 // Start the second fling animation at time 30. 1590 // Start the second fling animation at time 30.
1446 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1591 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1447 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1592 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1448 .Times(0); 1593 .Times(0);
1449 time = base::TimeTicks() + base::TimeDelta::FromSeconds(30); 1594 time = base::TimeTicks() + base::TimeDelta::FromSeconds(30);
1450 Animate(time); 1595 Animate(time);
1451 1596
1452 VERIFY_AND_RESET_MOCKS(); 1597 VERIFY_AND_RESET_MOCKS();
1453 1598
1454 // Tick the second fling once normally. 1599 // Tick the second fling once normally.
1455 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 1600 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1456 EXPECT_CALL(mock_input_handler_, 1601 EXPECT_CALL(mock_input_handler_,
1457 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 1602 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1458 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 1603 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1459 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1604 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1460 .WillOnce(testing::Return(kImplThreadScrollState)); 1605 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1606 .WillOnce(testing::Return(kImplThreadScrollState));
1607 }
1461 EXPECT_CALL( 1608 EXPECT_CALL(
1462 mock_input_handler_, 1609 mock_input_handler_,
1463 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0)))) 1610 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
1464 .WillOnce(testing::Return(scroll_result_did_scroll_)); 1611 .WillOnce(testing::Return(scroll_result_did_scroll_));
1465 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 1612 if (!touchpad_and_wheel_scroll_latching_enabled_)
1613 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1466 time += base::TimeDelta::FromMilliseconds(100); 1614 time += base::TimeDelta::FromMilliseconds(100);
1467 Animate(time); 1615 Animate(time);
1468 1616
1469 VERIFY_AND_RESET_MOCKS(); 1617 VERIFY_AND_RESET_MOCKS();
1470 1618
1471 // Then abort the second fling. 1619 // Then abort the second fling.
1472 EXPECT_CALL(mock_input_handler_, 1620 EXPECT_CALL(mock_input_handler_,
1473 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 1621 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1474 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 1622 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1475 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1623 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1476 .WillOnce(testing::Return(kMainThreadScrollState)); 1624 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1477 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0); 1625 .WillOnce(testing::Return(kMainThreadScrollState));
1478 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0); 1626 EXPECT_CALL(mock_input_handler_, ScrollBy(testing::_)).Times(0);
1627 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)).Times(0);
1628 } else {
1629 EXPECT_CALL(
1630 mock_input_handler_,
1631 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
1632 .WillOnce(testing::Return(scroll_result_did_not_scroll_));
1633 EXPECT_CALL(mock_input_handler_, ScrollingShouldSwitchtoMainThread())
1634 .WillOnce(testing::Return(true));
1635 }
1479 1636
1480 // We should get parameters from the second fling, nothing from the first 1637 // We should get parameters from the second fling, nothing from the first
1481 // fling should "leak". 1638 // fling should "leak".
1482 EXPECT_CALL( 1639 EXPECT_CALL(
1483 mock_client_, 1640 mock_client_,
1484 TransferActiveWheelFlingAnimation(testing::AllOf( 1641 TransferActiveWheelFlingAnimation(testing::AllOf(
1485 testing::Field(&WebActiveWheelFlingParameters::delta, 1642 testing::Field(&WebActiveWheelFlingParameters::delta,
1486 testing::Eq(fling_delta)), 1643 testing::Eq(fling_delta)),
1487 testing::Field(&WebActiveWheelFlingParameters::point, 1644 testing::Field(&WebActiveWheelFlingParameters::point,
1488 testing::Eq(fling_point)), 1645 testing::Eq(fling_point)),
1489 testing::Field(&WebActiveWheelFlingParameters::globalPoint, 1646 testing::Field(&WebActiveWheelFlingParameters::globalPoint,
1490 testing::Eq(fling_global_point)), 1647 testing::Eq(fling_global_point)),
1491 testing::Field(&WebActiveWheelFlingParameters::modifiers, 1648 testing::Field(&WebActiveWheelFlingParameters::modifiers,
1492 testing::Eq(modifiers)), 1649 testing::Eq(modifiers)),
1493 testing::Field(&WebActiveWheelFlingParameters::startTime, 1650 testing::Field(&WebActiveWheelFlingParameters::startTime,
1494 testing::Eq(30)), 1651 testing::Eq(30)),
1495 testing::Field(&WebActiveWheelFlingParameters::cumulativeScroll, 1652 testing::Field(&WebActiveWheelFlingParameters::cumulativeScroll,
1496 testing::Field(&WebSize::height, testing::Lt(0)))))); 1653 testing::Field(&WebSize::height, testing::Lt(0))))));
1654
1655 if (touchpad_and_wheel_scroll_latching_enabled_)
1656 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1657
1497 time += base::TimeDelta::FromMilliseconds(100); 1658 time += base::TimeDelta::FromMilliseconds(100);
1498 Animate(time); 1659 Animate(time);
1499 1660
1500 VERIFY_AND_RESET_MOCKS(); 1661 VERIFY_AND_RESET_MOCKS();
1501 } 1662 }
1663 TEST_P(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
1664 GestureFlingTransferResetsTouchpad();
1665 }
1666 TEST_P(InputHandlerProxyWithoutWheelScrollLatchingTest,
1667 GestureFlingTransferResetsTouchpad) {
1668 GestureFlingTransferResetsTouchpad();
1669 }
1502 1670
1503 TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchscreen) { 1671 TEST_P(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
1504 // We shouldn't send any events to the widget for this gesture. 1672 // We shouldn't send any events to the widget for this gesture.
1505 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 1673 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1506 VERIFY_AND_RESET_MOCKS(); 1674 VERIFY_AND_RESET_MOCKS();
1507 1675
1508 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 1676 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1509 .WillOnce(testing::Return(kImplThreadScrollState)); 1677 .WillOnce(testing::Return(kImplThreadScrollState));
1510 gesture_.setType(WebInputEvent::GestureScrollBegin); 1678 gesture_.setType(WebInputEvent::GestureScrollBegin);
1511 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen; 1679 gesture_.sourceDevice = blink::WebGestureDeviceTouchscreen;
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 2067
1900 gesture_.setType(WebInputEvent::GestureScrollBegin); 2068 gesture_.setType(WebInputEvent::GestureScrollBegin);
1901 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 2069 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1902 2070
1903 // After sending a GestureScrollBegin, the member variable 2071 // After sending a GestureScrollBegin, the member variable
1904 // |gesture_scroll_on_impl_thread_| should be true. 2072 // |gesture_scroll_on_impl_thread_| should be true.
1905 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); 2073 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
1906 VERIFY_AND_RESET_MOCKS(); 2074 VERIFY_AND_RESET_MOCKS();
1907 } 2075 }
1908 2076
1909 TEST_P(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) { 2077 void InputHandlerProxyTest::GestureFlingStopsAtContentEdge() {
1910 // We shouldn't send any events to the widget for this gesture. 2078 // We shouldn't send any events to the widget for this gesture.
1911 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 2079 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1912 VERIFY_AND_RESET_MOCKS(); 2080 VERIFY_AND_RESET_MOCKS();
1913 2081
2082 EXPECT_CALL(mock_input_handler_, ScrollBegin(::testing::_, ::testing::_))
2083 .WillOnce(testing::Return(kImplThreadScrollState));
2084
2085 // HandleGestureScrollBegin will set gesture_scroll_on_impl_thread_.
2086 gesture_.setType(WebInputEvent::GestureScrollBegin);
2087 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
2088 EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
2089
2090 VERIFY_AND_RESET_MOCKS();
2091
1914 // On the fling start, we should schedule an animation but not actually start 2092 // On the fling start, we should schedule an animation but not actually start
1915 // scrolling. 2093 // scrolling.
1916 gesture_.setType(WebInputEvent::GestureFlingStart); 2094 gesture_.setType(WebInputEvent::GestureFlingStart);
1917 WebFloatPoint fling_delta = WebFloatPoint(100, 100); 2095 WebFloatPoint fling_delta = WebFloatPoint(100, 100);
1918 gesture_.data.flingStart.velocityX = fling_delta.x; 2096 gesture_.data.flingStart.velocityX = fling_delta.x;
1919 gesture_.data.flingStart.velocityY = fling_delta.y; 2097 gesture_.data.flingStart.velocityY = fling_delta.y;
1920 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 2098 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
1921 .WillOnce(testing::Return(kImplThreadScrollState)); 2099 .WillOnce(testing::Return(kImplThreadScrollState));
1922 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 2100 if (!touchpad_and_wheel_scroll_latching_enabled_)
2101 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1923 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 2102 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1924 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 2103 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
1925 VERIFY_AND_RESET_MOCKS(); 2104 VERIFY_AND_RESET_MOCKS();
1926 2105
1927 // The first animate doesn't cause any scrolling. 2106 // The first animate doesn't cause any scrolling.
1928 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 2107 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1929 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); 2108 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
1930 Animate(time); 2109 Animate(time);
1931 VERIFY_AND_RESET_MOCKS(); 2110 VERIFY_AND_RESET_MOCKS();
1932 2111
1933 // The second animate starts scrolling in the positive X and Y directions. 2112 // The second animate starts scrolling in the positive X and Y directions.
1934 EXPECT_CALL(mock_input_handler_, 2113 EXPECT_CALL(mock_input_handler_,
1935 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 2114 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1936 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 2115 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1937 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 2116 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1938 .WillOnce(testing::Return(kImplThreadScrollState)); 2117 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
2118 .WillOnce(testing::Return(kImplThreadScrollState));
2119 }
1939 EXPECT_CALL( 2120 EXPECT_CALL(
1940 mock_input_handler_, 2121 mock_input_handler_,
1941 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0)))) 2122 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0))))
1942 .WillOnce(testing::Return(scroll_result_did_scroll_)); 2123 .WillOnce(testing::Return(scroll_result_did_scroll_));
1943 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 2124 if (!touchpad_and_wheel_scroll_latching_enabled_)
2125 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1944 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 2126 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1945 time += base::TimeDelta::FromMilliseconds(100); 2127 time += base::TimeDelta::FromMilliseconds(100);
1946 Animate(time); 2128 Animate(time);
1947 VERIFY_AND_RESET_MOCKS(); 2129 VERIFY_AND_RESET_MOCKS();
1948 2130
1949 // The third animate overscrolls in the positive Y direction but scrolls 2131 // The third animate overscrolls in the positive Y direction but scrolls
1950 // somewhat. 2132 // somewhat.
1951 cc::InputHandlerScrollResult overscroll; 2133 cc::InputHandlerScrollResult overscroll;
1952 overscroll.did_scroll = true; 2134 overscroll.did_scroll = true;
1953 overscroll.did_overscroll_root = true; 2135 overscroll.did_overscroll_root = true;
1954 overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100); 2136 overscroll.accumulated_root_overscroll = gfx::Vector2dF(0, 100);
1955 overscroll.unused_scroll_delta = gfx::Vector2dF(0, 10); 2137 overscroll.unused_scroll_delta = gfx::Vector2dF(0, 10);
1956 EXPECT_CALL(mock_input_handler_, 2138 EXPECT_CALL(mock_input_handler_,
1957 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 2139 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1958 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 2140 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1959 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 2141 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1960 .WillOnce(testing::Return(kImplThreadScrollState)); 2142 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
2143 .WillOnce(testing::Return(kImplThreadScrollState));
2144 }
1961 EXPECT_CALL( 2145 EXPECT_CALL(
1962 mock_input_handler_, 2146 mock_input_handler_,
1963 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0)))) 2147 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Lt(0))))
1964 .WillOnce(testing::Return(overscroll)); 2148 .WillOnce(testing::Return(overscroll));
1965 EXPECT_CALL( 2149 EXPECT_CALL(
1966 mock_client_, 2150 mock_client_,
1967 DidOverscroll( 2151 DidOverscroll(
1968 overscroll.accumulated_root_overscroll, 2152 overscroll.accumulated_root_overscroll,
1969 overscroll.unused_scroll_delta, 2153 overscroll.unused_scroll_delta,
1970 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)), 2154 testing::Property(&gfx::Vector2dF::y, testing::Lt(0)),
1971 testing::_)); 2155 testing::_));
1972 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 2156 if (!touchpad_and_wheel_scroll_latching_enabled_)
2157 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1973 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 2158 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1974 time += base::TimeDelta::FromMilliseconds(100); 2159 time += base::TimeDelta::FromMilliseconds(100);
1975 Animate(time); 2160 Animate(time);
1976 VERIFY_AND_RESET_MOCKS(); 2161 VERIFY_AND_RESET_MOCKS();
1977 2162
1978 // The next call to animate will no longer scroll vertically. 2163 // The next call to animate will no longer scroll vertically.
1979 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 2164 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
1980 EXPECT_CALL(mock_input_handler_, 2165 EXPECT_CALL(mock_input_handler_,
1981 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel)) 2166 GetEventListenerProperties(cc::EventListenerClass::kMouseWheel))
1982 .WillOnce(testing::Return(cc::EventListenerProperties::kNone)); 2167 .WillOnce(testing::Return(cc::EventListenerProperties::kNone));
1983 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 2168 if (!touchpad_and_wheel_scroll_latching_enabled_) {
1984 .WillOnce(testing::Return(kImplThreadScrollState)); 2169 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
2170 .WillOnce(testing::Return(kImplThreadScrollState));
2171 }
1985 EXPECT_CALL( 2172 EXPECT_CALL(
1986 mock_input_handler_, 2173 mock_input_handler_,
1987 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Eq(0)))) 2174 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Eq(0))))
1988 .WillOnce(testing::Return(scroll_result_did_scroll_)); 2175 .WillOnce(testing::Return(scroll_result_did_scroll_));
1989 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 2176 if (!touchpad_and_wheel_scroll_latching_enabled_)
2177 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
1990 time += base::TimeDelta::FromMilliseconds(100); 2178 time += base::TimeDelta::FromMilliseconds(100);
1991 Animate(time); 2179 Animate(time);
1992 VERIFY_AND_RESET_MOCKS(); 2180 VERIFY_AND_RESET_MOCKS();
1993 } 2181 }
2182 TEST_P(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) {
2183 GestureFlingStopsAtContentEdge();
2184 }
2185 TEST_P(InputHandlerProxyWithoutWheelScrollLatchingTest,
2186 GestureFlingStopsAtContentEdge) {
2187 GestureFlingStopsAtContentEdge();
2188 }
1994 2189
1995 TEST_P(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) { 2190 TEST_P(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
1996 // We shouldn't send any events to the widget for this gesture. 2191 // We shouldn't send any events to the widget for this gesture.
1997 expected_disposition_ = InputHandlerProxy::DID_HANDLE; 2192 expected_disposition_ = InputHandlerProxy::DID_HANDLE;
1998 VERIFY_AND_RESET_MOCKS(); 2193 VERIFY_AND_RESET_MOCKS();
1999 2194
2000 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 2195 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
2001 .WillOnce(testing::Return(kImplThreadScrollState)); 2196 .WillOnce(testing::Return(kImplThreadScrollState));
2002 2197
2003 gesture_.setType(WebInputEvent::GestureScrollBegin); 2198 gesture_.setType(WebInputEvent::GestureScrollBegin);
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 3118
2924 // GestureScrollEnd should terminate the resumed scroll properly. 3119 // GestureScrollEnd should terminate the resumed scroll properly.
2925 time += dt; 3120 time += dt;
2926 gesture_.setTimeStampSeconds(InSecondsF(time)); 3121 gesture_.setTimeStampSeconds(InSecondsF(time));
2927 gesture_.setType(WebInputEvent::GestureScrollEnd); 3122 gesture_.setType(WebInputEvent::GestureScrollEnd);
2928 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 3123 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
2929 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_)); 3124 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
2930 3125
2931 VERIFY_AND_RESET_MOCKS(); 3126 VERIFY_AND_RESET_MOCKS();
2932 } 3127 }
2933 3128 void InputHandlerProxyTest::DidReceiveInputEvent_ForFling() {
2934 TEST_P(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
2935 testing::StrictMock<MockInputHandlerProxyClientWithDidAnimateForInput> 3129 testing::StrictMock<MockInputHandlerProxyClientWithDidAnimateForInput>
2936 mock_client; 3130 mock_client;
2937 input_handler_.reset( 3131 input_handler_.reset(
2938 new TestInputHandlerProxy(&mock_input_handler_, &mock_client, false)); 3132 new TestInputHandlerProxy(&mock_input_handler_, &mock_client,
3133 touchpad_and_wheel_scroll_latching_enabled_));
2939 if (install_synchronous_handler_) { 3134 if (install_synchronous_handler_) {
2940 EXPECT_CALL(mock_input_handler_, RequestUpdateForSynchronousInputHandler()) 3135 EXPECT_CALL(mock_input_handler_, RequestUpdateForSynchronousInputHandler())
2941 .Times(1); 3136 .Times(1);
2942 input_handler_->SetOnlySynchronouslyAnimateRootFlings( 3137 input_handler_->SetOnlySynchronouslyAnimateRootFlings(
2943 &mock_synchronous_input_handler_); 3138 &mock_synchronous_input_handler_);
2944 } 3139 }
2945 mock_input_handler_.set_is_scrolling_root(synchronous_root_scroll_); 3140 mock_input_handler_.set_is_scrolling_root(synchronous_root_scroll_);
2946 3141
2947 gesture_.setType(WebInputEvent::GestureFlingStart); 3142 gesture_.setType(WebInputEvent::GestureFlingStart);
2948 WebFloatPoint fling_delta = WebFloatPoint(100, 100); 3143 WebFloatPoint fling_delta = WebFloatPoint(100, 100);
2949 gesture_.data.flingStart.velocityX = fling_delta.x; 3144 gesture_.data.flingStart.velocityX = fling_delta.x;
2950 gesture_.data.flingStart.velocityY = fling_delta.y; 3145 gesture_.data.flingStart.velocityY = fling_delta.y;
2951 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 3146 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
2952 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_)) 3147 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
2953 .WillOnce(testing::Return(kImplThreadScrollState)); 3148 .WillOnce(testing::Return(kImplThreadScrollState));
2954 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_)); 3149 if (!touchpad_and_wheel_scroll_latching_enabled_)
3150 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_));
2955 EXPECT_EQ(InputHandlerProxy::DID_HANDLE, 3151 EXPECT_EQ(InputHandlerProxy::DID_HANDLE,
2956 input_handler_->HandleInputEvent(gesture_)); 3152 input_handler_->HandleInputEvent(gesture_));
2957 VERIFY_AND_RESET_MOCKS(); 3153 VERIFY_AND_RESET_MOCKS();
2958 3154
2959 EXPECT_SET_NEEDS_ANIMATE_INPUT(1); 3155 EXPECT_SET_NEEDS_ANIMATE_INPUT(1);
2960 EXPECT_CALL(mock_client, DidAnimateForInput()); 3156 EXPECT_CALL(mock_client, DidAnimateForInput());
2961 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); 3157 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
2962 Animate(time); 3158 Animate(time);
2963 3159
2964 VERIFY_AND_RESET_MOCKS(); 3160 VERIFY_AND_RESET_MOCKS();
2965 } 3161 }
3162 TEST_P(InputHandlerProxyTest, DidReceiveInputEvent_ForFling) {
3163 DidReceiveInputEvent_ForFling();
3164 }
3165 TEST_P(InputHandlerProxyWithoutWheelScrollLatchingTest,
3166 DidReceiveInputEvent_ForFling) {
3167 DidReceiveInputEvent_ForFling();
3168 }
2966 3169
2967 TEST(SynchronousInputHandlerProxyTest, StartupShutdown) { 3170 TEST(SynchronousInputHandlerProxyTest, StartupShutdown) {
2968 testing::StrictMock<MockInputHandler> mock_input_handler; 3171 testing::StrictMock<MockInputHandler> mock_input_handler;
2969 testing::StrictMock<MockInputHandlerProxyClient> mock_client; 3172 testing::StrictMock<MockInputHandlerProxyClient> mock_client;
2970 testing::StrictMock<MockSynchronousInputHandler> 3173 testing::StrictMock<MockSynchronousInputHandler>
2971 mock_synchronous_input_handler; 3174 mock_synchronous_input_handler;
2972 ui::InputHandlerProxy proxy(&mock_input_handler, &mock_client, false); 3175 ui::InputHandlerProxy proxy(&mock_input_handler, &mock_client, false);
2973 3176
2974 // When adding a SynchronousInputHandler, immediately request an 3177 // When adding a SynchronousInputHandler, immediately request an
2975 // UpdateRootLayerStateForSynchronousInputHandler() call. 3178 // UpdateRootLayerStateForSynchronousInputHandler() call.
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 // New ScrollBegin should be dispatched immediately as there is no on-going 3826 // New ScrollBegin should be dispatched immediately as there is no on-going
3624 // scroll, fling or pinch. 3827 // scroll, fling or pinch.
3625 HandleGestureEvent(WebInputEvent::GestureScrollBegin); 3828 HandleGestureEvent(WebInputEvent::GestureScrollBegin);
3626 EXPECT_EQ(0ul, event_queue().size()); 3829 EXPECT_EQ(0ul, event_queue().size());
3627 } 3830 }
3628 3831
3629 INSTANTIATE_TEST_CASE_P(AnimateInput, 3832 INSTANTIATE_TEST_CASE_P(AnimateInput,
3630 InputHandlerProxyTest, 3833 InputHandlerProxyTest,
3631 testing::ValuesIn(test_types)); 3834 testing::ValuesIn(test_types));
3632 3835
3836 INSTANTIATE_TEST_CASE_P(AnimateInput,
3837 InputHandlerProxyWithoutWheelScrollLatchingTest,
3838 testing::ValuesIn(test_types));
3839
3633 } // namespace test 3840 } // namespace test
3634 } // namespace ui 3841 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698