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