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..d5add07ef18c03c00d9690062c6edc52b9ae7f90 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" |
| @@ -15,7 +18,10 @@ class TimeDelta; |
| } |
| namespace ui { |
| -class Event; |
| +class KeyEvent; |
| +class MouseEvent; |
| +class TouchEvent; |
|
sky
2013/01/22 18:05:01
nit: sort
DaveMoore
2013/01/27 21:21:54
Done.
|
| +class ScrollEvent; |
| } |
| namespace aura { |
| @@ -75,6 +81,9 @@ class EventGenerator { |
| } |
| const gfx::Point& current_location() const { return current_location_; } |
| + void set_post_events(bool post_events) { post_events_ = post_events; } |
| + bool post_events() const { return post_events_; } |
| + |
| // Resets the event flags bitmask. |
| void set_flags(int flags) { flags_ = flags; } |
| @@ -189,6 +198,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, |
|
sky
2013/01/22 18:05:01
no const & here (I know, confusing).
DaveMoore
2013/01/27 21:21:54
Done.
|
| + const std::vector<gfx::Point> offsets, |
|
sky
2013/01/22 18:05:01
const vector&
DaveMoore
2013/01/27 21:21:54
Done.
|
| + 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 +226,11 @@ 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 DispatchKeyEvent(ui::KeyEvent& key_event); |
|
sky
2013/01/22 18:05:01
const on all these args.
DaveMoore
2013/01/27 21:21:54
That ends up requiring a copy within the call to t
|
| + void DispatchMouseEvent(ui::MouseEvent& mouse_event); |
| + void DispatchTouchEvent(ui::TouchEvent& touch_event); |
| + void DispatchScrollEvent(ui::ScrollEvent& scroll_event); |
| void set_current_root_window(RootWindow* root_window) { |
| current_root_window_ = root_window; |
| @@ -232,6 +260,19 @@ class EventGenerator { |
| int flags_; |
| bool grab_; |
| + private: |
| + void DoDispatchKeyEvent(); |
| + void DoDispatchMouseEvent(); |
| + void DoDispatchTouchEvent(); |
| + void DoDispatchScrollEvent(); |
| + std::list<ui::KeyEvent> pending_key_events_; |
| + std::list<ui::MouseEvent> pending_mouse_events_; |
| + std::list<ui::TouchEvent> pending_touch_events_; |
| + std::list<ui::ScrollEvent> pending_scroll_events_; |
| + // Set to true to cause events to be posted asynchronously. Event types |
|
sky
2013/01/22 18:05:01
This second sentence isn't clear, please clarify i
DaveMoore
2013/01/27 21:21:54
Done.
|
| + // can not be mixed and matched (must be all of one type). |
| + bool post_events_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(EventGenerator); |
| }; |