| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |