Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: ui/aura/test/event_generator.h

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_EVENT_GENERATOR_H_ 5 #ifndef UI_AURA_TEST_EVENT_GENERATOR_H_
6 #define UI_AURA_TEST_EVENT_GENERATOR_H_ 6 #define UI_AURA_TEST_EVENT_GENERATOR_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "ui/base/keycodes/keyboard_codes.h" 9 #include "ui/base/keycodes/keyboard_codes.h"
10 #include "ui/gfx/point.h" 10 #include "ui/gfx/point.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 // Generates events to move mouse to be the given |point| in |window|'s 80 // Generates events to move mouse to be the given |point| in |window|'s
81 // coordinates. 81 // coordinates.
82 void MoveMouseRelativeTo(const Window* window, const gfx::Point& point); 82 void MoveMouseRelativeTo(const Window* window, const gfx::Point& point);
83 void MoveMouseRelativeTo(const Window* window, int x, int y) { 83 void MoveMouseRelativeTo(const Window* window, int x, int y) {
84 MoveMouseRelativeTo(window, gfx::Point(x, y)); 84 MoveMouseRelativeTo(window, gfx::Point(x, y));
85 } 85 }
86 86
87 void MoveMouseBy(int x, int y) { 87 void MoveMouseBy(int x, int y) {
88 MoveMouseTo(current_location_.Add(gfx::Point(x, y))); 88 MoveMouseTo(current_location_.Add(gfx::Vector2d(x, y)));
89 } 89 }
90 90
91 // Generates events to drag mouse to given |point|. 91 // Generates events to drag mouse to given |point|.
92 void DragMouseTo(const gfx::Point& point); 92 void DragMouseTo(const gfx::Point& point);
93 93
94 void DragMouseTo(int x, int y) { 94 void DragMouseTo(int x, int y) {
95 DragMouseTo(gfx::Point(x, y)); 95 DragMouseTo(gfx::Point(x, y));
96 } 96 }
97 97
98 void DragMouseBy(int dx, int dy) { 98 void DragMouseBy(int dx, int dy) {
99 DragMouseTo(current_location_.Add(gfx::Point(dx, dy))); 99 DragMouseTo(current_location_.Add(gfx::Vector2d(dx, dy)));
100 } 100 }
101 101
102 // Generates events to move the mouse to the center of the window. 102 // Generates events to move the mouse to the center of the window.
103 void MoveMouseToCenterOf(Window* window); 103 void MoveMouseToCenterOf(Window* window);
104 104
105 // Generates a touch press event. 105 // Generates a touch press event.
106 void PressTouch(); 106 void PressTouch();
107 107
108 // Generates a ET_TOUCH_MOVED event to |point|. 108 // Generates a ET_TOUCH_MOVED event to |point|.
109 void MoveTouch(const gfx::Point& point); 109 void MoveTouch(const gfx::Point& point);
110 110
111 // Generates a touch release event. 111 // Generates a touch release event.
112 void ReleaseTouch(); 112 void ReleaseTouch();
113 113
114 // Generates press, move and release event to move touch 114 // Generates press, move and release event to move touch
115 // to be the given |point|. 115 // to be the given |point|.
116 void PressMoveAndReleaseTouchTo(const gfx::Point& point); 116 void PressMoveAndReleaseTouchTo(const gfx::Point& point);
117 117
118 void PressMoveAndReleaseTouchTo(int x, int y) { 118 void PressMoveAndReleaseTouchTo(int x, int y) {
119 PressMoveAndReleaseTouchTo(gfx::Point(x, y)); 119 PressMoveAndReleaseTouchTo(gfx::Point(x, y));
120 } 120 }
121 121
122 void PressMoveAndReleaseTouchBy(int x, int y) { 122 void PressMoveAndReleaseTouchBy(int x, int y) {
123 PressMoveAndReleaseTouchTo(current_location_.Add(gfx::Point(x, y))); 123 PressMoveAndReleaseTouchTo(current_location_.Add(gfx::Vector2d(x, y)));
124 } 124 }
125 125
126 // Generates press, move and release events to move touch 126 // Generates press, move and release events to move touch
127 // to the center of the window. 127 // to the center of the window.
128 void PressMoveAndReleaseTouchToCenterOf(Window* window); 128 void PressMoveAndReleaseTouchToCenterOf(Window* window);
129 129
130 // Generates and dispatches touch-events required to generate a TAP gesture. 130 // Generates and dispatches touch-events required to generate a TAP gesture.
131 // Note that this can generate a number of other gesture events at the same 131 // Note that this can generate a number of other gesture events at the same
132 // time (e.g. GESTURE_BEGIN, TAP_DOWN, END). 132 // time (e.g. GESTURE_BEGIN, TAP_DOWN, END).
133 void GestureTapAt(const gfx::Point& point); 133 void GestureTapAt(const gfx::Point& point);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 int flags_; 184 int flags_;
185 gfx::Point current_location_; 185 gfx::Point current_location_;
186 186
187 DISALLOW_COPY_AND_ASSIGN(EventGenerator); 187 DISALLOW_COPY_AND_ASSIGN(EventGenerator);
188 }; 188 };
189 189
190 } // namespace test 190 } // namespace test
191 } // namespace aura 191 } // namespace aura
192 192
193 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_ 193 #endif // UI_AURA_TEST_EVENT_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698