| 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 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #import "chrome/browser/cocoa/autocomplete_text_field.h" | 8 #import "chrome/browser/cocoa/autocomplete_text_field.h" |
| 9 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" | 9 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" |
| 10 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" | 10 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 AutocompleteTextFieldTest() { | 39 AutocompleteTextFieldTest() { |
| 40 // Make sure this is wide enough to play games with the cell | 40 // Make sure this is wide enough to play games with the cell |
| 41 // decorations. | 41 // decorations. |
| 42 NSRect frame = NSMakeRect(0, 0, 300, 30); | 42 NSRect frame = NSMakeRect(0, 0, 300, 30); |
| 43 field_.reset([[AutocompleteTextField alloc] initWithFrame:frame]); | 43 field_.reset([[AutocompleteTextField alloc] initWithFrame:frame]); |
| 44 [field_ setStringValue:@"Testing"]; | 44 [field_ setStringValue:@"Testing"]; |
| 45 [cocoa_helper_.contentView() addSubview:field_.get()]; | 45 [cocoa_helper_.contentView() addSubview:field_.get()]; |
| 46 | 46 |
| 47 window_delegate_.reset( | 47 window_delegate_.reset( |
| 48 [[AutocompleteTextFieldWindowTestDelegate alloc] init]); | 48 [[AutocompleteTextFieldWindowTestDelegate alloc] init]); |
| 49 [cocoa_helper_.window() setDelegate:window_delegate_]; | 49 [cocoa_helper_.window() setDelegate:window_delegate_.get()]; |
| 50 } | 50 } |
| 51 | 51 |
| 52 // The removeFromSuperview call is needed to prevent crashes in later tests. | 52 // The removeFromSuperview call is needed to prevent crashes in later tests. |
| 53 ~AutocompleteTextFieldTest() { | 53 ~AutocompleteTextFieldTest() { |
| 54 [cocoa_helper_.window() setDelegate:nil]; | 54 [cocoa_helper_.window() setDelegate:nil]; |
| 55 [field_ removeFromSuperview]; | 55 [field_ removeFromSuperview]; |
| 56 } | 56 } |
| 57 | 57 |
| 58 CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc... | 58 CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc... |
| 59 scoped_nsobject<AutocompleteTextField> field_; | 59 scoped_nsobject<AutocompleteTextField> field_; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 357 } |
| 358 EXPECT_TRUE(editor_ != nil); | 358 EXPECT_TRUE(editor_ != nil); |
| 359 | 359 |
| 360 // This needs to be called every time, otherwise notifications | 360 // This needs to be called every time, otherwise notifications |
| 361 // aren't sent correctly. | 361 // aren't sent correctly. |
| 362 [editor_ setFieldEditor:YES]; | 362 [editor_ setFieldEditor:YES]; |
| 363 return editor_; | 363 return editor_; |
| 364 } | 364 } |
| 365 | 365 |
| 366 @end | 366 @end |
| OLD | NEW |