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

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

Issue 101573006: Changes MouseEvent constructor to take changed_button_flags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test; needs updated expectations as mouse entered wasnt sent before because of env::mouse_butto… Created 7 years 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 | Annotate | Revision Log
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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/event_utils.h" 8 #include "ui/events/event_utils.h"
9 #include "ui/events/keycodes/dom4/keycode_converter.h" 9 #include "ui/events/keycodes/dom4/keycode_converter.h"
10 #include "ui/events/test/events_test_utils.h" 10 #include "ui/events/test/events_test_utils.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 EXPECT_EQ(10, keyev3.GetCharacter()); 51 EXPECT_EQ(10, keyev3.GetCharacter());
52 52
53 event.InitKeyEvent(ET_KEY_PRESSED, VKEY_RETURN, 0); 53 event.InitKeyEvent(ET_KEY_PRESSED, VKEY_RETURN, 0);
54 KeyEvent keyev4(event, false); 54 KeyEvent keyev4(event, false);
55 EXPECT_EQ(13, keyev4.GetCharacter()); 55 EXPECT_EQ(13, keyev4.GetCharacter());
56 #endif 56 #endif
57 } 57 }
58 58
59 TEST(EventTest, ClickCount) { 59 TEST(EventTest, ClickCount) {
60 const gfx::Point origin(0, 0); 60 const gfx::Point origin(0, 0);
61 MouseEvent mouseev(ET_MOUSE_PRESSED, origin, origin, 0); 61 MouseEvent mouseev(ET_MOUSE_PRESSED, origin, origin, 0, 0);
62 for (int i = 1; i <=3 ; ++i) { 62 for (int i = 1; i <=3 ; ++i) {
63 mouseev.SetClickCount(i); 63 mouseev.SetClickCount(i);
64 EXPECT_EQ(i, mouseev.GetClickCount()); 64 EXPECT_EQ(i, mouseev.GetClickCount());
65 } 65 }
66 } 66 }
67 67
68 TEST(EventTest, Repeated) { 68 TEST(EventTest, Repeated) {
69 const gfx::Point origin(0, 0); 69 const gfx::Point origin(0, 0);
70 MouseEvent mouse_ev1(ET_MOUSE_PRESSED, origin, origin, 0); 70 MouseEvent mouse_ev1(ET_MOUSE_PRESSED, origin, origin, 0, 0);
71 MouseEvent mouse_ev2(ET_MOUSE_PRESSED, origin, origin, 0); 71 MouseEvent mouse_ev2(ET_MOUSE_PRESSED, origin, origin, 0, 0);
72 LocatedEventTestApi test_ev1(&mouse_ev1); 72 LocatedEventTestApi test_ev1(&mouse_ev1);
73 LocatedEventTestApi test_ev2(&mouse_ev2); 73 LocatedEventTestApi test_ev2(&mouse_ev2);
74 74
75 base::TimeDelta start = base::TimeDelta::FromMilliseconds(0); 75 base::TimeDelta start = base::TimeDelta::FromMilliseconds(0);
76 base::TimeDelta soon = start + base::TimeDelta::FromMilliseconds(1); 76 base::TimeDelta soon = start + base::TimeDelta::FromMilliseconds(1);
77 base::TimeDelta later = start + base::TimeDelta::FromMilliseconds(1000); 77 base::TimeDelta later = start + base::TimeDelta::FromMilliseconds(1000);
78 78
79 // Close point. 79 // Close point.
80 test_ev1.set_location(gfx::Point(0, 0)); 80 test_ev1.set_location(gfx::Point(0, 0));
81 test_ev2.set_location(gfx::Point(1, 0)); 81 test_ev2.set_location(gfx::Point(1, 0));
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 MSG native_event = { NULL, WM_KEYUP, VKEY_HOME, lParam }; 325 MSG native_event = { NULL, WM_KEYUP, VKEY_HOME, lParam };
326 KeyEvent key(native_event, false); 326 KeyEvent key(native_event, false);
327 327
328 // KeyEvent converts from the native keycode (scan code) to the code. 328 // KeyEvent converts from the native keycode (scan code) to the code.
329 EXPECT_EQ(kCodeForHome, key.code()); 329 EXPECT_EQ(kCodeForHome, key.code());
330 } 330 }
331 #endif // OS_WIN 331 #endif // OS_WIN
332 } 332 }
333 333
334 } // namespace ui 334 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event_processor_unittest.cc ('k') | ui/message_center/views/message_popup_collection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698