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

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

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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/strings/sys_string_conversions.h" 8 #include "base/strings/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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // Now get rid of the icon and make sure it goes away. 301 // Now get rid of the icon and make sure it goes away.
302 delegate.SetDynamicIcon(gfx::Image()); 302 delegate.SetDynamicIcon(gfx::Image());
303 Validate(menu.get(), [menu menu]); 303 Validate(menu.get(), [menu menu]);
304 EXPECT_EQ(second, base::SysNSStringToUTF16([item title])); 304 EXPECT_EQ(second, base::SysNSStringToUTF16([item title]));
305 EXPECT_EQ(nil, [item image]); 305 EXPECT_EQ(nil, [item image]);
306 } 306 }
307 307
308 TEST_F(MenuControllerTest, OpenClose) { 308 TEST_F(MenuControllerTest, OpenClose) {
309 // ui::SimpleMenuModel posts a task that calls Delegate::MenuClosed. Create 309 // ui::SimpleMenuModel posts a task that calls Delegate::MenuClosed. Create
310 // a MessageLoop for that purpose. 310 // a MessageLoop for that purpose.
311 MessageLoop message_loop(MessageLoop::TYPE_UI); 311 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
312 312
313 // Create the model. 313 // Create the model.
314 Delegate delegate; 314 Delegate delegate;
315 ui::SimpleMenuModel model(&delegate); 315 ui::SimpleMenuModel model(&delegate);
316 model.AddItem(1, ASCIIToUTF16("allays")); 316 model.AddItem(1, ASCIIToUTF16("allays"));
317 model.AddItem(2, ASCIIToUTF16("i")); 317 model.AddItem(2, ASCIIToUTF16("i"));
318 model.AddItem(3, ASCIIToUTF16("bf")); 318 model.AddItem(3, ASCIIToUTF16("bf"));
319 319
320 // Create the controller. 320 // Create the controller.
321 scoped_nsobject<MenuController> menu( 321 scoped_nsobject<MenuController> menu(
(...skipping 25 matching lines...) Expand all
347 EXPECT_FALSE(delegate.did_close_); 347 EXPECT_FALSE(delegate.did_close_);
348 348
349 // Pump the task that notifies the delegate. 349 // Pump the task that notifies the delegate.
350 message_loop.RunUntilIdle(); 350 message_loop.RunUntilIdle();
351 351
352 // Expect that the delegate got notified properly. 352 // Expect that the delegate got notified properly.
353 EXPECT_TRUE(delegate.did_close_); 353 EXPECT_TRUE(delegate.did_close_);
354 } 354 }
355 355
356 } // namespace 356 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698