| 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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 EventTimeForNow(), 11.5, 13.5, 13.0, 0.5)); | 960 EventTimeForNow(), 11.5, 13.5, 13.0, 0.5)); |
| 961 ui::TouchEvent touch_event(pointer_event); | 961 ui::TouchEvent touch_event(pointer_event); |
| 962 | 962 |
| 963 EXPECT_EQ(pointer_event.location(), touch_event.location()); | 963 EXPECT_EQ(pointer_event.location(), touch_event.location()); |
| 964 EXPECT_EQ(pointer_event.flags(), touch_event.flags()); | 964 EXPECT_EQ(pointer_event.flags(), touch_event.flags()); |
| 965 EXPECT_EQ(pointer_event.pointer_id(), touch_event.touch_id()); | 965 EXPECT_EQ(pointer_event.pointer_id(), touch_event.touch_id()); |
| 966 EXPECT_EQ(pointer_event.pointer_details(), touch_event.pointer_details()); | 966 EXPECT_EQ(pointer_event.pointer_details(), touch_event.pointer_details()); |
| 967 EXPECT_EQ(pointer_event.time_stamp(), touch_event.time_stamp()); | 967 EXPECT_EQ(pointer_event.time_stamp(), touch_event.time_stamp()); |
| 968 } | 968 } |
| 969 | 969 |
| 970 TEST(EventTest, PointerEventSourceEventTypeExistsInLatencyInfo) { | |
| 971 ui::PointerEvent wheel_poniter_event( | |
| 972 ui::ET_POINTER_WHEEL_CHANGED, gfx::Point(), gfx::Point(), 0, 0, 0, | |
| 973 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE), | |
| 974 ui::EventTimeForNow()); | |
| 975 EXPECT_EQ(wheel_poniter_event.latency()->source_event_type(), | |
| 976 ui::SourceEventType::WHEEL); | |
| 977 | |
| 978 ui::PointerEvent touch_poniter_event( | |
| 979 ui::ET_TOUCH_PRESSED, gfx::Point(), gfx::Point(), 0, 0, 0, | |
| 980 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH), | |
| 981 ui::EventTimeForNow()); | |
| 982 EXPECT_EQ(touch_poniter_event.latency()->source_event_type(), | |
| 983 ui::SourceEventType::TOUCH); | |
| 984 } | |
| 985 | |
| 986 // Checks that Event.Latency.OS.TOUCH_PRESSED, TOUCH_MOVED, | 970 // Checks that Event.Latency.OS.TOUCH_PRESSED, TOUCH_MOVED, |
| 987 // and TOUCH_RELEASED histograms are computed properly. | 971 // and TOUCH_RELEASED histograms are computed properly. |
| 988 #if defined(USE_X11) | 972 #if defined(USE_X11) |
| 989 TEST(EventTest, EventLatencyOSTouchHistograms) { | 973 TEST(EventTest, EventLatencyOSTouchHistograms) { |
| 990 base::HistogramTester histogram_tester; | 974 base::HistogramTester histogram_tester; |
| 991 ScopedXI2Event scoped_xevent; | 975 ScopedXI2Event scoped_xevent; |
| 992 | 976 |
| 993 // SetUp for test | 977 // SetUp for test |
| 994 DeviceDataManagerX11::CreateInstance(); | 978 DeviceDataManagerX11::CreateInstance(); |
| 995 std::vector<int> devices; | 979 std::vector<int> devices; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 XButtonEvent* button_event = &(native_event.xbutton); | 1013 XButtonEvent* button_event = &(native_event.xbutton); |
| 1030 button_event->type = ButtonPress; | 1014 button_event->type = ButtonPress; |
| 1031 button_event->button = 4; // A valid wheel button number between min and max. | 1015 button_event->button = 4; // A valid wheel button number between min and max. |
| 1032 MouseWheelEvent mouse_ev(&native_event); | 1016 MouseWheelEvent mouse_ev(&native_event); |
| 1033 | 1017 |
| 1034 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1); | 1018 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1); |
| 1035 #endif | 1019 #endif |
| 1036 } | 1020 } |
| 1037 | 1021 |
| 1038 } // namespace ui | 1022 } // namespace ui |
| OLD | NEW |