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

Side by Side Diff: ui/events/event_unittest.cc

Issue 2021193002: Properly initial a MSG struct in EventTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: copy + pasting is hard Created 4 years, 6 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 | « no previous file | no next file » | 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) 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 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 0, XI_TouchEnd, 5, gfx::Point(30, 30), std::vector<Valuator>()); 913 0, XI_TouchEnd, 5, gfx::Point(30, 30), std::vector<Valuator>());
914 TouchEvent touch_end(scoped_xevent); 914 TouchEvent touch_end(scoped_xevent);
915 histogram_tester.ExpectTotalCount("Event.Latency.OS.TOUCH_RELEASED", 1); 915 histogram_tester.ExpectTotalCount("Event.Latency.OS.TOUCH_RELEASED", 1);
916 } 916 }
917 #endif 917 #endif
918 918
919 // Checks that Event.Latency.OS.MOUSE_WHEEL histogram is computed properly. 919 // Checks that Event.Latency.OS.MOUSE_WHEEL histogram is computed properly.
920 TEST(EventTest, EventLatencyOSMouseWheelHistogram) { 920 TEST(EventTest, EventLatencyOSMouseWheelHistogram) {
921 #if defined(OS_WIN) 921 #if defined(OS_WIN)
922 base::HistogramTester histogram_tester; 922 base::HistogramTester histogram_tester;
923 MSG event; 923 MSG event = { nullptr, WM_MOUSEWHEEL, 0, 0 };
924 event.message = WM_MOUSEWHEEL;
925 MouseWheelEvent mouseWheelEvent(event); 924 MouseWheelEvent mouseWheelEvent(event);
926 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1); 925 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1);
927 #elif defined(USE_X11) 926 #elif defined(USE_X11)
928 base::HistogramTester histogram_tester; 927 base::HistogramTester histogram_tester;
929 DeviceDataManagerX11::CreateInstance(); 928 DeviceDataManagerX11::CreateInstance();
930 929
931 // Initializes a native event and uses it to generate a MouseWheel event. 930 // Initializes a native event and uses it to generate a MouseWheel event.
932 XEvent native_event; 931 XEvent native_event;
933 memset(&native_event, 0, sizeof(XEvent)); 932 memset(&native_event, 0, sizeof(XEvent));
934 XButtonEvent* button_event = &(native_event.xbutton); 933 XButtonEvent* button_event = &(native_event.xbutton);
935 button_event->type = ButtonPress; 934 button_event->type = ButtonPress;
936 button_event->button = 4; // A valid wheel button number between min and max. 935 button_event->button = 4; // A valid wheel button number between min and max.
937 MouseWheelEvent mouse_ev(&native_event); 936 MouseWheelEvent mouse_ev(&native_event);
938 937
939 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1); 938 histogram_tester.ExpectTotalCount("Event.Latency.OS.MOUSE_WHEEL", 1);
940 #endif 939 #endif
941 } 940 }
942 941
943 942
944 } // namespace ui 943 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698