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

Unified Diff: content/browser/renderer_host/input/touch_emulator_unittest.cc

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: content/browser/renderer_host/input/touch_emulator_unittest.cc
diff --git a/content/browser/renderer_host/input/touch_emulator_unittest.cc b/content/browser/renderer_host/input/touch_emulator_unittest.cc
index 600badd5bcb77f3cb654baabda7f6935e6a660d3..ee1a05cfe0aa4667ef96e371296b1623d7a53bcd 100644
--- a/content/browser/renderer_host/input/touch_emulator_unittest.cc
+++ b/content/browser/renderer_host/input/touch_emulator_unittest.cc
@@ -114,10 +114,7 @@ class TouchEmulatorTest : public testing::Test,
}
void SendKeyboardEvent(WebInputEvent::Type type) {
- WebKeyboardEvent event;
- event.timeStampSeconds = GetNextEventTimeSeconds();
- event.type = type;
- event.modifiers = modifiers();
+ WebKeyboardEvent event(type, modifiers(), GetNextEventTimeSeconds());
emulator()->HandleKeyboardEvent(event);
}
@@ -134,12 +131,9 @@ class TouchEmulatorTest : public testing::Test,
}
void SendMouseEvent(WebInputEvent::Type type, int x, int y) {
- WebMouseEvent event;
- event.timeStampSeconds = GetNextEventTimeSeconds();
- event.type = type;
+ WebMouseEvent event(type, modifiers(), GetNextEventTimeSeconds());
event.button = mouse_pressed_ ? WebMouseEvent::Button::Left :
WebMouseEvent::Button::NoButton;
- event.modifiers = modifiers();
last_mouse_x_ = x;
last_mouse_y_ = y;
event.x = event.windowX = event.globalX = x;
@@ -148,9 +142,8 @@ class TouchEmulatorTest : public testing::Test,
}
bool SendMouseWheelEvent() {
- WebMouseWheelEvent event;
- event.type = WebInputEvent::MouseWheel;
- event.timeStampSeconds = GetNextEventTimeSeconds();
+ WebMouseWheelEvent event(WebInputEvent::MouseWheel, modifiers(),
+ GetNextEventTimeSeconds());
// Return whether mouse wheel is forwarded.
return !emulator()->HandleMouseWheelEvent(event);
}
@@ -198,9 +191,7 @@ class TouchEmulatorTest : public testing::Test,
WebTouchEvent MakeTouchEvent(WebInputEvent::Type type,
WebTouchPoint::State state, int x, int y) {
- WebTouchEvent event;
- event.type = type;
- event.timeStampSeconds = GetNextEventTimeSeconds();
+ WebTouchEvent event(type, modifiers(), GetNextEventTimeSeconds());
event.touchesLength = 1;
event.touches[0].id = 0;
event.touches[0].state = state;

Powered by Google App Engine
This is Rietveld 408576698