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

Side by Side Diff: chrome/browser/cocoa/autocomplete_text_field_unittest.mm

Issue 246009: [Mac] Support undo in the omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "base/cocoa_protocols_mac.h" 7 #import "base/cocoa_protocols_mac.h"
8 #include "base/scoped_nsobject.h" 8 #include "base/scoped_nsobject.h"
9 #import "chrome/browser/cocoa/autocomplete_text_field.h" 9 #import "chrome/browser/cocoa/autocomplete_text_field.h"
10 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" 10 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h"
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 EXPECT_FALSE([undoManager canUndo]); 664 EXPECT_FALSE([undoManager canUndo]);
665 665
666 // Verify that -setAttributedStringValue: does not reset the 666 // Verify that -setAttributedStringValue: does not reset the
667 // editor's undo chain. 667 // editor's undo chain.
668 [field_ setStringValue:@""]; 668 [field_ setStringValue:@""];
669 [editor shouldChangeTextInRange:NSMakeRange(0, 0) replacementString:@""]; 669 [editor shouldChangeTextInRange:NSMakeRange(0, 0) replacementString:@""];
670 [editor didChangeText]; 670 [editor didChangeText];
671 EXPECT_TRUE([undoManager canUndo]); 671 EXPECT_TRUE([undoManager canUndo]);
672 [field_ setAttributedStringValue:attributedString]; 672 [field_ setAttributedStringValue:attributedString];
673 EXPECT_TRUE([undoManager canUndo]); 673 EXPECT_TRUE([undoManager canUndo]);
674
675 // Verify that calling -clearUndoChain clears the undo chain.
676 [field_ clearUndoChain];
677 EXPECT_FALSE([undoManager canUndo]);
674 } 678 }
675 679
680 TEST_F(AutocompleteTextFieldTest, EditorGetsCorrectUndoManager) {
681 cocoa_helper_.makeFirstResponder(field_);
682
683 NSTextView* editor = static_cast<NSTextView*>([field_ currentEditor]);
684 EXPECT_TRUE(editor);
685 EXPECT_EQ([field_ undoManagerForTextView:editor], [editor undoManager]);
686 }
676 } // namespace 687 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698