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

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: phajdan feedback Created 8 years, 5 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 #include "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/run_loop.h"
9 #include "base/time.h" 10 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
11 #include "ui/base/dragdrop/drag_utils.h" 12 #include "ui/base/dragdrop/drag_utils.h"
12 #include "ui/base/dragdrop/os_exchange_data.h" 13 #include "ui/base/dragdrop/os_exchange_data.h"
13 #include "ui/base/events.h" 14 #include "ui/base/events.h"
14 #include "ui/base/keycodes/keyboard_codes.h" 15 #include "ui/base/keycodes/keyboard_codes.h"
15 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/gfx/canvas.h" 17 #include "ui/gfx/canvas.h"
17 #include "ui/gfx/screen.h" 18 #include "ui/gfx/screen.h"
18 #include "ui/views/controls/button/menu_button.h" 19 #include "ui/views/controls/button/menu_button.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 message_loop_depth_++; 326 message_loop_depth_++;
326 DCHECK_LE(message_loop_depth_, 2); 327 DCHECK_LE(message_loop_depth_, 2);
327 #if defined(USE_AURA) 328 #if defined(USE_AURA)
328 root_window_ = parent->GetNativeWindow()->GetRootWindow(); 329 root_window_ = parent->GetNativeWindow()->GetRootWindow();
329 aura::client::GetDispatcherClient(root_window_)-> 330 aura::client::GetDispatcherClient(root_window_)->
330 RunWithDispatcher(this, parent->GetNativeWindow(), true); 331 RunWithDispatcher(this, parent->GetNativeWindow(), true);
331 #else 332 #else
332 { 333 {
333 MessageLoopForUI* loop = MessageLoopForUI::current(); 334 MessageLoopForUI* loop = MessageLoopForUI::current();
334 MessageLoop::ScopedNestableTaskAllower allow(loop); 335 MessageLoop::ScopedNestableTaskAllower allow(loop);
335 loop->RunWithDispatcher(this); 336 base::RunLoop run_loop(this);
337 run_loop.Run();
336 } 338 }
337 #endif 339 #endif
338 message_loop_depth_--; 340 message_loop_depth_--;
339 341
340 if (ViewsDelegate::views_delegate) 342 if (ViewsDelegate::views_delegate)
341 ViewsDelegate::views_delegate->ReleaseRef(); 343 ViewsDelegate::views_delegate->ReleaseRef();
342 344
343 // Close any open menus. 345 // Close any open menus.
344 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT); 346 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT);
345 347
(...skipping 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2118 (!pending_state_.item->HasSubmenu() || 2120 (!pending_state_.item->HasSubmenu() ||
2119 !pending_state_.item->GetSubmenu()->IsShowing())) { 2121 !pending_state_.item->GetSubmenu()->IsShowing())) {
2120 // On exit if the user hasn't selected an item with a submenu, move the 2122 // On exit if the user hasn't selected an item with a submenu, move the
2121 // selection back to the parent menu item. 2123 // selection back to the parent menu item.
2122 SetSelection(pending_state_.item->GetParentMenuItem(), 2124 SetSelection(pending_state_.item->GetParentMenuItem(),
2123 SELECTION_OPEN_SUBMENU); 2125 SELECTION_OPEN_SUBMENU);
2124 } 2126 }
2125 } 2127 }
2126 2128
2127 } // namespace views 2129 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_helper.cc ('k') | ui/views/examples/content_client/examples_browser_main_parts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698