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

Unified Diff: ui/views/cocoa/bridged_native_widget_unittest.mm

Issue 2019233003: MacViews: Fix crash caused due to nil TextInputClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review and add test. Created 4 years, 7 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 | « ui/views/cocoa/bridged_content_view.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/cocoa/bridged_native_widget_unittest.mm
diff --git a/ui/views/cocoa/bridged_native_widget_unittest.mm b/ui/views/cocoa/bridged_native_widget_unittest.mm
index 1faee145fec4433b886cf07b9ce726cf1dc50e9d..5adf66343486db1e8fad6ab3d8425bf9bd1ad404 100644
--- a/ui/views/cocoa/bridged_native_widget_unittest.mm
+++ b/ui/views/cocoa/bridged_native_widget_unittest.mm
@@ -1011,6 +1011,70 @@ TEST_F(BridgedNativeWidgetTest, TextInput_DeleteCommands) {
TestEditingCommands(selectors);
}
+// Test that we don't crash during an action message even if the TextInputClient
+// is nil. Regression test for crbug.com/615745.
+TEST_F(BridgedNativeWidgetTest, NilTextInputClient) {
+ [ns_view_ setTextInputClient:nil];
+ NSArray* selectors = @[
tapted 2016/05/31 01:17:10 We shouldn't repeat these - can we do something li
karandeepb 2016/05/31 01:42:33 Done.
+ @"insertText:",
+ @"moveForward:",
+ @"moveRight:",
+ @"moveBackward:",
+ @"moveLeft:",
+ @"moveUp:",
+ @"moveDown:",
+ @"moveWordForward:",
+ @"moveWordBackward:",
+ @"moveToBeginningOfLine:",
+ @"moveToEndOfLine:",
+ @"moveToBeginningOfParagraph:",
+ @"moveToEndOfParagraph:",
+ @"moveToEndOfDocument:",
+ @"moveToBeginningOfDocument:",
+ @"pageDown:",
+ @"pageUp:",
+ @"moveBackwardAndModifySelection:",
+ @"moveForwardAndModifySelection:",
+ @"moveWordForwardAndModifySelection:",
+ @"moveWordBackwardAndModifySelection:",
+ @"moveUpAndModifySelection:",
+ @"moveDownAndModifySelection:",
+ @"moveToBeginningOfLineAndModifySelection:",
+ @"moveToEndOfLineAndModifySelection:",
+ @"moveToBeginningOfParagraphAndModifySelection:",
+ @"moveToEndOfParagraphAndModifySelection:",
+ @"moveToEndOfDocumentAndModifySelection:",
+ @"moveToBeginningOfDocumentAndModifySelection:",
+ @"pageDownAndModifySelection:",
+ @"pageUpAndModifySelection:",
+ @"moveParagraphForwardAndModifySelection:",
+ @"moveParagraphBackwardAndModifySelection:",
+ @"moveWordRight:",
+ @"moveWordLeft:",
+ @"moveRightAndModifySelection:",
+ @"moveLeftAndModifySelection:",
+ @"moveWordRightAndModifySelection:",
+ @"moveWordLeftAndModifySelection:",
+ @"moveToLeftEndOfLine:",
+ @"moveToRightEndOfLine:",
+ @"moveToLeftEndOfLineAndModifySelection:",
+ @"moveToRightEndOfLineAndModifySelection:",
+ @"deleteForward:",
+ @"deleteBackward:",
+ @"deleteWordForward:",
+ @"deleteWordBackward:",
+ @"deleteToBeginningOfLine:",
+ @"deleteToEndOfLine:",
+ @"deleteToBeginningOfParagraph:",
+ @"deleteToEndOfParagraph:",
+ @"cancelOperation:"
+ ];
+ for (NSString* selector in selectors) {
+ SEL sel = NSSelectorFromString(selector);
+ [ns_view_ doCommandBySelector:sel];
+ }
+}
+
// Test firstRectForCharacterRange:actualRange for cases where query range is
// empty or outside composition range.
TEST_F(BridgedNativeWidgetTest, TextInput_FirstRectForCharacterRange_Caret) {
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698