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_WINDOW_DELEGATE_H_ | 5 #ifndef UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
6 #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 6 #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 void set_window_component(int window_component) { | 24 void set_window_component(int window_component) { |
25 window_component_ = window_component; | 25 window_component_ = window_component; |
26 } | 26 } |
27 | 27 |
28 // Overridden from WindowDelegate: | 28 // Overridden from WindowDelegate: |
29 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 29 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
30 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 30 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
31 const gfx::Rect& new_bounds) OVERRIDE; | 31 const gfx::Rect& new_bounds) OVERRIDE; |
32 virtual void OnFocus(Window* old_focused_window) OVERRIDE; | 32 virtual void OnFocus(Window* old_focused_window) OVERRIDE; |
33 virtual void OnBlur() OVERRIDE; | 33 virtual void OnBlur() OVERRIDE; |
34 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; | 34 virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
35 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; | 35 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; |
36 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 36 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
37 virtual bool ShouldDescendIntoChildForEventHandling( | 37 virtual bool ShouldDescendIntoChildForEventHandling( |
38 Window* child, | 38 Window* child, |
39 const gfx::Point& location) OVERRIDE; | 39 const gfx::Point& location) OVERRIDE; |
40 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; | 40 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
41 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE; | 41 virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE; |
42 virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE; | 42 virtual ui::GestureStatus OnGestureEvent( |
| 43 ui::GestureEventImpl* event) OVERRIDE; |
43 virtual bool CanFocus() OVERRIDE; | 44 virtual bool CanFocus() OVERRIDE; |
44 virtual void OnCaptureLost() OVERRIDE; | 45 virtual void OnCaptureLost() OVERRIDE; |
45 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 46 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
46 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 47 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
47 virtual void OnWindowDestroying() OVERRIDE; | 48 virtual void OnWindowDestroying() OVERRIDE; |
48 virtual void OnWindowDestroyed() OVERRIDE; | 49 virtual void OnWindowDestroyed() OVERRIDE; |
49 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; | 50 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; |
50 virtual bool HasHitTestMask() const OVERRIDE; | 51 virtual bool HasHitTestMask() const OVERRIDE; |
51 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; | 52 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; |
52 | 53 |
53 private: | 54 private: |
54 int window_component_; | 55 int window_component_; |
55 | 56 |
56 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); | 57 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); |
57 }; | 58 }; |
58 | 59 |
59 // A simple WindowDelegate implementation for these tests. It owns itself | 60 // A simple WindowDelegate implementation for these tests. It owns itself |
60 // (deletes itself when the Window it is attached to is destroyed). | 61 // (deletes itself when the Window it is attached to is destroyed). |
61 class ColorTestWindowDelegate : public TestWindowDelegate { | 62 class ColorTestWindowDelegate : public TestWindowDelegate { |
62 public: | 63 public: |
63 explicit ColorTestWindowDelegate(SkColor color); | 64 explicit ColorTestWindowDelegate(SkColor color); |
64 virtual ~ColorTestWindowDelegate(); | 65 virtual ~ColorTestWindowDelegate(); |
65 | 66 |
66 ui::KeyboardCode last_key_code() const { return last_key_code_; } | 67 ui::KeyboardCode last_key_code() const { return last_key_code_; } |
67 | 68 |
68 // Overridden from TestWindowDelegate: | 69 // Overridden from TestWindowDelegate: |
69 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; | 70 virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
70 virtual void OnWindowDestroyed() OVERRIDE; | 71 virtual void OnWindowDestroyed() OVERRIDE; |
71 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 72 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
72 | 73 |
73 private: | 74 private: |
74 SkColor color_; | 75 SkColor color_; |
75 ui::KeyboardCode last_key_code_; | 76 ui::KeyboardCode last_key_code_; |
76 | 77 |
77 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); |
78 }; | 79 }; |
79 | 80 |
(...skipping 11 matching lines...) Expand all Loading... |
91 | 92 |
92 DISALLOW_COPY_AND_ASSIGN(MaskedWindowDelegate); | 93 DISALLOW_COPY_AND_ASSIGN(MaskedWindowDelegate); |
93 }; | 94 }; |
94 | 95 |
95 // Keeps track of mouse/key events. | 96 // Keeps track of mouse/key events. |
96 class EventCountDelegate : public TestWindowDelegate { | 97 class EventCountDelegate : public TestWindowDelegate { |
97 public: | 98 public: |
98 EventCountDelegate(); | 99 EventCountDelegate(); |
99 | 100 |
100 // Overridden from TestWindowDelegate: | 101 // Overridden from TestWindowDelegate: |
101 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; | 102 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
102 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; | 103 virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
103 | 104 |
104 // Returns the counts of mouse motion events in the | 105 // Returns the counts of mouse motion events in the |
105 // form of "<enter> <move> <leave>". | 106 // form of "<enter> <move> <leave>". |
106 std::string GetMouseMotionCountsAndReset(); | 107 std::string GetMouseMotionCountsAndReset(); |
107 | 108 |
108 // Returns the counts of mouse button events in the | 109 // Returns the counts of mouse button events in the |
109 // form of "<press> <release>". | 110 // form of "<press> <release>". |
110 std::string GetMouseButtonCountsAndReset(); | 111 std::string GetMouseButtonCountsAndReset(); |
111 | 112 |
112 // Returns the counts of key events in the form of | 113 // Returns the counts of key events in the form of |
113 // "<press> <release>". | 114 // "<press> <release>". |
114 std::string GetKeyCountsAndReset(); | 115 std::string GetKeyCountsAndReset(); |
115 | 116 |
116 private: | 117 private: |
117 int mouse_enter_count_; | 118 int mouse_enter_count_; |
118 int mouse_move_count_; | 119 int mouse_move_count_; |
119 int mouse_leave_count_; | 120 int mouse_leave_count_; |
120 int mouse_press_count_; | 121 int mouse_press_count_; |
121 int mouse_release_count_; | 122 int mouse_release_count_; |
122 int key_press_count_; | 123 int key_press_count_; |
123 int key_release_count_; | 124 int key_release_count_; |
124 | 125 |
125 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); | 126 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); |
126 }; | 127 }; |
127 | 128 |
128 } // namespace test | 129 } // namespace test |
129 } // namespace aura | 130 } // namespace aura |
130 | 131 |
131 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 132 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
OLD | NEW |