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

Unified Diff: ui/aura/test/event_generator.cc

Issue 14293028: [CleanUp] Add MoveMouseToInHost to aura::test::EventGenerator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 7 years, 8 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
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/event_generator.cc
diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc
index b9728b94ed5466f922a0212b641e624ac105d74b..6c03a49118a883a3304b6138aa3c3966a7d204ac 100644
--- a/ui/aura/test/event_generator.cc
+++ b/ui/aura/test/event_generator.cc
@@ -145,12 +145,23 @@ void EventGenerator::ReleaseRightButton() {
ReleaseButton(ui::EF_RIGHT_MOUSE_BUTTON);
}
-void EventGenerator::MoveMouseTo(const gfx::Point& point, int count) {
+void EventGenerator::MoveMouseToInHost(const gfx::Point& point_in_host) {
+ const ui::EventType event_type = (flags_ & ui::EF_LEFT_MOUSE_BUTTON) ?
+ ui::ET_MOUSE_DRAGGED : ui::ET_MOUSE_MOVED;
+ ui::MouseEvent mouseev(event_type, point_in_host, point_in_host, flags_);
+ Dispatch(&mouseev);
+
+ current_location_ = point_in_host;
+ current_root_window_->ConvertPointFromHost(&current_location_);
+}
+
+void EventGenerator::MoveMouseTo(const gfx::Point& point_in_screen,
+ int count) {
DCHECK_GT(count, 0);
const ui::EventType event_type = (flags_ & ui::EF_LEFT_MOUSE_BUTTON) ?
ui::ET_MOUSE_DRAGGED : ui::ET_MOUSE_MOVED;
- gfx::Vector2dF diff(point - current_location_);
+ gfx::Vector2dF diff(point_in_screen - current_location_);
for (float i = 1; i <= count; i++) {
gfx::Vector2dF step(diff);
step.Scale(i / count);
@@ -161,7 +172,7 @@ void EventGenerator::MoveMouseTo(const gfx::Point& point, int count) {
ui::MouseEvent mouseev(event_type, move_point, move_point, flags_);
Dispatch(&mouseev);
}
- current_location_ = point;
+ current_location_ = point_in_screen;
}
void EventGenerator::MoveMouseRelativeTo(const Window* window,
« no previous file with comments | « ui/aura/test/event_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698