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_cell.h" | 8 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" |
9 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/platform_test.h" |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 class AutocompleteTextFieldCellTest : public testing::Test { | 15 class AutocompleteTextFieldCellTest : public PlatformTest { |
15 public: | 16 public: |
16 AutocompleteTextFieldCellTest() { | 17 AutocompleteTextFieldCellTest() { |
17 // Make sure this is wide enough to play games with the cell | 18 // Make sure this is wide enough to play games with the cell |
18 // decorations. | 19 // decorations. |
19 NSRect frame = NSMakeRect(0, 0, 300, 30); | 20 NSRect frame = NSMakeRect(0, 0, 300, 30); |
20 view_.reset([[NSTextField alloc] initWithFrame:frame]); | 21 view_.reset([[NSTextField alloc] initWithFrame:frame]); |
21 scoped_nsobject<AutocompleteTextFieldCell> cell( | 22 scoped_nsobject<AutocompleteTextFieldCell> cell( |
22 [[AutocompleteTextFieldCell alloc] initTextCell:@"Testing"]); | 23 [[AutocompleteTextFieldCell alloc] initTextCell:@"Testing"]); |
23 [view_ setCell:cell.get()]; | 24 [view_ setCell:cell.get()]; |
24 [cocoa_helper_.contentView() addSubview:view_.get()]; | 25 [cocoa_helper_.contentView() addSubview:view_.get()]; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Text frame should take everything over again on reset. | 243 // Text frame should take everything over again on reset. |
243 [cell clearKeywordAndHint]; | 244 [cell clearKeywordAndHint]; |
244 textFrame = [cell textFrameForFrame:bounds]; | 245 textFrame = [cell textFrameForFrame:bounds]; |
245 EXPECT_FALSE(NSIsEmptyRect(textFrame)); | 246 EXPECT_FALSE(NSIsEmptyRect(textFrame)); |
246 EXPECT_TRUE(NSContainsRect(bounds, textFrame)); | 247 EXPECT_TRUE(NSContainsRect(bounds, textFrame)); |
247 EXPECT_EQ(NSMinX(bounds), NSMinX(textFrame)); | 248 EXPECT_EQ(NSMinX(bounds), NSMinX(textFrame)); |
248 EXPECT_EQ(NSMaxX(bounds), NSMaxX(textFrame)); | 249 EXPECT_EQ(NSMaxX(bounds), NSMaxX(textFrame)); |
249 } | 250 } |
250 | 251 |
251 } // namespace | 252 } // namespace |
OLD | NEW |