OLD | NEW |
| (Empty) |
1 // Copyright (c) 2016 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 #include "components/mus/common/event_param_traits.h" | |
6 | |
7 #include <limits> | |
8 | |
9 #include "ipc/ipc_message.h" | |
10 #include "ipc/ipc_param_traits.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | |
12 #include "ui/events/event.h" | |
13 #include "ui/events/event_constants.h" | |
14 #include "ui/gfx/geometry/point.h" | |
15 #include "ui/gfx/geometry/rect_f.h" | |
16 #include "ui/gfx/geometry/vector2d.h" | |
17 | |
18 namespace ui { | |
19 namespace { | |
20 | |
21 #define CAST_EVENT(T, e) (*static_cast<const T*>(e.get())) | |
22 #define FEQ(a, b) (a == b || (std::isnan(a) && std::isnan(b))) | |
23 #define ASSERT_FEQ(a, b) ASSERT_TRUE(FEQ(a, b)) | |
24 #define MIN(T) std::numeric_limits<T>::min() | |
25 #define MAX(T) std::numeric_limits<T>::max() | |
26 #define IMIN MIN(int) | |
27 #define IMAX MAX(int) | |
28 #define FMIN MIN(float) | |
29 #define FMAX MAX(float) | |
30 #define FNAN std::numeric_limits<float>::quiet_NaN() | |
31 | |
32 class EventParamTraitsTest : public testing::Test { | |
33 protected: | |
34 // Implements event downcasting as performed by param traits. This enables | |
35 // testing the interface that client code actually uses: (de)serialization of | |
36 // scoped Event pointers that contain a concrete type. | |
37 static void CompareEvents(const ScopedEvent& a, const ScopedEvent& b) { | |
38 ASSERT_EQ(!!a, !!b); | |
39 ASSERT_EQ(a->type(), b->type()); | |
40 switch (a->type()) { | |
41 case EventType::ET_MOUSE_PRESSED: | |
42 case EventType::ET_MOUSE_DRAGGED: | |
43 case EventType::ET_MOUSE_RELEASED: | |
44 case EventType::ET_MOUSE_MOVED: | |
45 case EventType::ET_MOUSE_ENTERED: | |
46 case EventType::ET_MOUSE_EXITED: | |
47 case EventType::ET_MOUSE_CAPTURE_CHANGED: | |
48 Compare(CAST_EVENT(MouseEvent, a), CAST_EVENT(MouseEvent, b)); | |
49 break; | |
50 case EventType::ET_KEY_PRESSED: | |
51 case EventType::ET_KEY_RELEASED: | |
52 Compare(CAST_EVENT(KeyEvent, a), CAST_EVENT(KeyEvent, b)); | |
53 break; | |
54 case EventType::ET_MOUSEWHEEL: | |
55 Compare(CAST_EVENT(MouseWheelEvent, a), CAST_EVENT(MouseWheelEvent, b)); | |
56 break; | |
57 case EventType::ET_TOUCH_RELEASED: | |
58 case EventType::ET_TOUCH_PRESSED: | |
59 case EventType::ET_TOUCH_MOVED: | |
60 case EventType::ET_TOUCH_CANCELLED: | |
61 case EventType::ET_DROP_TARGET_EVENT: | |
62 Compare(CAST_EVENT(TouchEvent, a), CAST_EVENT(TouchEvent, b)); | |
63 break; | |
64 case EventType::ET_GESTURE_SCROLL_BEGIN: | |
65 case EventType::ET_GESTURE_SCROLL_END: | |
66 case EventType::ET_GESTURE_SCROLL_UPDATE: | |
67 case EventType::ET_GESTURE_SHOW_PRESS: | |
68 case EventType::ET_GESTURE_WIN8_EDGE_SWIPE: | |
69 case EventType::ET_GESTURE_TAP: | |
70 case EventType::ET_GESTURE_TAP_DOWN: | |
71 case EventType::ET_GESTURE_TAP_CANCEL: | |
72 case EventType::ET_GESTURE_BEGIN: | |
73 case EventType::ET_GESTURE_END: | |
74 case EventType::ET_GESTURE_TWO_FINGER_TAP: | |
75 case EventType::ET_GESTURE_PINCH_BEGIN: | |
76 case EventType::ET_GESTURE_PINCH_END: | |
77 case EventType::ET_GESTURE_PINCH_UPDATE: | |
78 case EventType::ET_GESTURE_LONG_PRESS: | |
79 case EventType::ET_GESTURE_LONG_TAP: | |
80 case EventType::ET_GESTURE_SWIPE: | |
81 case EventType::ET_GESTURE_TAP_UNCONFIRMED: | |
82 case EventType::ET_GESTURE_DOUBLE_TAP: | |
83 Compare(CAST_EVENT(GestureEvent, a), CAST_EVENT(GestureEvent, b)); | |
84 break; | |
85 case EventType::ET_SCROLL: | |
86 Compare(CAST_EVENT(ScrollEvent, a), CAST_EVENT(ScrollEvent, b)); | |
87 break; | |
88 case EventType::ET_SCROLL_FLING_START: | |
89 case EventType::ET_SCROLL_FLING_CANCEL: | |
90 ASSERT_EQ(!!a->flags() & MouseEventFlags::EF_FROM_TOUCH, | |
91 !!b->flags() & MouseEventFlags::EF_FROM_TOUCH); | |
92 if (a->flags() & MouseEventFlags::EF_FROM_TOUCH) { | |
93 Compare(CAST_EVENT(GestureEvent, a), CAST_EVENT(GestureEvent, b)); | |
94 } else { | |
95 Compare(CAST_EVENT(MouseEvent, a), CAST_EVENT(MouseEvent, b)); | |
96 } | |
97 break; | |
98 case EventType::ET_CANCEL_MODE: | |
99 Compare(CAST_EVENT(CancelModeEvent, a), CAST_EVENT(CancelModeEvent, b)); | |
100 break; | |
101 default: | |
102 NOTREACHED(); | |
103 } | |
104 } | |
105 | |
106 #undef CAST_EVENT | |
107 | |
108 #define CAST_EVENT(T, e) static_cast<const T&>(e) | |
109 #define COMPARE_BASE(T, a, b) Compare(CAST_EVENT(T, a), CAST_EVENT(T, b)) | |
110 | |
111 static void Compare(const Event& a, const Event& b) { | |
112 ASSERT_EQ(a.type(), b.type()); | |
113 ASSERT_EQ(a.name(), b.name()); | |
114 ASSERT_EQ(a.time_stamp(), b.time_stamp()); | |
115 ASSERT_EQ(a.flags(), b.flags()); | |
116 ASSERT_EQ(a.phase(), b.phase()); | |
117 ASSERT_EQ(a.result(), b.result()); | |
118 ASSERT_EQ(a.cancelable(), b.cancelable()); | |
119 ASSERT_EQ(a.IsShiftDown(), b.IsShiftDown()); | |
120 ASSERT_EQ(a.IsControlDown(), b.IsControlDown()); | |
121 ASSERT_EQ(a.IsAltDown(), b.IsAltDown()); | |
122 ASSERT_EQ(a.IsCommandDown(), b.IsCommandDown()); | |
123 ASSERT_EQ(a.IsAltGrDown(), b.IsAltGrDown()); | |
124 ASSERT_EQ(a.IsCapsLockOn(), b.IsCapsLockOn()); | |
125 ASSERT_EQ(a.IsKeyEvent(), b.IsKeyEvent()); | |
126 ASSERT_EQ(a.IsMouseEvent(), b.IsMouseEvent()); | |
127 ASSERT_EQ(a.IsTouchEvent(), b.IsTouchEvent()); | |
128 ASSERT_EQ(a.IsGestureEvent(), b.IsGestureEvent()); | |
129 ASSERT_EQ(a.IsEndingEvent(), b.IsEndingEvent()); | |
130 ASSERT_EQ(a.IsScrollEvent(), b.IsScrollEvent()); | |
131 ASSERT_EQ(a.IsScrollGestureEvent(), b.IsScrollGestureEvent()); | |
132 ASSERT_EQ(a.IsFlingScrollEvent(), b.IsFlingScrollEvent()); | |
133 ASSERT_EQ(a.IsMouseWheelEvent(), b.IsMouseWheelEvent()); | |
134 ASSERT_EQ(a.IsLocatedEvent(), b.IsLocatedEvent()); | |
135 ASSERT_EQ(a.handled(), b.handled()); | |
136 } | |
137 | |
138 static void Compare(const CancelModeEvent& a, const CancelModeEvent& b) { | |
139 COMPARE_BASE(Event, a, b); | |
140 } | |
141 | |
142 static void Compare(const LocatedEvent& a, const LocatedEvent& b) { | |
143 COMPARE_BASE(Event, a, b); | |
144 | |
145 ASSERT_EQ(a.x(), b.x()); | |
146 ASSERT_EQ(a.y(), b.y()); | |
147 ASSERT_EQ(a.location(), b.location()); | |
148 ASSERT_EQ(a.location_f(), b.location_f()); | |
149 ASSERT_EQ(a.root_location(), b.root_location()); | |
150 ASSERT_EQ(a.root_location_f(), b.root_location_f()); | |
151 } | |
152 | |
153 static void Compare(const MouseEvent& a, const MouseEvent& b) { | |
154 COMPARE_BASE(LocatedEvent, a, b); | |
155 | |
156 ASSERT_EQ(a.IsOnlyLeftMouseButton(), b.IsOnlyLeftMouseButton()); | |
157 ASSERT_EQ(a.IsLeftMouseButton(), b.IsLeftMouseButton()); | |
158 ASSERT_EQ(a.IsOnlyMiddleMouseButton(), b.IsOnlyMiddleMouseButton()); | |
159 ASSERT_EQ(a.IsMiddleMouseButton(), b.IsMiddleMouseButton()); | |
160 ASSERT_EQ(a.IsOnlyRightMouseButton(), b.IsOnlyRightMouseButton()); | |
161 ASSERT_EQ(a.IsRightMouseButton(), b.IsRightMouseButton()); | |
162 ASSERT_EQ(a.IsAnyButton(), b.IsAnyButton()); | |
163 ASSERT_EQ(a.button_flags(), b.button_flags()); | |
164 ASSERT_EQ(a.GetClickCount(), b.GetClickCount()); | |
165 ASSERT_EQ(a.changed_button_flags(), b.changed_button_flags()); | |
166 | |
167 Compare(a.pointer_details(), b.pointer_details()); | |
168 } | |
169 | |
170 static void Compare(const MouseWheelEvent& a, const MouseWheelEvent& b) { | |
171 COMPARE_BASE(MouseEvent, a, b); | |
172 | |
173 ASSERT_EQ(a.x_offset(), b.x_offset()); | |
174 ASSERT_EQ(a.y_offset(), b.y_offset()); | |
175 ASSERT_EQ(a.offset(), b.offset()); | |
176 } | |
177 | |
178 static void Compare(const TouchEvent& a, const TouchEvent& b) { | |
179 COMPARE_BASE(LocatedEvent, a, b); | |
180 | |
181 ASSERT_EQ(a.touch_id(), b.touch_id()); | |
182 ASSERT_EQ(a.unique_event_id(), b.unique_event_id()); | |
183 ASSERT_FEQ(a.rotation_angle(), b.rotation_angle()); | |
184 ASSERT_EQ(a.may_cause_scrolling(), b.may_cause_scrolling()); | |
185 ASSERT_EQ(a.synchronous_handling_disabled(), | |
186 b.synchronous_handling_disabled()); | |
187 | |
188 Compare(a.pointer_details(), b.pointer_details()); | |
189 } | |
190 | |
191 static void Compare(const KeyEvent& a, const KeyEvent& b) { | |
192 COMPARE_BASE(Event, a, b); | |
193 | |
194 ASSERT_EQ(a.GetCharacter(), b.GetCharacter()); | |
195 ASSERT_EQ(a.GetUnmodifiedText(), b.GetUnmodifiedText()); | |
196 ASSERT_EQ(a.GetText(), b.GetText()); | |
197 ASSERT_EQ(a.is_char(), b.is_char()); | |
198 ASSERT_EQ(a.is_repeat(), b.is_repeat()); | |
199 ASSERT_EQ(a.key_code(), b.key_code()); | |
200 ASSERT_EQ(a.GetLocatedWindowsKeyboardCode(), | |
201 b.GetLocatedWindowsKeyboardCode()); | |
202 ASSERT_EQ(a.GetConflatedWindowsKeyCode(), b.GetConflatedWindowsKeyCode()); | |
203 ASSERT_EQ(a.IsUnicodeKeyCode(), b.IsUnicodeKeyCode()); | |
204 ASSERT_EQ(a.code(), b.code()); | |
205 ASSERT_EQ(a.GetCodeString(), b.GetCodeString()); | |
206 ASSERT_EQ(a.GetDomKey(), b.GetDomKey()); | |
207 } | |
208 | |
209 static void Compare(const ScrollEvent& a, const ScrollEvent& b) { | |
210 COMPARE_BASE(MouseEvent, a, b); | |
211 | |
212 ASSERT_FEQ(a.x_offset(), b.x_offset()); | |
213 ASSERT_FEQ(a.y_offset(), b.y_offset()); | |
214 ASSERT_FEQ(a.x_offset_ordinal(), b.x_offset_ordinal()); | |
215 ASSERT_FEQ(a.y_offset_ordinal(), b.y_offset_ordinal()); | |
216 ASSERT_EQ(a.finger_count(), b.finger_count()); | |
217 } | |
218 | |
219 static void Compare(const GestureEvent& a, const GestureEvent& b) { | |
220 COMPARE_BASE(LocatedEvent, a, b); | |
221 | |
222 ASSERT_EQ(a.details(), b.details()); | |
223 } | |
224 | |
225 static void Compare(const PointerDetails& a, const PointerDetails& b) { | |
226 ASSERT_EQ(a.pointer_type, b.pointer_type); | |
227 ASSERT_FEQ(a.radius_x, b.radius_x); | |
228 ASSERT_FEQ(a.radius_y, b.radius_y); | |
229 ASSERT_FEQ(a.force, b.force); | |
230 ASSERT_FEQ(a.tilt_x, b.tilt_x); | |
231 ASSERT_FEQ(a.tilt_y, b.tilt_y); | |
232 } | |
233 | |
234 static void Verify(const ScopedEvent& event_in) { | |
235 IPC::Message msg; | |
236 IPC::ParamTraits<ScopedEvent>::Write(&msg, event_in); | |
237 | |
238 ScopedEvent event_out; | |
239 base::PickleIterator iter(msg); | |
240 EXPECT_TRUE(IPC::ParamTraits<ScopedEvent>::Read(&msg, &iter, &event_out)); | |
241 | |
242 CompareEvents(event_in, event_out); | |
243 | |
244 // Perform a sanity check that logging doesn't explode. | |
245 std::string event_in_string; | |
246 IPC::ParamTraits<ScopedEvent>::Log(event_in, &event_in_string); | |
247 std::string event_out_string; | |
248 IPC::ParamTraits<ScopedEvent>::Log(event_out, &event_out_string); | |
249 ASSERT_FALSE(event_in_string.empty()); | |
250 EXPECT_EQ(event_in_string, event_out_string); | |
251 } | |
252 | |
253 static GestureEventDetails CreateCornerCaseGestureEventDetails( | |
254 EventType type) { | |
255 GestureEventDetails details; | |
256 | |
257 // Only some types support |delta_x| and |delta_y| parameters. | |
258 if (type == EventType::ET_GESTURE_SCROLL_BEGIN || | |
259 type == EventType::ET_GESTURE_SCROLL_UPDATE || | |
260 type == EventType::ET_SCROLL_FLING_START || | |
261 type == EventType::ET_GESTURE_TWO_FINGER_TAP || | |
262 type == EventType::ET_GESTURE_SWIPE) { | |
263 details = GestureEventDetails(type, FMIN, FMAX); | |
264 } else { | |
265 details = GestureEventDetails(type); | |
266 } | |
267 | |
268 details.set_bounding_box(gfx::RectF(FMIN, FMAX, FNAN, FNAN)); | |
269 | |
270 // Note: Positive values and |type| check dodges DCHECKs that are not being | |
271 // tested here. | |
272 details.set_touch_points(IMAX); | |
273 if (type == EventType::ET_GESTURE_TAP || | |
274 type == EventType::ET_GESTURE_TAP_UNCONFIRMED || | |
275 type == EventType::ET_GESTURE_DOUBLE_TAP) { | |
276 details.set_tap_count(IMAX); | |
277 } | |
278 if (type == EventType::ET_GESTURE_PINCH_UPDATE) { | |
279 details.set_scale(FMAX); | |
280 } | |
281 | |
282 return details; | |
283 } | |
284 }; | |
285 | |
286 TEST_F(EventParamTraitsTest, GoodCancelModeEvent) { | |
287 ScopedEvent event(new CancelModeEvent()); | |
288 Verify(event); | |
289 } | |
290 | |
291 TEST_F(EventParamTraitsTest, GoodSimpleMouseEvent) { | |
292 EventType event_types[7] = { | |
293 EventType::ET_MOUSE_PRESSED, EventType::ET_MOUSE_DRAGGED, | |
294 EventType::ET_MOUSE_RELEASED, EventType::ET_MOUSE_MOVED, | |
295 EventType::ET_MOUSE_ENTERED, EventType::ET_MOUSE_EXITED, | |
296 EventType::ET_MOUSE_CAPTURE_CHANGED, | |
297 }; | |
298 for (int i = 0; i < 7; i++) { | |
299 ScopedEvent event(new MouseEvent(event_types[i], gfx::Point(), gfx::Point(), | |
300 base::TimeDelta(), 0, 0)); | |
301 Verify(event); | |
302 } | |
303 } | |
304 | |
305 TEST_F(EventParamTraitsTest, GoodCornerCaseMouseEvent) { | |
306 EventType event_types[7] = { | |
307 EventType::ET_MOUSE_PRESSED, EventType::ET_MOUSE_DRAGGED, | |
308 EventType::ET_MOUSE_RELEASED, EventType::ET_MOUSE_MOVED, | |
309 EventType::ET_MOUSE_ENTERED, EventType::ET_MOUSE_EXITED, | |
310 EventType::ET_MOUSE_CAPTURE_CHANGED, | |
311 }; | |
312 for (int i = 0; i < 7; i++) { | |
313 ScopedEvent event(new MouseEvent(event_types[i], gfx::Point(IMIN, IMIN), | |
314 gfx::Point(IMAX, IMAX), | |
315 base::TimeDelta::Max(), IMIN, IMAX)); | |
316 Verify(event); | |
317 } | |
318 } | |
319 | |
320 TEST_F(EventParamTraitsTest, GoodSimpleMouseWheelEvent) { | |
321 ScopedEvent event(new MouseWheelEvent(gfx::Vector2d(), gfx::Point(), | |
322 gfx::Point(), base::TimeDelta(), 0, 0)); | |
323 Verify(event); | |
324 } | |
325 | |
326 TEST_F(EventParamTraitsTest, GoodCornerCaseMouseWheelEvent) { | |
327 ScopedEvent event(new MouseWheelEvent( | |
328 gfx::Vector2d(IMIN, IMAX), gfx::Point(IMIN, IMIN), gfx::Point(IMAX, IMAX), | |
329 base::TimeDelta::Max(), IMIN, IMAX)); | |
330 Verify(event); | |
331 } | |
332 | |
333 TEST_F(EventParamTraitsTest, GoodSimpleTouchEvent) { | |
334 EventType event_types[5] = { | |
335 EventType::ET_TOUCH_RELEASED, EventType::ET_TOUCH_PRESSED, | |
336 EventType::ET_TOUCH_MOVED, EventType::ET_TOUCH_CANCELLED, | |
337 EventType::ET_DROP_TARGET_EVENT, | |
338 }; | |
339 for (int i = 0; i < 5; i++) { | |
340 ScopedEvent event(new TouchEvent(event_types[i], gfx::Point(), 0, 0, | |
341 base::TimeDelta(), 0.0, 0.0, 0.0, 0.0)); | |
342 Verify(event); | |
343 } | |
344 } | |
345 | |
346 TEST_F(EventParamTraitsTest, GoodCornerCaseTouchEvent) { | |
347 EventType event_types[5] = { | |
348 EventType::ET_TOUCH_RELEASED, EventType::ET_TOUCH_PRESSED, | |
349 EventType::ET_TOUCH_MOVED, EventType::ET_TOUCH_CANCELLED, | |
350 EventType::ET_DROP_TARGET_EVENT, | |
351 }; | |
352 for (int i = 0; i < 5; i++) { | |
353 ScopedEvent event(new TouchEvent(event_types[i], gfx::Point(IMIN, IMAX), | |
354 IMIN, IMAX, base::TimeDelta::Max(), FMIN, | |
355 FMAX, FNAN, FNAN)); | |
356 Verify(event); | |
357 } | |
358 } | |
359 | |
360 TEST_F(EventParamTraitsTest, GoodSimpleKeyEvent) { | |
361 EventType event_types[2] = { | |
362 EventType::ET_KEY_PRESSED, EventType::ET_KEY_RELEASED, | |
363 }; | |
364 for (int i = 0; i < 2; i++) { | |
365 ScopedEvent event(new KeyEvent(event_types[i], KeyboardCode::VKEY_UNKNOWN, | |
366 static_cast<DomCode>(0), 0, DomKey(0), | |
367 base::TimeDelta())); | |
368 Verify(event); | |
369 } | |
370 } | |
371 | |
372 TEST_F(EventParamTraitsTest, GoodCornerCaseKeyEvent) { | |
373 EventType event_types[2] = { | |
374 EventType::ET_KEY_PRESSED, EventType::ET_KEY_RELEASED, | |
375 }; | |
376 for (int i = 0; i < 2; i++) { | |
377 ScopedEvent event(new KeyEvent(event_types[i], KeyboardCode::VKEY_OEM_CLEAR, | |
378 static_cast<DomCode>(0x0c028c), IMIN, | |
379 MIN(DomKey), base::TimeDelta::Max())); | |
380 Verify(event); | |
381 } | |
382 } | |
383 | |
384 TEST_F(EventParamTraitsTest, GoodSimpleScrollEvent) { | |
385 ScopedEvent event(new ScrollEvent(EventType::ET_SCROLL, gfx::Point(), | |
386 base::TimeDelta(), 0, 0.0, 0.0, 0.0, 0.0, | |
387 0)); | |
388 Verify(event); | |
389 } | |
390 | |
391 TEST_F(EventParamTraitsTest, GoodCornerCaseScrollEvent) { | |
392 ScopedEvent event(new ScrollEvent(EventType::ET_SCROLL, gfx::Point(), | |
393 base::TimeDelta(), IMIN, FMIN, FMAX, FNAN, | |
394 FMIN, IMAX)); | |
395 Verify(event); | |
396 } | |
397 | |
398 TEST_F(EventParamTraitsTest, GoodSimpleGestureEvent) { | |
399 EventType event_types[19] = { | |
400 EventType::ET_GESTURE_SCROLL_BEGIN, | |
401 EventType::ET_GESTURE_SCROLL_END, | |
402 EventType::ET_GESTURE_SCROLL_UPDATE, | |
403 EventType::ET_GESTURE_SHOW_PRESS, | |
404 EventType::ET_GESTURE_WIN8_EDGE_SWIPE, | |
405 EventType::ET_GESTURE_TAP, | |
406 EventType::ET_GESTURE_TAP_DOWN, | |
407 EventType::ET_GESTURE_TAP_CANCEL, | |
408 EventType::ET_GESTURE_BEGIN, | |
409 EventType::ET_GESTURE_END, | |
410 EventType::ET_GESTURE_TWO_FINGER_TAP, | |
411 EventType::ET_GESTURE_PINCH_BEGIN, | |
412 EventType::ET_GESTURE_PINCH_END, | |
413 EventType::ET_GESTURE_PINCH_UPDATE, | |
414 EventType::ET_GESTURE_LONG_PRESS, | |
415 EventType::ET_GESTURE_LONG_TAP, | |
416 EventType::ET_GESTURE_SWIPE, | |
417 EventType::ET_GESTURE_TAP_UNCONFIRMED, | |
418 EventType::ET_GESTURE_DOUBLE_TAP, | |
419 }; | |
420 for (int i = 0; i < 19; i++) { | |
421 ScopedEvent event(new GestureEvent(0.0, 0.0, 0, base::TimeDelta(), | |
422 GestureEventDetails(event_types[i]))); | |
423 Verify(event); | |
424 } | |
425 } | |
426 | |
427 TEST_F(EventParamTraitsTest, GoodCornerCaseGestureEvent) { | |
428 EventType event_types[17] = { | |
429 EventType::ET_GESTURE_SCROLL_UPDATE, | |
430 EventType::ET_GESTURE_SHOW_PRESS, | |
431 EventType::ET_GESTURE_WIN8_EDGE_SWIPE, | |
432 EventType::ET_GESTURE_TAP, | |
433 EventType::ET_GESTURE_TAP_DOWN, | |
434 EventType::ET_GESTURE_TAP_CANCEL, | |
435 EventType::ET_GESTURE_BEGIN, | |
436 EventType::ET_GESTURE_END, | |
437 EventType::ET_GESTURE_TWO_FINGER_TAP, | |
438 EventType::ET_GESTURE_PINCH_BEGIN, | |
439 EventType::ET_GESTURE_PINCH_END, | |
440 EventType::ET_GESTURE_PINCH_UPDATE, | |
441 EventType::ET_GESTURE_LONG_PRESS, | |
442 EventType::ET_GESTURE_LONG_TAP, | |
443 EventType::ET_GESTURE_SWIPE, | |
444 EventType::ET_GESTURE_TAP_UNCONFIRMED, | |
445 EventType::ET_GESTURE_DOUBLE_TAP, | |
446 }; | |
447 for (int i = 0; i < 17; i++) { | |
448 ScopedEvent event( | |
449 new GestureEvent(0.0, 0.0, 0, base::TimeDelta(), | |
450 CreateCornerCaseGestureEventDetails(event_types[i]))); | |
451 Verify(event); | |
452 } | |
453 } | |
454 | |
455 #undef FEQ | |
456 #undef ASSERT_FEQ | |
457 #undef CAST_EVENT | |
458 #undef COMPARE_BASE | |
459 #undef MIN | |
460 #undef MAX | |
461 #undef IMIN | |
462 #undef IMAX | |
463 #undef FMIN | |
464 #undef FMAX | |
465 #undef FNAN | |
466 | |
467 } // namespace | |
468 } // namespace ui | |
OLD | NEW |