Chromium Code Reviews| Index: ui/aura/test/event_generator.h |
| diff --git a/ui/aura/test/event_generator.h b/ui/aura/test/event_generator.h |
| index f57f2425bd8ac0a98d39241fe6a8dc77dfa3164b..8694d037c4420b43c892e46b4609607192ac0149 100644 |
| --- a/ui/aura/test/event_generator.h |
| +++ b/ui/aura/test/event_generator.h |
| @@ -5,6 +5,9 @@ |
| #ifndef UI_AURA_TEST_EVENT_GENERATOR_H_ |
| #define UI_AURA_TEST_EVENT_GENERATOR_H_ |
| +#include <list> |
| +#include <vector> |
| + |
| #include "base/basictypes.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "ui/base/keycodes/keyboard_codes.h" |
| @@ -16,6 +19,10 @@ class TimeDelta; |
| namespace ui { |
| class Event; |
| +class KeyEvent; |
| +class MouseEvent; |
| +class ScrollEvent; |
| +class TouchEvent; |
| } |
| namespace aura { |
| @@ -75,6 +82,9 @@ class EventGenerator { |
| } |
| const gfx::Point& current_location() const { return current_location_; } |
| + void set_post_events(bool post_events) { post_events_ = post_events; } |
|
sadrul
2013/01/28 17:51:18
Perhaps 'async' would be clearer than 'post'
sky
2013/01/28 19:10:55
+1 here. I was about to write the same comment.
DaveMoore
2013/01/28 23:25:20
Done.
|
| + bool post_events() const { return post_events_; } |
| + |
| // Resets the event flags bitmask. |
| void set_flags(int flags) { flags_ = flags; } |
| @@ -189,6 +199,22 @@ class EventGenerator { |
| int move_x, |
| int move_y); |
| + // Generates scroll sequences of a FlingCancel, Scrolls, FlingStart, with |
| + // constant deltas to |x_offset| and |y_offset| in |steps|. |
| + void ScrollSequence(const gfx::Point& start, |
| + const base::TimeDelta& step_delay, |
| + float x_offset, |
| + float y_offset, |
| + int steps, |
| + int num_fingers); |
| + |
| + // Generates scroll sequences of a FlingCancel, Scrolls, FlingStart, sending |
| + // scrolls of each of the values in |offsets|. |
| + void ScrollSequence(const gfx::Point& start, |
| + const base::TimeDelta& step_delay, |
| + const std::vector<gfx::Point>& offsets, |
| + int num_fingers); |
| + |
| // Generates a key press event. On platforms except Windows and X11, a key |
| // event without native_event() is generated. Note that ui::EF_ flags should |
| // be passed as |flags|, not the native ones like 'ShiftMask' in <X11/X.h>. |
| @@ -201,8 +227,8 @@ class EventGenerator { |
| // TODO(yusukes): Support native_event() on all platforms. |
| void ReleaseKey(ui::KeyboardCode key_code, int flags); |
| - // Dispatch the |event| to the RootWindow. |
| - void Dispatch(ui::Event& event); |
| + // Dispatch the event to the RootWindow. |
| + void Dispatch(ui::Event* event); |
| void set_current_root_window(RootWindow* root_window) { |
| current_root_window_ = root_window; |
| @@ -226,11 +252,17 @@ class EventGenerator { |
| gfx::Point GetLocationInCurrentRoot() const; |
| gfx::Point CenterOfWindow(const Window* window) const; |
| + void DispatchNextPendingEvent(); |
| + void DoDispatchEvent(ui::Event* event, bool post_event); |
| + |
| scoped_ptr<EventGeneratorDelegate> delegate_; |
| gfx::Point current_location_; |
| RootWindow* current_root_window_; |
| int flags_; |
| bool grab_; |
| + std::list<ui::Event*> pending_events_; |
| + // Set to true to cause events to be posted asynchronously. |
| + bool post_events_; |
| DISALLOW_COPY_AND_ASSIGN(EventGenerator); |
| }; |