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

Side by Side Diff: ui/aura/test/ui_controls_factory_ozone.cc

Issue 490443002: Add test for ChromeVox keyboard commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No changes to ui_controls_factory_aurax11 needed. Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bind.h" 5 #include "base/bind.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "ui/aura/client/screen_position_client.h" 7 #include "ui/aura/client/screen_position_client.h"
8 #include "ui/aura/env.h" 8 #include "ui/aura/env.h"
9 #include "ui/aura/test/aura_test_utils.h" 9 #include "ui/aura/test/aura_test_utils.h"
10 #include "ui/aura/test/ui_controls_factory_aura.h" 10 #include "ui/aura/test/ui_controls_factory_aura.h"
(...skipping 18 matching lines...) Expand all
29 window, key, control, shift, alt, command, base::Closure()); 29 window, key, control, shift, alt, command, base::Closure());
30 } 30 }
31 virtual bool SendKeyPressNotifyWhenDone( 31 virtual bool SendKeyPressNotifyWhenDone(
32 gfx::NativeWindow window, 32 gfx::NativeWindow window,
33 ui::KeyboardCode key, 33 ui::KeyboardCode key,
34 bool control, 34 bool control,
35 bool shift, 35 bool shift,
36 bool alt, 36 bool alt,
37 bool command, 37 bool command,
38 const base::Closure& closure) OVERRIDE { 38 const base::Closure& closure) OVERRIDE {
39 DCHECK(!command); // No command key on Aura
40
41 int flags = button_down_mask_; 39 int flags = button_down_mask_;
42 40
43 if (control) { 41 if (control) {
44 flags |= ui::EF_CONTROL_DOWN; 42 flags |= ui::EF_CONTROL_DOWN;
45 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, flags); 43 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, flags);
46 } 44 }
47 45
48 if (shift) { 46 if (shift) {
49 flags |= ui::EF_SHIFT_DOWN; 47 flags |= ui::EF_SHIFT_DOWN;
50 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SHIFT, flags); 48 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SHIFT, flags);
51 } 49 }
52 50
53 if (alt) { 51 if (alt) {
54 flags |= ui::EF_ALT_DOWN; 52 flags |= ui::EF_ALT_DOWN;
55 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_MENU, flags); 53 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_MENU, flags);
56 } 54 }
57 55
56 if (command) {
57 flags |= ui::EF_COMMAND_DOWN;
58 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_LWIN, flags);
David Tseng 2014/09/22 21:52:21 Does it make sense to use meta or win consistently
59 }
60
58 PostKeyEvent(ui::ET_KEY_PRESSED, key, flags); 61 PostKeyEvent(ui::ET_KEY_PRESSED, key, flags);
59 PostKeyEvent(ui::ET_KEY_RELEASED, key, flags); 62 PostKeyEvent(ui::ET_KEY_RELEASED, key, flags);
60 63
61 if (alt) { 64 if (alt) {
62 flags &= ~ui::EF_ALT_DOWN; 65 flags &= ~ui::EF_ALT_DOWN;
63 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_MENU, flags); 66 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_MENU, flags);
64 } 67 }
65 68
66 if (shift) { 69 if (shift) {
67 flags &= ~ui::EF_SHIFT_DOWN; 70 flags &= ~ui::EF_SHIFT_DOWN;
68 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SHIFT, flags); 71 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SHIFT, flags);
69 } 72 }
70 73
71 if (control) { 74 if (control) {
72 flags &= ~ui::EF_CONTROL_DOWN; 75 flags &= ~ui::EF_CONTROL_DOWN;
73 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_CONTROL, flags); 76 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_CONTROL, flags);
74 } 77 }
75 78
79 if (command) {
80 flags &= ~ui::EF_COMMAND_DOWN;
81 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_LWIN, flags);
82 }
83
76 RunClosureAfterAllPendingUIEvents(closure); 84 RunClosureAfterAllPendingUIEvents(closure);
77 return true; 85 return true;
78 } 86 }
79 87
80 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { 88 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE {
81 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); 89 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure());
82 } 90 }
83 virtual bool SendMouseMoveNotifyWhenDone( 91 virtual bool SendMouseMoveNotifyWhenDone(
84 long screen_x, 92 long screen_x,
85 long screen_y, 93 long screen_y,
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 }; 221 };
214 222
215 } // namespace 223 } // namespace
216 224
217 ui_controls::UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { 225 ui_controls::UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) {
218 return new UIControlsOzone(host); 226 return new UIControlsOzone(host);
219 } 227 }
220 228
221 } // namespace test 229 } // namespace test
222 } // namespace aura 230 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698