Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: chrome/browser/cocoa/menu_button_unittest.mm

Issue 251091: Mac: Eliminate unintended "menu" method overrides. (Closed)
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/cocoa/menu_button.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/scoped_nsobject.h" 7 #include "base/scoped_nsobject.h"
8 #import "chrome/browser/cocoa/clickhold_button_cell.h" 8 #import "chrome/browser/cocoa/clickhold_button_cell.h"
9 #import "chrome/browser/cocoa/cocoa_test_helper.h" 9 #import "chrome/browser/cocoa/cocoa_test_helper.h"
10 #import "chrome/browser/cocoa/menu_button.h" 10 #import "chrome/browser/cocoa/menu_button.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // Test assigning a menu, again mostly to ensure nothing leaks or crashes. 44 // Test assigning a menu, again mostly to ensure nothing leaks or crashes.
45 TEST_F(MenuButtonTest, MenuAssign) { 45 TEST_F(MenuButtonTest, MenuAssign) {
46 scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]); 46 scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
47 ASSERT_TRUE(menu.get()); 47 ASSERT_TRUE(menu.get());
48 48
49 [menu insertItemWithTitle:@"" action:nil keyEquivalent:@"" atIndex:0]; 49 [menu insertItemWithTitle:@"" action:nil keyEquivalent:@"" atIndex:0];
50 [menu insertItemWithTitle:@"foo" action:nil keyEquivalent:@"" atIndex:1]; 50 [menu insertItemWithTitle:@"foo" action:nil keyEquivalent:@"" atIndex:1];
51 [menu insertItemWithTitle:@"bar" action:nil keyEquivalent:@"" atIndex:2]; 51 [menu insertItemWithTitle:@"bar" action:nil keyEquivalent:@"" atIndex:2];
52 [menu insertItemWithTitle:@"baz" action:nil keyEquivalent:@"" atIndex:3]; 52 [menu insertItemWithTitle:@"baz" action:nil keyEquivalent:@"" atIndex:3];
53 53
54 [button_ setMenu:menu]; 54 [button_ setAttachedMenu:menu];
55 EXPECT_TRUE([button_ menu]); 55 EXPECT_TRUE([button_ attachedMenu]);
56 56
57 // TODO(viettrungluu): Display the menu. (The tough part is closing the menu, 57 // TODO(viettrungluu): Display the menu. (The tough part is closing the menu,
58 // not opening it!) 58 // not opening it!)
59 59
60 // Since |button_| doesn't retain menu, we should probably unset it here. 60 // Since |button_| doesn't retain menu, we should probably unset it here.
61 [button_ setMenu:nil]; 61 [button_ setAttachedMenu:nil];
62 } 62 }
63 63
64 } // namespace 64 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/menu_button.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698