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

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

Issue 784463002: Add initial CC support for scroll-blocks-on (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jdduke CR feedback Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/input/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 "content/renderer/input/input_handler_proxy.h" 5 #include "content/renderer/input/input_handler_proxy.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/swap_promise_monitor.h" 9 #include "cc/base/swap_promise_monitor.h"
10 #include "content/common/input/did_overscroll_params.h" 10 #include "content/common/input/did_overscroll_params.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 virtual void BindToClient(cc::InputHandlerClient* client) override {} 111 virtual void BindToClient(cc::InputHandlerClient* client) override {}
112 112
113 virtual void MouseMoveAt(const gfx::Point& mouse_position) override {} 113 virtual void MouseMoveAt(const gfx::Point& mouse_position) override {}
114 114
115 MOCK_METHOD2(IsCurrentlyScrollingLayerAt, 115 MOCK_METHOD2(IsCurrentlyScrollingLayerAt,
116 bool(const gfx::Point& point, 116 bool(const gfx::Point& point,
117 cc::InputHandler::ScrollInputType type)); 117 cc::InputHandler::ScrollInputType type));
118 118
119 MOCK_METHOD1(HaveWheelEventHandlersAt, bool(const gfx::Point& point)); 119 MOCK_METHOD1(HaveWheelEventHandlersAt, bool(const gfx::Point& point));
120 MOCK_METHOD1(HaveTouchEventHandlersAt, bool(const gfx::Point& point)); 120 MOCK_METHOD1(DoTouchEventsBlockScrollAt, bool(const gfx::Point& point));
121 121
122 virtual void SetRootLayerScrollOffsetDelegate( 122 virtual void SetRootLayerScrollOffsetDelegate(
123 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) 123 cc::LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate)
124 override {} 124 override {}
125 125
126 virtual void OnRootLayerDelegatedScrollOffsetChanged() override {} 126 virtual void OnRootLayerDelegatedScrollOffsetChanged() override {}
127 127
128 DISALLOW_COPY_AND_ASSIGN(MockInputHandler); 128 DISALLOW_COPY_AND_ASSIGN(MockInputHandler);
129 }; 129 };
130 130
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing()); 1494 EXPECT_FALSE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
1495 } 1495 }
1496 1496
1497 TEST_F(InputHandlerProxyTest, MultiTouchPointHitTestNegative) { 1497 TEST_F(InputHandlerProxyTest, MultiTouchPointHitTestNegative) {
1498 // None of the three touch points fall in the touch region. So the event 1498 // None of the three touch points fall in the touch region. So the event
1499 // should be dropped. 1499 // should be dropped.
1500 expected_disposition_ = InputHandlerProxy::DROP_EVENT; 1500 expected_disposition_ = InputHandlerProxy::DROP_EVENT;
1501 VERIFY_AND_RESET_MOCKS(); 1501 VERIFY_AND_RESET_MOCKS();
1502 1502
1503 EXPECT_CALL(mock_input_handler_, 1503 EXPECT_CALL(mock_input_handler_,
1504 HaveTouchEventHandlersAt( 1504 DoTouchEventsBlockScrollAt(
1505 testing::Property(&gfx::Point::x, testing::Gt(0)))) 1505 testing::Property(&gfx::Point::x, testing::Gt(0))))
1506 .WillOnce(testing::Return(false)); 1506 .WillOnce(testing::Return(false));
1507 EXPECT_CALL(mock_input_handler_, 1507 EXPECT_CALL(mock_input_handler_,
1508 HaveTouchEventHandlersAt( 1508 DoTouchEventsBlockScrollAt(
1509 testing::Property(&gfx::Point::x, testing::Lt(0)))) 1509 testing::Property(&gfx::Point::x, testing::Lt(0))))
1510 .WillOnce(testing::Return(false)); 1510 .WillOnce(testing::Return(false));
1511 1511
1512 WebTouchEvent touch; 1512 WebTouchEvent touch;
1513 touch.type = WebInputEvent::TouchStart; 1513 touch.type = WebInputEvent::TouchStart;
1514 1514
1515 touch.touchesLength = 3; 1515 touch.touchesLength = 3;
1516 touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StateStationary, 0, 0); 1516 touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StateStationary, 0, 0);
1517 touch.touches[1] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 10, 10); 1517 touch.touches[1] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 10, 10);
1518 touch.touches[2] = CreateWebTouchPoint(WebTouchPoint::StatePressed, -10, 10); 1518 touch.touches[2] = CreateWebTouchPoint(WebTouchPoint::StatePressed, -10, 10);
1519 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(touch)); 1519 EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(touch));
1520 } 1520 }
1521 1521
1522 TEST_F(InputHandlerProxyTest, MultiTouchPointHitTestPositive) { 1522 TEST_F(InputHandlerProxyTest, MultiTouchPointHitTestPositive) {
1523 // One of the touch points is on a touch-region. So the event should be sent 1523 // One of the touch points is on a touch-region. So the event should be sent
1524 // to the main thread. 1524 // to the main thread.
1525 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE; 1525 expected_disposition_ = InputHandlerProxy::DID_NOT_HANDLE;
1526 VERIFY_AND_RESET_MOCKS(); 1526 VERIFY_AND_RESET_MOCKS();
1527 1527
1528 EXPECT_CALL(mock_input_handler_, 1528 EXPECT_CALL(mock_input_handler_,
1529 HaveTouchEventHandlersAt( 1529 DoTouchEventsBlockScrollAt(
1530 testing::Property(&gfx::Point::x, testing::Eq(0)))) 1530 testing::Property(&gfx::Point::x, testing::Eq(0))))
1531 .WillOnce(testing::Return(false)); 1531 .WillOnce(testing::Return(false));
1532 EXPECT_CALL(mock_input_handler_, 1532 EXPECT_CALL(mock_input_handler_,
1533 HaveTouchEventHandlersAt( 1533 DoTouchEventsBlockScrollAt(
1534 testing::Property(&gfx::Point::x, testing::Gt(0)))) 1534 testing::Property(&gfx::Point::x, testing::Gt(0))))
1535 .WillOnce(testing::Return(true)); 1535 .WillOnce(testing::Return(true));
1536 // Since the second touch point hits a touch-region, there should be no 1536 // Since the second touch point hits a touch-region, there should be no
1537 // hit-testing for the third touch point. 1537 // hit-testing for the third touch point.
1538 1538
1539 WebTouchEvent touch; 1539 WebTouchEvent touch;
1540 touch.type = WebInputEvent::TouchStart; 1540 touch.type = WebInputEvent::TouchStart;
1541 1541
1542 touch.touchesLength = 3; 1542 touch.touchesLength = 3;
1543 touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0); 1543 touch.touches[0] = CreateWebTouchPoint(WebTouchPoint::StatePressed, 0, 0);
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate()); 2122 EXPECT_CALL(mock_input_handler_, SetNeedsAnimate());
2123 EXPECT_CALL(mock_client, DidAnimateForInput()); 2123 EXPECT_CALL(mock_client, DidAnimateForInput());
2124 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10); 2124 base::TimeTicks time = base::TimeTicks() + base::TimeDelta::FromSeconds(10);
2125 input_handler_->Animate(time); 2125 input_handler_->Animate(time);
2126 2126
2127 testing::Mock::VerifyAndClearExpectations(&mock_client); 2127 testing::Mock::VerifyAndClearExpectations(&mock_client);
2128 } 2128 }
2129 2129
2130 } // namespace 2130 } // namespace
2131 } // namespace content 2131 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/input/input_handler_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698