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

Side by Side Diff: ash/sticky_keys/sticky_keys_unittest.cc

Issue 404203003: Distinguish between keystroke and character events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IsCharFromNative() for Mac build Created 6 years, 5 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 | « ash/shelf/shelf_tooltip_manager_unittest.cc ('k') | ash/wm/window_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/sticky_keys/sticky_keys_controller.h" 5 #include "ash/sticky_keys/sticky_keys_controller.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #undef None 8 #undef None
9 #undef Bool 9 #undef Bool
10 #undef RootWindow 10 #undef RootWindow
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 virtual void OnShortcutPressed() { 52 virtual void OnShortcutPressed() {
53 if (target_) { 53 if (target_) {
54 delete target_; 54 delete target_;
55 target_ = NULL; 55 target_ = NULL;
56 } 56 }
57 } 57 }
58 58
59 ui::KeyEvent* GenerateKey(ui::EventType type, ui::KeyboardCode code) { 59 ui::KeyEvent* GenerateKey(ui::EventType type, ui::KeyboardCode code) {
60 scoped_xevent_.InitKeyEvent(type, code, 0); 60 scoped_xevent_.InitKeyEvent(type, code, 0);
61 ui::KeyEvent* event = new ui::KeyEvent(scoped_xevent_, false); 61 ui::KeyEvent* event = new ui::KeyEvent(scoped_xevent_);
62 return event; 62 return event;
63 } 63 }
64 64
65 // Creates a mouse event backed by a native XInput2 generic button event. 65 // Creates a mouse event backed by a native XInput2 generic button event.
66 // This is the standard native event on Chromebooks. 66 // This is the standard native event on Chromebooks.
67 ui::MouseEvent* GenerateMouseEvent(ui::EventType type) { 67 ui::MouseEvent* GenerateMouseEvent(ui::EventType type) {
68 return GenerateMouseEventAt(type, gfx::Point()); 68 return GenerateMouseEventAt(type, gfx::Point());
69 } 69 }
70 70
71 // Creates a mouse event backed by a native XInput2 generic button event. 71 // Creates a mouse event backed by a native XInput2 generic button event.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 is_cancel); // is_cancel 115 is_cancel); // is_cancel
116 ui::ScrollEvent* event = new ui::ScrollEvent(scoped_xevent_); 116 ui::ScrollEvent* event = new ui::ScrollEvent(scoped_xevent_);
117 ui::Event::DispatcherApi dispatcher(event); 117 ui::Event::DispatcherApi dispatcher(event);
118 dispatcher.set_target(target_); 118 dispatcher.set_target(target_);
119 return event; 119 return event;
120 } 120 }
121 121
122 // Creates a synthesized KeyEvent that is not backed by a native event. 122 // Creates a synthesized KeyEvent that is not backed by a native event.
123 ui::KeyEvent* GenerateSynthesizedKeyEvent(ui::EventType type, 123 ui::KeyEvent* GenerateSynthesizedKeyEvent(ui::EventType type,
124 ui::KeyboardCode code) { 124 ui::KeyboardCode code) {
125 return new ui::KeyEvent(type, code, 0, true); 125 return new ui::KeyEvent(type, code, ui::EF_NONE);
126 } 126 }
127 127
128 // Creates a synthesized MouseEvent that is not backed by a native event. 128 // Creates a synthesized MouseEvent that is not backed by a native event.
129 ui::MouseEvent* GenerateSynthesizedMouseEventAt(ui::EventType event_type, 129 ui::MouseEvent* GenerateSynthesizedMouseEventAt(ui::EventType event_type,
130 const gfx::Point& location) { 130 const gfx::Point& location) {
131 ui::MouseEvent* event = new ui::MouseEvent(event_type, 131 ui::MouseEvent* event = new ui::MouseEvent(event_type,
132 location, 132 location,
133 location, 133 location,
134 ui::EF_LEFT_MOUSE_BUTTON, 134 ui::EF_LEFT_MOUSE_BUTTON,
135 ui::EF_LEFT_MOUSE_BUTTON); 135 ui::EF_LEFT_MOUSE_BUTTON);
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 gfx::Point(0, 0))); 702 gfx::Point(0, 0)));
703 released = false; 703 released = false;
704 mod_down_flags = 0; 704 mod_down_flags = 0;
705 sticky_key.HandleMouseEvent(*mev.get(), &mod_down_flags, &released); 705 sticky_key.HandleMouseEvent(*mev.get(), &mod_down_flags, &released);
706 EXPECT_TRUE(mod_down_flags & ui::EF_CONTROL_DOWN); 706 EXPECT_TRUE(mod_down_flags & ui::EF_CONTROL_DOWN);
707 EXPECT_TRUE(released); 707 EXPECT_TRUE(released);
708 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, sticky_key.current_state()); 708 EXPECT_EQ(STICKY_KEY_STATE_DISABLED, sticky_key.current_state());
709 } 709 }
710 710
711 } // namespace ash 711 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_tooltip_manager_unittest.cc ('k') | ash/wm/window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698