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

Unified Diff: ui/events/test/cocoa_test_event_utils.mm

Issue 2095283002: MacViews: Don't handle character events in textfield_unittest's MockInputMethod::DispatchKeyEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify comment. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/test/cocoa_test_event_utils.mm
diff --git a/ui/events/test/cocoa_test_event_utils.mm b/ui/events/test/cocoa_test_event_utils.mm
index 6daae98361a396620eddcbdf91001811543ea5ae..35326dfc347209deab98410ff746eb1f5eaf1afd 100644
--- a/ui/events/test/cocoa_test_event_utils.mm
+++ b/ui/events/test/cocoa_test_event_utils.mm
@@ -176,6 +176,12 @@ NSEvent* SynthesizeKeyEvent(NSWindow* window,
// logic to support it.
flags &= ~NSAlphaShiftKeyMask;
+ // Call sites may generate unicode character events with an undefined
+ // keycode. Since it's not feasible to determine the correct keycode for
+ // each unicode character, we use a dummy keycode corresponding to key 'A'.
+ if (dom_key.IsCharacter() && keycode == ui::VKEY_UNKNOWN)
+ keycode = ui::VKEY_A;
+
unichar character;
unichar shifted_character;
int macKeycode = ui::MacKeyCodeForWindowsKeyCode(
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698