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

Side by Side Diff: ui/events/x/events_x_unittest.cc

Issue 1068463003: A mouse event created from the same native event will be marked as repeated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified EventsXTest.ClickCount to account for the change. Created 5 years, 8 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 | « ui/events/event_unittest.cc ('k') | 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 <cstring> 5 #include <cstring>
6 #include <set> 6 #include <set>
7 7
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #include <X11/Xutil.h> 10 #include <X11/Xutil.h>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 event.xcrossing.y_root = 240; 201 event.xcrossing.y_root = 240;
202 EXPECT_EQ(ui::ET_MOUSE_EXITED, ui::EventTypeFromNative(&event)); 202 EXPECT_EQ(ui::ET_MOUSE_EXITED, ui::EventTypeFromNative(&event));
203 EXPECT_EQ("30,40", ui::EventLocationFromNative(&event).ToString()); 203 EXPECT_EQ("30,40", ui::EventLocationFromNative(&event).ToString());
204 EXPECT_EQ("230,240", ui::EventSystemLocationFromNative(&event).ToString()); 204 EXPECT_EQ("230,240", ui::EventSystemLocationFromNative(&event).ToString());
205 } 205 }
206 206
207 TEST_F(EventsXTest, ClickCount) { 207 TEST_F(EventsXTest, ClickCount) {
208 XEvent event; 208 XEvent event;
209 gfx::Point location(5, 10); 209 gfx::Point location(5, 10);
210 210
211 base::TimeDelta time_stamp = base::TimeDelta::FromMilliseconds(1);
211 for (int i = 1; i <= 3; ++i) { 212 for (int i = 1; i <= 3; ++i) {
212 InitButtonEvent(&event, true, location, 1, 0); 213 InitButtonEvent(&event, true, location, 1, 0);
213 { 214 {
215 event.xbutton.time = time_stamp.InMilliseconds();
214 MouseEvent mouseev(&event); 216 MouseEvent mouseev(&event);
215 EXPECT_EQ(ui::ET_MOUSE_PRESSED, mouseev.type()); 217 EXPECT_EQ(ui::ET_MOUSE_PRESSED, mouseev.type());
216 EXPECT_EQ(i, mouseev.GetClickCount()); 218 EXPECT_EQ(i, mouseev.GetClickCount());
217 } 219 }
218 220
219 InitButtonEvent(&event, false, location, 1, 0); 221 InitButtonEvent(&event, false, location, 1, 0);
220 { 222 {
223 event.xbutton.time = time_stamp.InMilliseconds();
221 MouseEvent mouseev(&event); 224 MouseEvent mouseev(&event);
222 EXPECT_EQ(ui::ET_MOUSE_RELEASED, mouseev.type()); 225 EXPECT_EQ(ui::ET_MOUSE_RELEASED, mouseev.type());
223 EXPECT_EQ(i, mouseev.GetClickCount()); 226 EXPECT_EQ(i, mouseev.GetClickCount());
224 } 227 }
228 time_stamp += base::TimeDelta::FromMilliseconds(1);
225 } 229 }
226 } 230 }
227 231
228 TEST_F(EventsXTest, TouchEventBasic) { 232 TEST_F(EventsXTest, TouchEventBasic) {
229 std::vector<unsigned int> devices; 233 std::vector<unsigned int> devices;
230 devices.push_back(0); 234 devices.push_back(0);
231 ui::SetUpTouchDevicesForTest(devices); 235 ui::SetUpTouchDevicesForTest(devices);
232 std::vector<Valuator> valuators; 236 std::vector<Valuator> valuators;
233 237
234 // Init touch begin with tracking id 5, touch id 0. 238 // Init touch begin with tracking id 5, touch id 0.
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 KeyEventTestApi test_event(&key_event); 655 KeyEventTestApi test_event(&key_event);
652 test_event.set_is_char(true); 656 test_event.set_is_char(true);
653 } 657 }
654 EXPECT_FALSE(key_event.flags() & ui::EF_IME_FABRICATED_KEY); 658 EXPECT_FALSE(key_event.flags() & ui::EF_IME_FABRICATED_KEY);
655 } 659 }
656 } 660 }
657 } 661 }
658 #endif 662 #endif
659 663
660 } // namespace ui 664 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698