OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
8 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h" | 9 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h" |
9 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h" | 10 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h" |
10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Width of the field so that we don't have to ask |field_| for it all | 16 // Width of the field so that we don't have to ask |field_| for it all |
17 // the time. | 17 // the time. |
18 static const CGFloat kWidth(300.0); | 18 static const CGFloat kWidth(300.0); |
19 | 19 |
20 class FindBarTextFieldTest : public CocoaTest { | 20 class FindBarTextFieldTest : public CocoaTest { |
21 public: | 21 public: |
22 FindBarTextFieldTest() { | 22 FindBarTextFieldTest() { |
23 // Make sure this is wide enough to play games with the cell | 23 // Make sure this is wide enough to play games with the cell |
24 // decorations. | 24 // decorations. |
25 NSRect frame = NSMakeRect(0, 0, kWidth, 30); | 25 NSRect frame = NSMakeRect(0, 0, kWidth, 30); |
26 scoped_nsobject<FindBarTextField> field( | 26 base::scoped_nsobject<FindBarTextField> field( |
27 [[FindBarTextField alloc] initWithFrame:frame]); | 27 [[FindBarTextField alloc] initWithFrame:frame]); |
28 field_ = field.get(); | 28 field_ = field.get(); |
29 | 29 |
30 [field_ setStringValue:@"Test test"]; | 30 [field_ setStringValue:@"Test test"]; |
31 [[test_window() contentView] addSubview:field_]; | 31 [[test_window() contentView] addSubview:field_]; |
32 } | 32 } |
33 | 33 |
34 FindBarTextField* field_; | 34 FindBarTextField* field_; |
35 }; | 35 }; |
36 | 36 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Test display of various cell configurations. | 72 // Test display of various cell configurations. |
73 FindBarTextFieldCell* cell = [field_ findBarTextFieldCell]; | 73 FindBarTextFieldCell* cell = [field_ findBarTextFieldCell]; |
74 [cell setActiveMatch:4 of:5]; | 74 [cell setActiveMatch:4 of:5]; |
75 [field_ display]; | 75 [field_ display]; |
76 | 76 |
77 [cell clearResults]; | 77 [cell clearResults]; |
78 [field_ display]; | 78 [field_ display]; |
79 } | 79 } |
80 | 80 |
81 } // namespace | 81 } // namespace |
OLD | NEW |