| Index: chrome/browser/cocoa/menu_button_unittest.mm
|
| ===================================================================
|
| --- chrome/browser/cocoa/menu_button_unittest.mm (revision 29973)
|
| +++ chrome/browser/cocoa/menu_button_unittest.mm (working copy)
|
| @@ -2,45 +2,31 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#import <Cocoa/Cocoa.h>
|
| -
|
| #include "base/scoped_nsobject.h"
|
| #import "chrome/browser/cocoa/clickhold_button_cell.h"
|
| #import "chrome/browser/cocoa/cocoa_test_helper.h"
|
| #import "chrome/browser/cocoa/menu_button.h"
|
| -#include "testing/gtest/include/gtest/gtest.h"
|
| -#include "testing/platform_test.h"
|
|
|
| namespace {
|
|
|
| -class MenuButtonTest : public PlatformTest {
|
| +class MenuButtonTest : public CocoaTest {
|
| public:
|
| MenuButtonTest() {
|
| NSRect frame = NSMakeRect(0, 0, 50, 30);
|
| - button_.reset([[MenuButton alloc] initWithFrame:frame]);
|
| + scoped_nsobject<MenuButton> button(
|
| + [[MenuButton 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<MenuButton> button_;
|
| - CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc.
|
| + MenuButton* button_;
|
| };
|
|
|
| -// Test adding/removing from the view hierarchy, mostly to ensure nothing leaks
|
| -// or crashes.
|
| -TEST_F(MenuButtonTest, AddRemove) {
|
| - EXPECT_EQ(cocoa_helper_.contentView(), [button_ superview]);
|
| - [button_.get() removeFromSuperview];
|
| - EXPECT_FALSE([button_ superview]);
|
| -}
|
| +TEST_VIEW(MenuButtonTest, button_)
|
|
|
| -// Test drawing, mostly to ensure nothing leaks or crashes.
|
| -TEST_F(MenuButtonTest, Display) {
|
| - [button_ display];
|
| -}
|
| -
|
| // Test assigning a menu, again mostly to ensure nothing leaks or crashes.
|
| TEST_F(MenuButtonTest, MenuAssign) {
|
| scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
|
| @@ -50,7 +36,7 @@
|
| [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]);
|
|
|
|
|
| Property changes on: chrome/browser/cocoa/menu_button_unittest.mm
|
| ___________________________________________________________________
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|