summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 19:30:31 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 19:30:31 +0000
commit3c830babe5908a323b4b8790779c578ef93dc6db (patch)
tree794b1a6e1ecb7f5e8d9b34d73e3fe7ad134170b0
parent90394da3fd482e90f09eed7c8b6edeaeaf631f3d (diff)
downloadchromium_src-3c830babe5908a323b4b8790779c578ef93dc6db.zip
chromium_src-3c830babe5908a323b4b8790779c578ef93dc6db.tar.gz
chromium_src-3c830babe5908a323b4b8790779c578ef93dc6db.tar.bz2
move delayedmenu_button_unittest over to CocoaTest
BUG=none TEST=none Review URL: http://codereview.chromium.org/406004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32370 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/cocoa/delayedmenu_button_unittest.mm26
1 files changed, 8 insertions, 18 deletions
diff --git a/chrome/browser/cocoa/delayedmenu_button_unittest.mm b/chrome/browser/cocoa/delayedmenu_button_unittest.mm
index a9eaa7f..10f54a1 100644
--- a/chrome/browser/cocoa/delayedmenu_button_unittest.mm
+++ b/chrome/browser/cocoa/delayedmenu_button_unittest.mm
@@ -13,33 +13,23 @@
namespace {
-class DelayedMenuButtonTest : public PlatformTest {
+class DelayedMenuButtonTest : public CocoaTest {
public:
DelayedMenuButtonTest() {
NSRect frame = NSMakeRect(0, 0, 50, 30);
- button_.reset([[DelayedMenuButton alloc] initWithFrame:frame]);
+ scoped_nsobject<DelayedMenuButton>button([[DelayedMenuButton alloc]
+ initWithFrame:frame]);
+ button_ = button.get();
scoped_nsobject<ClickHoldButtonCell> cell(
[[ClickHoldButtonCell alloc] initTextCell:@"Testing"]);
[button_ setCell:cell.get()];
- [cocoa_helper_.contentView() addSubview:button_.get()];
+ [[test_window() contentView] addSubview:button_];
}
- scoped_nsobject<DelayedMenuButton> button_;
- CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc.
+ DelayedMenuButton* button_;
};
-// Test adding/removing from the view hierarchy, mostly to ensure nothing leaks
-// or crashes.
-TEST_F(DelayedMenuButtonTest, AddRemove) {
- EXPECT_EQ(cocoa_helper_.contentView(), [button_ superview]);
- [button_.get() removeFromSuperview];
- EXPECT_FALSE([button_ superview]);
-}
-
-// Test drawing, mostly to ensure nothing leaks or crashes.
-TEST_F(DelayedMenuButtonTest, Display) {
- [button_ display];
-}
+TEST_VIEW(DelayedMenuButtonTest, button_)
// Test assigning and enabling a menu, again mostly to ensure nothing leaks or
// crashes.
@@ -51,7 +41,7 @@ TEST_F(DelayedMenuButtonTest, MenuAssign) {
[menu insertItemWithTitle:@"foo" action:nil keyEquivalent:@"" atIndex:1];
[menu insertItemWithTitle:@"bar" action:nil keyEquivalent:@"" atIndex:2];
[menu insertItemWithTitle:@"baz" action:nil keyEquivalent:@"" atIndex:3];
-
+
[button_ setAttachedMenu:menu];
EXPECT_TRUE([button_ attachedMenu]);