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

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: Rebase Created 3 years, 12 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/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 4c23f7687a77c52d7573a1506631b94764b9189b..96e87682c7ea8521ca0fc2252718df4c0c152294 100644
--- a/content/browser/renderer_host/input/touch_emulator_unittest.cc
+++ b/content/browser/renderer_host/input/touch_emulator_unittest.cc
@@ -115,10 +115,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);
}
@@ -135,12 +132,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;
@@ -149,9 +143,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);
}
@@ -199,9 +192,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