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

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

Issue 149717: [Mac] Refactor location-bar autocomplete cell classes. (Closed)
Patch Set: jrg comment Created 11 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #import <Cocoa/Cocoa.h>
6
7 #include "base/scoped_nsobject.h"
8 #import "chrome/browser/cocoa/autocomplete_text_field.h"
9 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h"
10 #import "chrome/browser/cocoa/cocoa_test_helper.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace {
14
15 class AutocompleteTextFieldTest : public testing::Test {
16 public:
17 AutocompleteTextFieldTest() {
18 NSRect frame = NSMakeRect(0, 0, 50, 30);
19 field_.reset([[AutocompleteTextField alloc] initWithFrame:frame]);
20 [field_ setStringValue:@"Testing"];
21 [cocoa_helper_.contentView() addSubview:field_.get()];
22 }
23
24 CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
25 scoped_nsobject<AutocompleteTextField> field_;
26 };
27
28 // Test that we have the right cell class.
29 TEST_F(AutocompleteTextFieldTest, CellClass) {
30 EXPECT_TRUE([[field_ cell] isKindOfClass:[AutocompleteTextFieldCell class]]);
31 }
32
33 // Test adding/removing from the view hierarchy, mostly to ensure nothing
34 // leaks or crashes.
35 TEST_F(AutocompleteTextFieldTest, AddRemove) {
36 EXPECT_EQ(cocoa_helper_.contentView(), [field_ superview]);
37 [field_.get() removeFromSuperview];
38 EXPECT_FALSE([field_ superview]);
39 }
40
41 // Test drawing, mostly to ensure nothing leaks or crashes.
42 TEST_F(AutocompleteTextFieldTest, Display) {
43 [field_ display];
44 }
45
46 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_editor_unittest.mm ('k') | chrome/browser/cocoa/location_bar_cell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698