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

Unified Diff: ui/views/test/event_generator_delegate_mac.mm

Issue 2531033003: MacViews: Fix GlobalKeyboardShortcutsTest.SwitchTabsMac. (Closed)
Patch Set: Fix tapted's remarks. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/event_generator_delegate_mac.mm
diff --git a/ui/views/test/event_generator_delegate_mac.mm b/ui/views/test/event_generator_delegate_mac.mm
index bc17c3773f487fd146a966243b9fc0c7e64156e5..6fe8fb309295790fa19f5b1e3f175352e4fff0e2 100644
--- a/ui/views/test/event_generator_delegate_mac.mm
+++ b/ui/views/test/event_generator_delegate_mac.mm
@@ -401,6 +401,13 @@ void EventGeneratorDelegateMac::OnKeyEvent(ui::KeyEvent* event) {
[NSApp sendEvent:ns_event];
break;
case Target::WINDOW:
+ // -[NSApp sendEvent:] sends -performKeyEquivalent: if Command or Control
+ // modifiers are pressed. Emulate that behavior.
+ if ([ns_event type] == NSKeyDown &&
+ ([ns_event modifierFlags] & (NSControlKeyMask | NSCommandKeyMask)) &&
+ [window_ performKeyEquivalent:ns_event])
+ break; // Handled by performKeyEquivalent:.
+
[window_ sendEvent:ns_event];
break;
case Target::WIDGET:
« no previous file with comments | « chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698