Index: ui/base/test/cocoa_test_event_utils.mm |
diff --git a/ui/base/test/cocoa_test_event_utils.mm b/ui/base/test/cocoa_test_event_utils.mm |
index 5fe5f9979164e83bc766737e991cf1217442f718..f9ef04f1a7c11a3821c819630489261828155dd1 100644 |
--- a/ui/base/test/cocoa_test_event_utils.mm |
+++ b/ui/base/test/cocoa_test_event_utils.mm |
@@ -83,4 +83,18 @@ std::pair<NSEvent*,NSEvent*> MouseClickInView(NSView* view, |
return std::make_pair(down, up); |
} |
+NSEvent* KeyEventWithCharacter(unichar c) { |
+ NSString* chars = [NSString stringWithCharacters:&c length:1]; |
+ return [NSEvent keyEventWithType:NSKeyDown |
+ location:NSZeroPoint |
+ modifierFlags:0 |
+ timestamp:0.0 |
+ windowNumber:0 |
+ context:nil |
+ characters:chars |
+ charactersIgnoringModifiers:chars |
+ isARepeat:NO |
+ keyCode:0]; |
+} |
+ |
} // namespace cocoa_test_event_utils |