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

Side by Side Diff: components/mus/common/event_param_traits_unittest.cc

Issue 1800633002: IPC::ParamTraits for ui::PointerEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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
« no previous file with comments | « components/mus/common/event_param_traits_macros.h ('k') | ui/events/event.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 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 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 #include "components/mus/common/event_param_traits.h" 5 #include "components/mus/common/event_param_traits.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
10 #include "ipc/ipc_param_traits.h" 10 #include "ipc/ipc_param_traits.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 case EventType::ET_MOUSEWHEEL: 54 case EventType::ET_MOUSEWHEEL:
55 Compare(CAST_EVENT(MouseWheelEvent, a), CAST_EVENT(MouseWheelEvent, b)); 55 Compare(CAST_EVENT(MouseWheelEvent, a), CAST_EVENT(MouseWheelEvent, b));
56 break; 56 break;
57 case EventType::ET_TOUCH_RELEASED: 57 case EventType::ET_TOUCH_RELEASED:
58 case EventType::ET_TOUCH_PRESSED: 58 case EventType::ET_TOUCH_PRESSED:
59 case EventType::ET_TOUCH_MOVED: 59 case EventType::ET_TOUCH_MOVED:
60 case EventType::ET_TOUCH_CANCELLED: 60 case EventType::ET_TOUCH_CANCELLED:
61 case EventType::ET_DROP_TARGET_EVENT: 61 case EventType::ET_DROP_TARGET_EVENT:
62 Compare(CAST_EVENT(TouchEvent, a), CAST_EVENT(TouchEvent, b)); 62 Compare(CAST_EVENT(TouchEvent, a), CAST_EVENT(TouchEvent, b));
63 break; 63 break;
64 case EventType::ET_POINTER_DOWN:
65 case EventType::ET_POINTER_MOVED:
66 case EventType::ET_POINTER_UP:
67 case EventType::ET_POINTER_CANCELLED:
68 case EventType::ET_POINTER_ENTERED:
69 case EventType::ET_POINTER_EXITED:
70 Compare(CAST_EVENT(PointerEvent, a), CAST_EVENT(PointerEvent, b));
71 break;
64 case EventType::ET_GESTURE_SCROLL_BEGIN: 72 case EventType::ET_GESTURE_SCROLL_BEGIN:
65 case EventType::ET_GESTURE_SCROLL_END: 73 case EventType::ET_GESTURE_SCROLL_END:
66 case EventType::ET_GESTURE_SCROLL_UPDATE: 74 case EventType::ET_GESTURE_SCROLL_UPDATE:
67 case EventType::ET_GESTURE_SHOW_PRESS: 75 case EventType::ET_GESTURE_SHOW_PRESS:
68 case EventType::ET_GESTURE_WIN8_EDGE_SWIPE: 76 case EventType::ET_GESTURE_WIN8_EDGE_SWIPE:
69 case EventType::ET_GESTURE_TAP: 77 case EventType::ET_GESTURE_TAP:
70 case EventType::ET_GESTURE_TAP_DOWN: 78 case EventType::ET_GESTURE_TAP_DOWN:
71 case EventType::ET_GESTURE_TAP_CANCEL: 79 case EventType::ET_GESTURE_TAP_CANCEL:
72 case EventType::ET_GESTURE_BEGIN: 80 case EventType::ET_GESTURE_BEGIN:
73 case EventType::ET_GESTURE_END: 81 case EventType::ET_GESTURE_END:
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 EventType::ET_GESTURE_DOUBLE_TAP, 453 EventType::ET_GESTURE_DOUBLE_TAP,
446 }; 454 };
447 for (int i = 0; i < 17; i++) { 455 for (int i = 0; i < 17; i++) {
448 ScopedEvent event( 456 ScopedEvent event(
449 new GestureEvent(0.0, 0.0, 0, base::TimeDelta(), 457 new GestureEvent(0.0, 0.0, 0, base::TimeDelta(),
450 CreateCornerCaseGestureEventDetails(event_types[i]))); 458 CreateCornerCaseGestureEventDetails(event_types[i])));
451 Verify(event); 459 Verify(event);
452 } 460 }
453 } 461 }
454 462
463 TEST_F(EventParamTraitsTest, GoodSimplePointerEvent) {
464 EventType event_types[] = {
465 ET_POINTER_DOWN, ET_POINTER_MOVED, ET_POINTER_UP,
466 ET_POINTER_CANCELLED, ET_POINTER_ENTERED, ET_POINTER_EXITED,
467 };
468 EventPointerType pointer_types[] = {
469 EventPointerType::POINTER_TYPE_MOUSE,
470 EventPointerType::POINTER_TYPE_TOUCH,
471 };
472
473 for (size_t i = 0; i < arraysize(event_types); i++) {
474 for (size_t j = 0; j < arraysize(pointer_types); j++) {
475 ScopedEvent event(new PointerEvent(event_types[i], pointer_types[j],
476 gfx::Point(), gfx::Point(), 0, 0,
477 base::TimeDelta()));
478 Verify(event);
479 }
480 }
481 }
482
455 #undef FEQ 483 #undef FEQ
456 #undef ASSERT_FEQ 484 #undef ASSERT_FEQ
457 #undef CAST_EVENT 485 #undef CAST_EVENT
458 #undef COMPARE_BASE 486 #undef COMPARE_BASE
459 #undef MIN 487 #undef MIN
460 #undef MAX 488 #undef MAX
461 #undef IMIN 489 #undef IMIN
462 #undef IMAX 490 #undef IMAX
463 #undef FMIN 491 #undef FMIN
464 #undef FMAX 492 #undef FMAX
465 #undef FNAN 493 #undef FNAN
466 494
467 } // namespace 495 } // namespace
468 } // namespace ui 496 } // namespace ui
OLDNEW
« no previous file with comments | « components/mus/common/event_param_traits_macros.h ('k') | ui/events/event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698