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

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

Issue 192031: [Mac] Add testing code to expose an NSColor memory leak. (Closed)
Patch Set: Remove egregious s/private/public/ leftover from prototyping. Created 11 years, 3 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 unified diff | Download patch
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 #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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 TEST_F(AutocompleteTextFieldTest, Cell) { 78 TEST_F(AutocompleteTextFieldTest, Cell) {
79 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell]; 79 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell];
80 EXPECT_EQ(cell, [field_ cell]); 80 EXPECT_EQ(cell, [field_ cell]);
81 EXPECT_TRUE(cell != nil); 81 EXPECT_TRUE(cell != nil);
82 } 82 }
83 83
84 // Test drawing, mostly to ensure nothing leaks or crashes. 84 // Test drawing, mostly to ensure nothing leaks or crashes.
85 TEST_F(AutocompleteTextFieldTest, Display) { 85 TEST_F(AutocompleteTextFieldTest, Display) {
86 [field_ display]; 86 [field_ display];
87 87
88 // Test focussed drawing.
89 cocoa_helper_.makeFirstResponder(field_);
90 [field_ display];
91 cocoa_helper_.clearFirstResponder();
92
88 // Test display of various cell configurations. 93 // Test display of various cell configurations.
89 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell]; 94 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell];
90 95
91 [cell setSearchHintString:@"Type to search"]; 96 [cell setSearchHintString:@"Type to search"];
92 [field_ display]; 97 [field_ display];
93 98
94 NSImage* image = [NSImage imageNamed:@"NSApplicationIcon"]; 99 NSImage* image = [NSImage imageNamed:@"NSApplicationIcon"];
95 [cell setKeywordHintPrefix:@"prefix" image:image suffix:@"suffix"]; 100 [cell setKeywordHintPrefix:@"prefix" image:image suffix:@"suffix"];
96 [field_ display]; 101 [field_ display];
97 102
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 357 }
353 EXPECT_TRUE(editor_ != nil); 358 EXPECT_TRUE(editor_ != nil);
354 359
355 // This needs to be called every time, otherwise notifications 360 // This needs to be called every time, otherwise notifications
356 // aren't sent correctly. 361 // aren't sent correctly.
357 [editor_ setFieldEditor:YES]; 362 [editor_ setFieldEditor:YES];
358 return editor_; 363 return editor_;
359 } 364 }
360 365
361 @end 366 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm ('k') | chrome/browser/cocoa/cocoa_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698