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

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

Issue 10823218: ash: Add some test coverage for WM gestures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: doc Created 8 years, 4 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 ce2848475a6ca2a2c2904d04339cc50d9a1c60eb..ea17c4abd1311643668baf9b753ab8dd3a3a22d3 100644
--- a/ui/aura/test/event_generator.cc
+++ b/ui/aura/test/event_generator.cc
@@ -203,6 +203,45 @@ void EventGenerator::GestureScrollSequence(const gfx::Point& start,
Dispatch(release);
}
+void EventGenerator::GestureMultiFingerScroll(int count,
+ const gfx::Point* start,
+ int event_separation_time_ms,
+ int steps,
+ int move_x,
+ int move_y) {
+ const int kMaxTouchPoints = 10;
+ gfx::Point points[kMaxTouchPoints];
+ CHECK_LE(count, kMaxTouchPoints);
+ CHECK_GT(steps, 0);
+
+ int delta_x = move_x / steps;
+ int delta_y = move_y / steps;
+
+ base::TimeDelta press_time = base::Time::NowFromSystemTime() - base::Time();
+ for (int i = 0; i < count; ++i) {
+ points[i] = start[i];
+ TouchEvent press(ui::ET_TOUCH_PRESSED, points[i], i, press_time);
+ Dispatch(press);
+ }
+
+ for (int step = 0; step < steps; ++step) {
+ base::TimeDelta move_time = press_time +
+ base::TimeDelta::FromMilliseconds(event_separation_time_ms * step);
+ for (int i = 0; i < count; ++i) {
+ points[i].Offset(delta_x, delta_y);
+ TouchEvent move(ui::ET_TOUCH_MOVED, points[i], i, move_time);
+ Dispatch(move);
+ }
+ }
+
+ base::TimeDelta release_time = press_time +
+ base::TimeDelta::FromMilliseconds(event_separation_time_ms * steps);
+ for (int i = 0; i < count; ++i) {
+ TouchEvent release(ui::ET_TOUCH_RELEASED, points[i], i, release_time);
+ Dispatch(release);
+ }
+}
+
void EventGenerator::PressKey(ui::KeyboardCode key_code, int flags) {
DispatchKeyEvent(true, key_code, flags);
}
« 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