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

Unified Diff: third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Fix mouse up event sender not modifying modifiers Created 4 years 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: third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp b/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
index c6baf11e24d2c97993d04fd37509ea2a9cd23d8f..2d8fa38ae38611021e81104bb24cc232c9c7e6f6 100644
--- a/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebInputEventConversionTest.cpp
@@ -323,8 +323,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
LayoutViewItem documentLayoutView = document->layoutViewItem();
{
- WebMouseEvent webMouseEvent;
- webMouseEvent.type = WebInputEvent::MouseMove;
+ WebMouseEvent webMouseEvent(WebInputEvent::MouseMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webMouseEvent.x = 10;
webMouseEvent.y = 10;
webMouseEvent.windowX = 10;
@@ -344,8 +345,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureScrollUpdate;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.x = 10;
webGestureEvent.y = 12;
@@ -376,8 +378,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureScrollEnd;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollEnd,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.x = 10;
webGestureEvent.y = 12;
@@ -394,8 +397,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTap;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTap,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.tap.width = 10;
webGestureEvent.data.tap.height = 10;
@@ -406,8 +410,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTapUnconfirmed;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTapUnconfirmed,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.tap.width = 10;
webGestureEvent.data.tap.height = 10;
@@ -418,8 +423,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTapDown;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTapDown,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.tapDown.width = 10;
webGestureEvent.data.tapDown.height = 10;
@@ -430,8 +436,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureShowPress;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureShowPress,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.showPress.width = 10;
webGestureEvent.data.showPress.height = 10;
@@ -442,8 +449,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureLongPress;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureLongPress,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.longPress.width = 10;
webGestureEvent.data.longPress.height = 10;
@@ -454,8 +462,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTwoFingerTap;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTwoFingerTap,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.twoFingerTap.firstFingerWidth = 10;
webGestureEvent.data.twoFingerTap.firstFingerHeight = 10;
@@ -466,8 +475,9 @@ TEST(WebInputEventConversionTest, InputEventsScaling) {
}
{
- WebTouchEvent webTouchEvent;
- webTouchEvent.type = WebInputEvent::TouchMove;
+ WebTouchEvent webTouchEvent(WebInputEvent::TouchMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webTouchEvent.touchesLength = 1;
webTouchEvent.touches[0].state = WebTouchPoint::StateMoved;
webTouchEvent.touches[0].screenPosition.x = 10.6f;
@@ -606,8 +616,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view();
{
- WebMouseEvent webMouseEvent;
- webMouseEvent.type = WebInputEvent::MouseMove;
+ WebMouseEvent webMouseEvent(WebInputEvent::MouseMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webMouseEvent.x = 100;
webMouseEvent.y = 110;
webMouseEvent.windowX = 100;
@@ -627,8 +638,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebMouseEvent webMouseEvent1;
- webMouseEvent1.type = WebInputEvent::MouseMove;
+ WebMouseEvent webMouseEvent1(WebInputEvent::MouseMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webMouseEvent1.x = 100;
webMouseEvent1.y = 110;
webMouseEvent1.windowX = 100;
@@ -668,8 +680,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureScrollUpdate;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.x = 100;
webGestureEvent.y = 110;
@@ -688,8 +701,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTap;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTap,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.tap.width = 30;
webGestureEvent.data.tap.height = 30;
@@ -700,8 +714,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTapUnconfirmed;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTapUnconfirmed,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.tap.width = 30;
webGestureEvent.data.tap.height = 30;
@@ -712,8 +727,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTapDown;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTapDown,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.tapDown.width = 30;
webGestureEvent.data.tapDown.height = 30;
@@ -724,8 +740,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureShowPress;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureShowPress,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.showPress.width = 30;
webGestureEvent.data.showPress.height = 30;
@@ -736,8 +753,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureLongPress;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureLongPress,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.longPress.width = 30;
webGestureEvent.data.longPress.height = 30;
@@ -748,8 +766,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTwoFingerTap;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTwoFingerTap,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.data.twoFingerTap.firstFingerWidth = 30;
webGestureEvent.data.twoFingerTap.firstFingerHeight = 30;
@@ -760,8 +779,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebTouchEvent webTouchEvent;
- webTouchEvent.type = WebInputEvent::TouchMove;
+ WebTouchEvent webTouchEvent(WebInputEvent::TouchMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webTouchEvent.touchesLength = 1;
webTouchEvent.touches[0].state = WebTouchPoint::StateMoved;
webTouchEvent.touches[0].screenPosition.x = 100;
@@ -782,8 +802,9 @@ TEST(WebInputEventConversionTest, InputEventsTransform) {
}
{
- WebTouchEvent webTouchEvent1;
- webTouchEvent1.type = WebInputEvent::TouchMove;
+ WebTouchEvent webTouchEvent1(WebInputEvent::TouchMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webTouchEvent1.touchesLength = 1;
webTouchEvent1.touches[0].state = WebTouchPoint::StateMoved;
webTouchEvent1.touches[0].screenPosition.x = 100;
@@ -844,8 +865,9 @@ TEST(WebInputEventConversionTest, InputEventsConversions) {
LayoutViewItem documentLayoutView = document->layoutViewItem();
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureTap;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureTap,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.x = 10;
webGestureEvent.y = 10;
@@ -899,8 +921,9 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) {
FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view();
{
- WebMouseEvent webMouseEvent;
- webMouseEvent.type = WebInputEvent::MouseMove;
+ WebMouseEvent webMouseEvent(WebInputEvent::MouseMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webMouseEvent.x = 10;
webMouseEvent.y = 10;
webMouseEvent.windowX = 10;
@@ -916,8 +939,9 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) {
}
{
- WebMouseWheelEvent webMouseWheelEvent;
- webMouseWheelEvent.type = WebInputEvent::MouseWheel;
+ WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webMouseWheelEvent.x = 10;
webMouseWheelEvent.y = 10;
webMouseWheelEvent.windowX = 10;
@@ -933,8 +957,9 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureScrollUpdate;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollUpdate,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.sourceDevice = WebGestureDeviceTouchscreen;
webGestureEvent.x = 10;
webGestureEvent.y = 10;
@@ -949,8 +974,9 @@ TEST(WebInputEventConversionTest, VisualViewportOffset) {
}
{
- WebTouchEvent webTouchEvent;
- webTouchEvent.type = WebInputEvent::TouchMove;
+ WebTouchEvent webTouchEvent(WebInputEvent::TouchMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webTouchEvent.touchesLength = 1;
webTouchEvent.touches[0].state = WebTouchPoint::StateMoved;
webTouchEvent.touches[0].screenPosition.x = 10.6f;
@@ -998,8 +1024,9 @@ TEST(WebInputEventConversionTest, ElasticOverscroll) {
// Just elastic overscroll.
{
- WebMouseEvent webMouseEvent;
- webMouseEvent.type = WebInputEvent::MouseMove;
+ WebMouseEvent webMouseEvent(WebInputEvent::MouseMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webMouseEvent.x = 10;
webMouseEvent.y = 50;
webMouseEvent.windowX = 10;
@@ -1024,8 +1051,9 @@ TEST(WebInputEventConversionTest, ElasticOverscroll) {
IntPoint visualOffset(35, 60);
webViewImpl->page()->frameHost().visualViewport().setLocation(visualOffset);
{
- WebMouseEvent webMouseEvent;
- webMouseEvent.type = WebInputEvent::MouseMove;
+ WebMouseEvent webMouseEvent(WebInputEvent::MouseMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webMouseEvent.x = 10;
webMouseEvent.y = 10;
webMouseEvent.windowX = 10;
@@ -1069,8 +1097,9 @@ TEST(WebInputEventConversionTest, ElasticOverscrollWithPageReload) {
// Just elastic overscroll.
{
- WebMouseEvent webMouseEvent;
- webMouseEvent.type = WebInputEvent::MouseMove;
+ WebMouseEvent webMouseEvent(WebInputEvent::MouseMove,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webMouseEvent.x = 10;
webMouseEvent.y = 50;
webMouseEvent.windowX = 10;
@@ -1175,13 +1204,13 @@ TEST(WebInputEventConversionTest, PlatformWheelEventBuilder) {
FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view();
{
- WebMouseWheelEvent webMouseWheelEvent;
- webMouseWheelEvent.type = WebInputEvent::MouseWheel;
+ WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel,
+ WebInputEvent::ControlKey,
+ WebInputEvent::TimeStampForTesting);
webMouseWheelEvent.x = 0;
webMouseWheelEvent.y = 5;
webMouseWheelEvent.deltaX = 10;
webMouseWheelEvent.deltaY = 15;
- webMouseWheelEvent.modifiers = WebInputEvent::ControlKey;
webMouseWheelEvent.hasPreciseScrollingDeltas = true;
webMouseWheelEvent.railsMode = WebInputEvent::RailsModeHorizontal;
webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseBegan;
@@ -1204,13 +1233,13 @@ TEST(WebInputEventConversionTest, PlatformWheelEventBuilder) {
}
{
- WebMouseWheelEvent webMouseWheelEvent;
- webMouseWheelEvent.type = WebInputEvent::MouseWheel;
+ WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel,
+ WebInputEvent::ShiftKey,
+ WebInputEvent::TimeStampForTesting);
webMouseWheelEvent.x = 5;
webMouseWheelEvent.y = 0;
webMouseWheelEvent.deltaX = 15;
webMouseWheelEvent.deltaY = 10;
- webMouseWheelEvent.modifiers = WebInputEvent::ShiftKey;
webMouseWheelEvent.hasPreciseScrollingDeltas = false;
webMouseWheelEvent.railsMode = WebInputEvent::RailsModeFree;
webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseNone;
@@ -1233,13 +1262,13 @@ TEST(WebInputEventConversionTest, PlatformWheelEventBuilder) {
}
{
- WebMouseWheelEvent webMouseWheelEvent;
- webMouseWheelEvent.type = WebInputEvent::MouseWheel;
+ WebMouseWheelEvent webMouseWheelEvent(WebInputEvent::MouseWheel,
+ WebInputEvent::AltKey,
+ WebInputEvent::TimeStampForTesting);
webMouseWheelEvent.x = 5;
webMouseWheelEvent.y = 0;
webMouseWheelEvent.deltaX = 15;
webMouseWheelEvent.deltaY = 10;
- webMouseWheelEvent.modifiers = WebInputEvent::AltKey;
webMouseWheelEvent.hasPreciseScrollingDeltas = true;
webMouseWheelEvent.railsMode = WebInputEvent::RailsModeVertical;
webMouseWheelEvent.phase = WebMouseWheelEvent::PhaseNone;
@@ -1280,8 +1309,9 @@ TEST(WebInputEventConversionTest, PlatformGestureEventBuilder) {
FrameView* view = toLocalFrame(webViewImpl->page()->mainFrame())->view();
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureScrollBegin;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollBegin,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.x = 0;
webGestureEvent.y = 5;
webGestureEvent.globalX = 10;
@@ -1314,8 +1344,9 @@ TEST(WebInputEventConversionTest, PlatformGestureEventBuilder) {
}
{
- WebGestureEvent webGestureEvent;
- webGestureEvent.type = WebInputEvent::GestureScrollEnd;
+ WebGestureEvent webGestureEvent(WebInputEvent::GestureScrollEnd,
+ WebInputEvent::NoModifiers,
+ WebInputEvent::TimeStampForTesting);
webGestureEvent.x = 0;
webGestureEvent.y = 5;
webGestureEvent.globalX = 10;

Powered by Google App Engine
This is Rietveld 408576698