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

Side by Side Diff: chrome/browser/ui/cocoa/menu_controller_unittest.mm

Issue 10837317: Setting the touch wrench menu as default menu for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another merge! Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); 101 [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]);
102 EXPECT_EQ([[menu menu] numberOfItems], 0); 102 EXPECT_EQ([[menu menu] numberOfItems], 0);
103 } 103 }
104 104
105 TEST_F(MenuControllerTest, BasicCreation) { 105 TEST_F(MenuControllerTest, BasicCreation) {
106 Delegate delegate; 106 Delegate delegate;
107 ui::SimpleMenuModel model(&delegate); 107 ui::SimpleMenuModel model(&delegate);
108 model.AddItem(1, ASCIIToUTF16("one")); 108 model.AddItem(1, ASCIIToUTF16("one"));
109 model.AddItem(2, ASCIIToUTF16("two")); 109 model.AddItem(2, ASCIIToUTF16("two"));
110 model.AddItem(3, ASCIIToUTF16("three")); 110 model.AddItem(3, ASCIIToUTF16("three"));
111 model.AddSeparator(); 111 model.AddSeparator(ui::NORMAL_SEPARATOR);
112 model.AddItem(4, ASCIIToUTF16("four")); 112 model.AddItem(4, ASCIIToUTF16("four"));
113 model.AddItem(5, ASCIIToUTF16("five")); 113 model.AddItem(5, ASCIIToUTF16("five"));
114 114
115 scoped_nsobject<MenuController> menu( 115 scoped_nsobject<MenuController> menu(
116 [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]); 116 [[MenuController alloc] initWithModel:&model useWithPopUpButtonCell:NO]);
117 EXPECT_EQ([[menu menu] numberOfItems], 6); 117 EXPECT_EQ([[menu menu] numberOfItems], 6);
118 118
119 // Check the title, tag, and represented object are correct for a random 119 // Check the title, tag, and represented object are correct for a random
120 // element. 120 // element.
121 NSMenuItem* itemTwo = [[menu menu] itemAtIndex:2]; 121 NSMenuItem* itemTwo = [[menu menu] itemAtIndex:2];
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 EXPECT_FALSE(delegate.did_close_); 327 EXPECT_FALSE(delegate.did_close_);
328 328
329 // Pump the task that notifies the delegate. 329 // Pump the task that notifies the delegate.
330 message_loop.RunAllPending(); 330 message_loop.RunAllPending();
331 331
332 // Expect that the delegate got notified properly. 332 // Expect that the delegate got notified properly.
333 EXPECT_TRUE(delegate.did_close_); 333 EXPECT_TRUE(delegate.did_close_);
334 } 334 }
335 335
336 } // namespace 336 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698