| 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 #include "ui/events/event.h" | 5 #include "ui/events/event.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 ui::PointerEvent* clone_as_ptr = clone->AsPointerEvent(); | 880 ui::PointerEvent* clone_as_ptr = clone->AsPointerEvent(); |
| 881 | 881 |
| 882 EXPECT_EQ(ptr_event.type(), clone_as_ptr->type()); | 882 EXPECT_EQ(ptr_event.type(), clone_as_ptr->type()); |
| 883 EXPECT_EQ(ptr_event.pointer_id(), clone_as_ptr->pointer_id()); | 883 EXPECT_EQ(ptr_event.pointer_id(), clone_as_ptr->pointer_id()); |
| 884 EXPECT_EQ(ptr_event.pointer_details(), clone_as_ptr->pointer_details()); | 884 EXPECT_EQ(ptr_event.pointer_details(), clone_as_ptr->pointer_details()); |
| 885 EXPECT_EQ(ptr_event.location(), clone_as_ptr->location()); | 885 EXPECT_EQ(ptr_event.location(), clone_as_ptr->location()); |
| 886 EXPECT_EQ(ptr_event.root_location(), clone_as_ptr->root_location()); | 886 EXPECT_EQ(ptr_event.root_location(), clone_as_ptr->root_location()); |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 | 889 |
| 890 TEST(EventTest, MouseEventLatencyUIComponentExists) { |
| 891 const gfx::Point origin(0, 0); |
| 892 MouseEvent mouseev(ET_MOUSE_PRESSED, origin, origin, EventTimeForNow(), 0, 0); |
| 893 EXPECT_TRUE(mouseev.latency()->FindLatency( |
| 894 ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, nullptr)); |
| 895 } |
| 896 |
| 897 TEST(EventTest, MouseWheelEventLatencyUIComponentExists) { |
| 898 const gfx::Point origin(0, 0); |
| 899 MouseWheelEvent mouseWheelev(gfx::Vector2d(), origin, origin, |
| 900 EventTimeForNow(), 0, 0); |
| 901 EXPECT_TRUE(mouseWheelev.latency()->FindLatency( |
| 902 ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, nullptr)); |
| 903 } |
| 904 |
| 890 TEST(EventTest, PointerEventToMouseEvent) { | 905 TEST(EventTest, PointerEventToMouseEvent) { |
| 891 const struct { | 906 const struct { |
| 892 ui::EventType in_type; | 907 ui::EventType in_type; |
| 893 ui::EventType out_type; | 908 ui::EventType out_type; |
| 894 gfx::Point location; | 909 gfx::Point location; |
| 895 gfx::Point root_location; | 910 gfx::Point root_location; |
| 896 int flags; | 911 int flags; |
| 897 } kTestData[] = { | 912 } kTestData[] = { |
| 898 {ui::ET_POINTER_DOWN, ui::ET_MOUSE_PRESSED, gfx::Point(10, 20), | 913 {ui::ET_POINTER_DOWN, ui::ET_MOUSE_PRESSED, gfx::Point(10, 20), |
| 899 gfx::Point(110, 120), 0}, | 914 gfx::Point(110, 120), 0}, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 memset(&native_event, 0, sizeof(XEvent)); | 1017 memset(&native_event, 0, sizeof(XEvent)); |
| 1003 XButtonEvent* button_event = &(native_event.xbutton); | 1018 XButtonEvent* button_event = &(native_event.xbutton); |
| 1004 button_event->type = ButtonPress; | 1019 button_event->type = ButtonPress; |
| 1005 button_event->button = 4; // A valid wheel button number between min and max. | 1020 button_event->button = 4; // A valid wheel button number between min and max. |
| 1006 MouseWheelEvent mouse_ev(&native_event); | 1021 MouseWheelEvent mouse_ev(&native_event); |
| 1007 | 1022 |
| 1008 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1); | 1023 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1); |
| 1009 #endif | 1024 #endif |
| 1010 } | 1025 } |
| 1011 | 1026 |
| 1012 | |
| 1013 } // namespace ui | 1027 } // namespace ui |
| OLD | NEW |