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

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

Issue 2744243009: [Compositor event queue] FlingCancel should clear on-going gesture flag (Closed)
Patch Set: Created 3 years, 9 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/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 3565 matching lines...) Expand 10 before | Expand all | Expand 10 after
3576 EXPECT_EQ(WebInputEvent::GestureFlingCancel, 3576 EXPECT_EQ(WebInputEvent::GestureFlingCancel,
3577 event_queue()[0]->event().type()); 3577 event_queue()[0]->event().type());
3578 input_handler_proxy_->DeliverInputForBeginFrame(); 3578 input_handler_proxy_->DeliverInputForBeginFrame();
3579 EXPECT_EQ(0ul, event_queue().size()); 3579 EXPECT_EQ(0ul, event_queue().size());
3580 EXPECT_EQ(5ul, event_disposition_recorder_.size()); 3580 EXPECT_EQ(5ul, event_disposition_recorder_.size());
3581 // Should stop scrolling. Note that no ScrollEnd was sent. 3581 // Should stop scrolling. Note that no ScrollEnd was sent.
3582 EXPECT_TRUE( 3582 EXPECT_TRUE(
3583 !input_handler_proxy_->gesture_scroll_on_impl_thread_for_testing()); 3583 !input_handler_proxy_->gesture_scroll_on_impl_thread_for_testing());
3584 } 3584 }
3585 3585
3586 TEST_F(InputHandlerProxyEventQueueTest, GestureScrollAfterFling) {
3587 // Handle scroll on compositor.
3588 cc::InputHandlerScrollResult scroll_result_did_scroll_;
3589 scroll_result_did_scroll_.did_scroll = true;
3590
3591 EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
3592 .WillRepeatedly(testing::Return(kImplThreadScrollState));
3593 EXPECT_CALL(mock_input_handler_, SetNeedsAnimateInput())
3594 .Times(::testing::AtLeast(1));
3595 EXPECT_CALL(
3596 mock_input_handler_,
3597 ScrollBy(testing::Property(&cc::ScrollState::delta_y, testing::Gt(0))))
3598 .WillRepeatedly(testing::Return(scroll_result_did_scroll_));
3599 EXPECT_CALL(mock_input_handler_, ScrollEnd(testing::_))
3600 .Times(::testing::AtLeast(1));
3601
3602 // Simulate fling.
3603 HandleGestureEvent(WebInputEvent::GestureScrollBegin);
3604 HandleGestureEvent(WebInputEvent::GestureScrollUpdate, -20);
3605 HandleGestureEvent(WebInputEvent::GestureFlingStart, -10);
3606 HandleGestureEvent(WebInputEvent::GestureFlingCancel);
3607
3608 // Dispatch events.
3609 input_handler_proxy_->DeliverInputForBeginFrame();
3610 EXPECT_EQ(0ul, event_queue().size());
3611 EXPECT_EQ(4ul, event_disposition_recorder_.size());
3612 EXPECT_FALSE(
3613 input_handler_proxy_->gesture_scroll_on_impl_thread_for_testing());
3614
3615 // New ScrollBegin should be dispatched immediately as there is no on-going
3616 // scroll, fling or pinch.
3617 HandleGestureEvent(WebInputEvent::GestureScrollBegin);
3618 EXPECT_EQ(0ul, event_queue().size());
3619 }
3620
3586 INSTANTIATE_TEST_CASE_P(AnimateInput, 3621 INSTANTIATE_TEST_CASE_P(AnimateInput,
3587 InputHandlerProxyTest, 3622 InputHandlerProxyTest,
3588 testing::ValuesIn(test_types)); 3623 testing::ValuesIn(test_types));
3589 3624
3590 } // namespace test 3625 } // namespace test
3591 } // namespace ui 3626 } // 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