| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_AURA_TEST_TEST_EVENT_HANDLER_H_ | |
| 6 #define UI_AURA_TEST_TEST_EVENT_HANDLER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "ui/events/event_handler.h" | |
| 11 | |
| 12 namespace aura { | |
| 13 namespace test { | |
| 14 | |
| 15 // A simple EventHandler that keeps track of the number of key events that it's | |
| 16 // seen. | |
| 17 class TestEventHandler : public ui::EventHandler { | |
| 18 public: | |
| 19 TestEventHandler(); | |
| 20 virtual ~TestEventHandler(); | |
| 21 | |
| 22 int num_key_events() const { return num_key_events_; } | |
| 23 int num_mouse_events() const { return num_mouse_events_; } | |
| 24 int num_scroll_events() const { return num_scroll_events_; } | |
| 25 int num_touch_events() const { return num_touch_events_; } | |
| 26 int num_gesture_events() const { return num_gesture_events_; } | |
| 27 | |
| 28 void Reset(); | |
| 29 | |
| 30 // ui::EventHandler overrides: | |
| 31 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | |
| 32 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | |
| 33 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | |
| 34 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | |
| 35 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | |
| 36 | |
| 37 private: | |
| 38 // How many events have been received of each type? | |
| 39 int num_key_events_; | |
| 40 int num_mouse_events_; | |
| 41 int num_scroll_events_; | |
| 42 int num_touch_events_; | |
| 43 int num_gesture_events_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(TestEventHandler); | |
| 46 }; | |
| 47 | |
| 48 } // namespace test | |
| 49 } // namespace aura | |
| 50 | |
| 51 #endif // UI_AURA_TEST_TEST_EVENT_HANDLER_H_ | |
| OLD | NEW |