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

Unified Diff: content/renderer/input/input_handler_proxy_unittest.cc

Issue 304793003: use enum to specify deviceSource for fling animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed desired #include Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/input/input_handler_proxy_unittest.cc
diff --git a/content/renderer/input/input_handler_proxy_unittest.cc b/content/renderer/input/input_handler_proxy_unittest.cc
index e4b19d06f89842caea168245f4fac9c258329261..87cb943da0652d5c1620d01ebc1f0286e771b2f1 100644
--- a/content/renderer/input/input_handler_proxy_unittest.cc
+++ b/content/renderer/input/input_handler_proxy_unittest.cc
@@ -38,7 +38,7 @@ double InSecondsF(const base::TimeTicks& time) {
}
WebGestureEvent CreateFling(base::TimeTicks timestamp,
- WebGestureEvent::SourceDevice source_device,
+ WebGestureDevice source_device,
WebFloatPoint velocity,
WebPoint point,
WebPoint global_point,
@@ -57,7 +57,7 @@ WebGestureEvent CreateFling(base::TimeTicks timestamp,
return fling;
}
-WebGestureEvent CreateFling(WebGestureEvent::SourceDevice source_device,
+WebGestureEvent CreateFling(WebGestureDevice source_device,
WebFloatPoint velocity,
WebPoint point,
WebPoint global_point,
@@ -211,7 +211,7 @@ class InputHandlerProxyTest : public testing::Test {
} while (false)
void StartFling(base::TimeTicks timestamp,
- WebGestureEvent::SourceDevice source_device,
+ WebGestureDevice source_device,
WebFloatPoint velocity,
WebPoint position) {
expected_disposition_ = InputHandlerProxy::DID_HANDLE;
@@ -486,14 +486,14 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchpad) {
gesture_.type = WebInputEvent::GestureFlingStart;
gesture_.data.flingStart.velocityX = 10;
- gesture_.sourceDevice = WebGestureEvent::Touchpad;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
// Verify that a GestureFlingCancel during an animation cancels it.
gesture_.type = WebInputEvent::GestureFlingCancel;
- gesture_.sourceDevice = WebGestureEvent::Touchpad;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
}
@@ -506,7 +506,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingOnMainThreadTouchpad) {
.WillOnce(testing::Return(cc::InputHandler::ScrollOnMainThread));
gesture_.type = WebInputEvent::GestureFlingStart;
- gesture_.sourceDevice = WebGestureEvent::Touchpad;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
// Since we returned ScrollStatusOnMainThread from scrollBegin, ensure the
@@ -518,7 +518,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingOnMainThreadTouchpad) {
// Even if we didn't start a fling ourselves, we still need to send the cancel
// event to the widget.
gesture_.type = WebInputEvent::GestureFlingCancel;
- gesture_.sourceDevice = WebGestureEvent::Touchpad;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
}
@@ -530,7 +530,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchpad) {
.WillOnce(testing::Return(cc::InputHandler::ScrollIgnored));
gesture_.type = WebInputEvent::GestureFlingStart;
- gesture_.sourceDevice = WebGestureEvent::Touchpad;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
expected_disposition_ = InputHandlerProxy::DROP_EVENT;
@@ -539,7 +539,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchpad) {
// Since the previous fling was ignored, we should also be dropping the next
// fling_cancel.
gesture_.type = WebInputEvent::GestureFlingCancel;
- gesture_.sourceDevice = WebGestureEvent::Touchpad;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
}
@@ -557,7 +557,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchpad) {
// Note that for trackpad, wheel events with the Control modifier are
// special (reserved for zoom), so don't set that here.
int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey;
- gesture_ = CreateFling(WebGestureEvent::Touchpad,
+ gesture_ = CreateFling(blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_global_point,
@@ -662,7 +662,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
// Note that for trackpad, wheel events with the Control modifier are
// special (reserved for zoom), so don't set that here.
int modifiers = WebInputEvent::ShiftKey | WebInputEvent::AltKey;
- gesture_ = CreateFling(WebGestureEvent::Touchpad,
+ gesture_ = CreateFling(blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_global_point,
@@ -763,7 +763,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingTransferResetsTouchpad) {
fling_point = WebPoint(95, 87);
fling_global_point = WebPoint(32, 71);
modifiers = WebInputEvent::AltKey;
- gesture_ = CreateFling(WebGestureEvent::Touchpad,
+ gesture_ = CreateFling(blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_global_point,
@@ -835,7 +835,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -846,7 +846,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
gesture_.type = WebInputEvent::GestureFlingStart;
gesture_.data.flingStart.velocityX = 10;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -855,7 +855,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingStartedTouchscreen) {
// Verify that a GestureFlingCancel during an animation cancels it.
gesture_.type = WebInputEvent::GestureFlingCancel;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
}
@@ -875,7 +875,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingOnMainThreadTouchscreen) {
EXPECT_CALL(mock_input_handler_, FlingScrollBegin()).Times(0);
gesture_.type = WebInputEvent::GestureFlingStart;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -883,7 +883,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingOnMainThreadTouchscreen) {
// Even if we didn't start a fling ourselves, we still need to send the cancel
// event to the widget.
gesture_.type = WebInputEvent::GestureFlingCancel;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
}
@@ -895,7 +895,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
expected_disposition_ = InputHandlerProxy::DROP_EVENT;
@@ -905,7 +905,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
.WillOnce(testing::Return(cc::InputHandler::ScrollIgnored));
gesture_.type = WebInputEvent::GestureFlingStart;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -913,7 +913,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingIgnoredTouchscreen) {
// Even if we didn't start a fling ourselves, we still need to send the cancel
// event to the widget.
gesture_.type = WebInputEvent::GestureFlingCancel;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
}
@@ -926,7 +926,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -938,7 +938,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingAnimatesTouchscreen) {
WebPoint fling_global_point = WebPoint(17, 23);
// Note that for touchscreen the control modifier is not special.
int modifiers = WebInputEvent::ControlKey;
- gesture_ = CreateFling(WebGestureEvent::Touchscreen,
+ gesture_ = CreateFling(blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_global_point,
@@ -985,7 +985,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -999,7 +999,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithValidTimestamp) {
WebPoint fling_global_point = WebPoint(17, 23);
int modifiers = WebInputEvent::ControlKey;
gesture_ = CreateFling(time,
- WebGestureEvent::Touchscreen,
+ blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_global_point,
@@ -1039,7 +1039,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -1055,7 +1055,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithInvalidTimestamp) {
gesture_.timeStampSeconds = start_time_offset.InSecondsF();
gesture_.data.flingStart.velocityX = fling_delta.x;
gesture_.data.flingStart.velocityY = fling_delta.y;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
gesture_.x = fling_point.x;
gesture_.y = fling_point.y;
gesture_.globalX = fling_global_point.x;
@@ -1118,7 +1118,7 @@ TEST_F(InputHandlerProxyTest,
WebPoint fling_point = WebPoint(7, 13);
WebPoint fling_global_point = WebPoint(17, 23);
int modifiers = WebInputEvent::ControlKey | WebInputEvent::AltKey;
- gesture_ = CreateFling(WebGestureEvent::Touchscreen,
+ gesture_ = CreateFling(blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_global_point,
@@ -1239,7 +1239,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -1253,7 +1253,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingNotCancelledBySmallTimeDelta) {
WebPoint fling_global_point = WebPoint(17, 23);
int modifiers = WebInputEvent::ControlKey;
gesture_ = CreateFling(time,
- WebGestureEvent::Touchscreen,
+ blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_global_point,
@@ -1315,7 +1315,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledAfterBothAxesStopScrolling) {
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1457,7 +1457,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingCancelledByKeyboardEvent) {
EXPECT_CALL(mock_input_handler_, ScrollBegin(testing::_, testing::_))
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
EXPECT_TRUE(input_handler_->gesture_scroll_on_impl_thread_for_testing());
testing::Mock::VerifyAndClearExpectations(&mock_input_handler_);
@@ -1510,7 +1510,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
.WillOnce(testing::Return(cc::InputHandler::ScrollStarted));
gesture_.type = WebInputEvent::GestureScrollBegin;
- gesture_.sourceDevice = WebGestureEvent::Touchscreen;
+ gesture_.sourceDevice = blink::WebGestureDeviceTouchpad;
EXPECT_EQ(expected_disposition_, input_handler_->HandleInputEvent(gesture_));
VERIFY_AND_RESET_MOCKS();
@@ -1524,7 +1524,7 @@ TEST_F(InputHandlerProxyTest, GestureFlingWithNegativeTimeDelta) {
WebPoint fling_global_point = WebPoint(17, 23);
int modifiers = WebInputEvent::ControlKey;
gesture_ = CreateFling(time,
- WebGestureEvent::Touchscreen,
+ blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_global_point,
@@ -1571,7 +1571,7 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
base::TimeTicks last_animate_time = time;
WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
WebPoint fling_point = WebPoint(7, 13);
- StartFling(time, WebGestureEvent::Touchscreen, fling_delta, fling_point);
+ StartFling(time, blink::WebGestureDeviceTouchpad, fling_delta, fling_point);
// Now cancel the fling. The fling cancellation should be deferred to allow
// fling boosting events to arrive.
@@ -1634,7 +1634,7 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
// boost the active fling.
gesture_ = CreateFling(time,
- WebGestureEvent::Touchscreen,
+ blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_point,
@@ -1660,7 +1660,7 @@ TEST_F(InputHandlerProxyTest, FlingBoost) {
CancelFling(time);
gesture_ = CreateFling(time,
- WebGestureEvent::Touchscreen,
+ blink::WebGestureDeviceTouchpad,
fling_delta,
fling_point,
fling_point,
@@ -1704,7 +1704,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollTargetsDifferentLayer) {
base::TimeTicks time = base::TimeTicks() + dt;
WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
WebPoint fling_point = WebPoint(7, 13);
- StartFling(time, WebGestureEvent::Touchscreen, fling_delta, fling_point);
+ StartFling(time, blink::WebGestureDeviceTouchpad, fling_delta, fling_point);
// Cancel the fling. The fling cancellation should be deferred to allow
// fling boosting events to arrive.
@@ -1733,7 +1733,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollDelayed) {
base::TimeTicks time = base::TimeTicks() + dt;
WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
WebPoint fling_point = WebPoint(7, 13);
- StartFling(time, WebGestureEvent::Touchscreen, fling_delta, fling_point);
+ StartFling(time, blink::WebGestureDeviceTouchpad, fling_delta, fling_point);
// Cancel the fling. The fling cancellation should be deferred to allow
// fling boosting events to arrive.
@@ -1769,7 +1769,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfScrollInDifferentDirection) {
base::TimeTicks time = base::TimeTicks() + dt;
WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
WebPoint fling_point = WebPoint(7, 13);
- StartFling(time, WebGestureEvent::Touchscreen, fling_delta, fling_point);
+ StartFling(time, blink::WebGestureDeviceTouchpad, fling_delta, fling_point);
// Cancel the fling. The fling cancellation should be deferred to allow
// fling boosting events to arrive.
@@ -1813,7 +1813,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfFlingTooSlow) {
base::TimeTicks time = base::TimeTicks() + dt;
WebFloatPoint fling_delta = WebFloatPoint(1000, 0);
WebPoint fling_point = WebPoint(7, 13);
- StartFling(time, WebGestureEvent::Touchscreen, fling_delta, fling_point);
+ StartFling(time, blink::WebGestureDeviceTouchpad, fling_delta, fling_point);
// Cancel the fling. The fling cancellation should be deferred to allow
// fling boosting events to arrive.
@@ -1824,7 +1824,7 @@ TEST_F(InputHandlerProxyTest, NoFlingBoostIfFlingTooSlow) {
// fling replacing the old.
WebFloatPoint small_fling_delta = WebFloatPoint(100, 0);
gesture_ = CreateFling(time,
- WebGestureEvent::Touchscreen,
+ blink::WebGestureDeviceTouchpad,
small_fling_delta,
fling_point,
fling_point,

Powered by Google App Engine
This is Rietveld 408576698