| Index: chrome/browser/ui/cocoa/profile_menu_button_unittest.mm
|
| diff --git a/chrome/browser/ui/cocoa/profile_menu_button_unittest.mm b/chrome/browser/ui/cocoa/profile_menu_button_unittest.mm
|
| index 0b965635e4cdfafef3e16f2d6485df97939cfbb1..5c713fb4433bd7248a27011589bb4285b7c3c83d 100644
|
| --- a/chrome/browser/ui/cocoa/profile_menu_button_unittest.mm
|
| +++ b/chrome/browser/ui/cocoa/profile_menu_button_unittest.mm
|
| @@ -13,8 +13,7 @@ class ProfileMenuButtonTest : public CocoaTest {
|
| public:
|
| ProfileMenuButtonTest() {
|
| scoped_nsobject<ProfileMenuButton> button([[ProfileMenuButton alloc]
|
| - initWithFrame:NSMakeRect(50, 50, 100, 100)
|
| - pullsDown:NO]);
|
| + initWithFrame:NSMakeRect(50, 50, 100, 100)]);
|
| button_ = button.get();
|
| [[test_window() contentView] addSubview:button_];
|
| }
|
| @@ -22,36 +21,10 @@ class ProfileMenuButtonTest : public CocoaTest {
|
| ProfileMenuButton* button_;
|
| };
|
|
|
| -// A stub to check that popUpContextMenu:withEvent:forView: is called.
|
| -@interface ProfileShowMenuHandler : NSObject {
|
| - int showMenuCount_;
|
| -}
|
| -
|
| -@property(assign, nonatomic) int showMenuCount;
|
| -
|
| -- (void)popUpContextMenu:(NSMenu*)menu
|
| - withEvent:(NSEvent*)event
|
| - forView:(NSView*)view;
|
| -
|
| -@end
|
| -
|
| -@implementation ProfileShowMenuHandler
|
| -
|
| -@synthesize showMenuCount = showMenuCount_;
|
| -
|
| -- (void)popUpContextMenu:(NSMenu*)menu
|
| - withEvent:(NSEvent*)event
|
| - forView:(NSView*)view {
|
| - showMenuCount_++;
|
| -}
|
| -
|
| -@end
|
| -
|
|
|
| TEST_F(ProfileMenuButtonTest, ControlSize) {
|
| scoped_nsobject<ProfileMenuButton> button([[ProfileMenuButton alloc]
|
| - initWithFrame:NSZeroRect
|
| - pullsDown:NO]);
|
| + initWithFrame:NSZeroRect]);
|
|
|
| NSSize minSize = [button minControlSize];
|
| EXPECT_TRUE(NSEqualSizes(minSize, [button desiredControlSize]));
|
| @@ -102,23 +75,3 @@ TEST_F(ProfileMenuButtonTest, Display) {
|
| [button_ setShouldShowProfileDisplayName:YES];
|
| [button_ display];
|
| }
|
| -
|
| -// Checks that a menu is displayed on mouse down. Also makes sure that
|
| -// nothing leaks or crashes when displaying the button in its pressed state.
|
| -TEST_F(ProfileMenuButtonTest, MenuTest) {
|
| - scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
|
| - [button_ setMenu:menu];
|
| -
|
| - // Trigger a mouse down to show the menu.
|
| - NSPoint point = NSMakePoint(NSMaxX([button_ bounds]) - 1,
|
| - NSMaxY([button_ bounds]) - 1);
|
| - point = [button_ convertPointToBase:point];
|
| - NSEvent* downEvent =
|
| - test_event_utils::LeftMouseDownAtPointInWindow(point, test_window());
|
| - scoped_nsobject<ProfileShowMenuHandler> showMenuHandler(
|
| - [[ProfileShowMenuHandler alloc] init]);
|
| - [button_ mouseDown:downEvent
|
| - withShowMenuTarget:showMenuHandler];
|
| -
|
| - EXPECT_EQ(1, [showMenuHandler showMenuCount]);
|
| -}
|
|
|