Chromium Code Reviews| Index: chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm |
| diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm |
| index e4bb64b0d6493831e6bd7e8d7a63fbd022aa9600..65d56c41ed25d6f3f859c56683956fddf6138613 100644 |
| --- a/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm |
| +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell_unittest.mm |
| @@ -7,6 +7,12 @@ |
| #include "base/mac/scoped_nsobject.h" |
| #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| +@interface OmniboxPopupCellData () |
| +- (void)setContents:(NSAttributedString*)contents; |
| + |
| +- (void)setImage:(NSImage*)image; |
| +@end |
|
Scott Hess - ex-Googler
2015/05/21 20:40:27
This I'm unsure of. It's comparable to defining a
groby-ooo-7-16
2015/05/22 05:03:07
I'm fine with that crash, since it crashes _tests_
Scott Hess - ex-Googler
2015/05/22 05:17:58
Oh, yes, that's true. If the implementation is on
dschuyler
2015/05/26 18:40:20
Acknowledged.
|
| + |
| namespace { |
| class OmniboxPopupCellTest : public CocoaTest { |
| @@ -16,32 +22,35 @@ class OmniboxPopupCellTest : public CocoaTest { |
| void SetUp() override { |
| CocoaTest::SetUp(); |
| - cell_.reset([[OmniboxPopupCell alloc] initTextCell:@""]); |
| - button_.reset([[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)]); |
| - [button_ setCell:cell_]; |
| - [[test_window() contentView] addSubview:button_]; |
| + cellData_.reset([[OmniboxPopupCellData alloc] init]); |
| + cell_.reset([[OmniboxPopupCell alloc] init]); |
| + [cell_ setRepresentedObject:cellData_]; |
| + control_.reset([[NSControl alloc] initWithFrame:NSMakeRect(0, 0, 200, 20)]); |
| + [control_ setCell:cell_]; |
| + [[test_window() contentView] addSubview:control_]; |
| }; |
| protected: |
| + base::scoped_nsobject<OmniboxPopupCellData> cellData_; |
| base::scoped_nsobject<OmniboxPopupCell> cell_; |
| - base::scoped_nsobject<NSButton> button_; |
| + base::scoped_nsobject<NSControl> control_; |
| private: |
| DISALLOW_COPY_AND_ASSIGN(OmniboxPopupCellTest); |
| }; |
| -TEST_VIEW(OmniboxPopupCellTest, button_); |
| +TEST_VIEW(OmniboxPopupCellTest, control_); |
| TEST_F(OmniboxPopupCellTest, Image) { |
| - [cell_ setImage:[NSImage imageNamed:NSImageNameInfo]]; |
| - [button_ display]; |
| + [cellData_ setImage:[NSImage imageNamed:NSImageNameInfo]]; |
| + [control_ display]; |
| } |
| TEST_F(OmniboxPopupCellTest, Title) { |
| base::scoped_nsobject<NSAttributedString> text([[NSAttributedString alloc] |
| initWithString:@"The quick brown fox jumps over the lazy dog."]); |
| - [cell_ setAttributedTitle:text]; |
| - [button_ display]; |
| + [cellData_ setContents:text]; |
| + [control_ display]; |
| } |
| } // namespace |