Index: chrome/browser/ui/cocoa/chrome_browser_window_unittest.mm |
=================================================================== |
--- chrome/browser/ui/cocoa/chrome_browser_window_unittest.mm (revision 117895) |
+++ chrome/browser/ui/cocoa/chrome_browser_window_unittest.mm (working copy) |
@@ -12,23 +12,6 @@ |
#import "testing/gtest_mac.h" |
#include "testing/platform_test.h" |
-// An NSWindowDelegate that implements -commandDispatch:. |
-@interface TestDelegateWithCommandDispatch : NSObject { |
-} |
-- (void)commandDispatch:(id)sender; |
-@end |
-@implementation TestDelegateWithCommandDispatch |
-- (void)commandDispatch:(id)sender { |
-} |
-@end |
- |
-// An NSWindowDelegate that doesn't implement -commandDispatch:. |
-@interface TestDelegateWithoutCommandDispatch : NSObject { |
-} |
-@end |
-@implementation TestDelegateWithoutCommandDispatch |
-@end |
- |
class ChromeBrowserWindowTest : public CocoaTest { |
public: |
virtual void SetUp() { |
@@ -62,43 +45,3 @@ |
[window_ display]; |
} |
-// Tests routing of -performClose:. |
-TEST_F(ChromeBrowserWindowTest, PerformCloseTest) { |
- scoped_nsobject<NSMenuItem> zoom_item( |
- [[NSMenuItem alloc] initWithTitle:@"Zoom" |
- action:@selector(performZoom:) |
- keyEquivalent:@""]); |
- scoped_nsobject<NSMenuItem> close_item( |
- [[NSMenuItem alloc] initWithTitle:@"Close" |
- action:@selector(performClose:) |
- keyEquivalent:@""]); |
- scoped_nsobject<NSMenuItem> close_tab_item( |
- [[NSMenuItem alloc] initWithTitle:@"Close Tab" |
- action:@selector(performClose:) |
- keyEquivalent:@""]); |
- [close_tab_item setTag:IDC_CLOSE_TAB]; |
- |
- scoped_nsobject<id> delegate1( |
- [[TestDelegateWithCommandDispatch alloc] init]); |
- scoped_nsobject<id> delegate2( |
- [[TestDelegateWithoutCommandDispatch alloc] init]); |
- |
- struct { |
- id delegate; |
- id sender; |
- BOOL should_route; |
- } cases[] = { |
- { delegate1, delegate1, NO }, |
- { delegate1, window_, NO }, |
- { delegate1, zoom_item, NO }, |
- { delegate1, close_item, NO }, |
- { delegate1, close_tab_item, YES }, |
- { delegate2, close_tab_item, NO }, |
- }; |
- |
- for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) { |
- [window_ setDelegate:cases[i].delegate]; |
- EXPECT_EQ(cases[i].should_route, |
- [window_ performCloseShouldRouteToCommandDispatch:cases[i].sender]); |
- } |
-} |