diff options
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/controls/menu/menu_controller.cc | 4 | ||||
-rw-r--r-- | ui/views/examples/content_client/examples_browser_main_parts.cc | 6 | ||||
-rw-r--r-- | ui/views/focus/focus_manager_unittest_win.cc | 18 | ||||
-rw-r--r-- | ui/views/test/views_test_base.cc | 9 |
4 files changed, 22 insertions, 15 deletions
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index feda07e..6cf1f43 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -6,6 +6,7 @@ #include "base/i18n/case_conversion.h" #include "base/i18n/rtl.h" +#include "base/run_loop.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "ui/base/dragdrop/drag_utils.h" @@ -343,7 +344,8 @@ MenuItemView* MenuController::Run(Widget* parent, { MessageLoopForUI* loop = MessageLoopForUI::current(); MessageLoop::ScopedNestableTaskAllower allow(loop); - loop->RunWithDispatcher(this); + base::RunLoop run_loop(this); + run_loop.Run(); } #endif message_loop_depth_--; diff --git a/ui/views/examples/content_client/examples_browser_main_parts.cc b/ui/views/examples/content_client/examples_browser_main_parts.cc index c8bdba7..174bc80 100644 --- a/ui/views/examples/content_client/examples_browser_main_parts.cc +++ b/ui/views/examples/content_client/examples_browser_main_parts.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/message_loop.h" +#include "base/run_loop.h" #include "base/string_number_conversions.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" @@ -77,10 +78,11 @@ bool ExamplesBrowserMainParts::MainMessageLoopRun(int* result_code) { // xxx: Hax here because this kills event handling. #if !defined(USE_AURA) views::AcceleratorHandler accelerator_handler; - MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); + base::RunLoop run_loop(&accelerator_handler); #else - MessageLoopForUI::current()->Run(); + base::RunLoop run_loop; #endif + run_loop.Run(); return true; } diff --git a/ui/views/focus/focus_manager_unittest_win.cc b/ui/views/focus/focus_manager_unittest_win.cc index 2a18e54..0380293 100644 --- a/ui/views/focus/focus_manager_unittest_win.cc +++ b/ui/views/focus/focus_manager_unittest_win.cc @@ -4,6 +4,8 @@ #include "ui/views/focus/focus_manager.h" +#include "base/memory/scoped_ptr.h" +#include "base/run_loop.h" #include "base/utf_string_conversions.h" #include "ui/views/controls/button/text_button.h" #include "ui/views/focus/accelerator_handler.h" @@ -215,8 +217,8 @@ TEST_F(FocusManagerTest, IgnoreKeyupForAccelerators) { PostKeyDown(ui::VKEY_9); PostKeyUp(ui::VKEY_9); AcceleratorHandler accelerator_handler; - MessageLoopForUI::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); - MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); + scoped_ptr<base::RunLoop> run_loop(new base::RunLoop(&accelerator_handler)); + run_loop->RunUntilIdle(); // Make sure we get a key-up and key-down. ASSERT_EQ(1U, mtv->keys_pressed().size()); EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed()[0]); @@ -234,8 +236,8 @@ TEST_F(FocusManagerTest, IgnoreKeyupForAccelerators) { PostKeyUp(ui::VKEY_9); PostKeyUp(ui::VKEY_7); PostKeyUp(ui::VKEY_8); - MessageLoopForUI::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); - MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); + run_loop.reset(new base::RunLoop(&accelerator_handler)); + run_loop->RunUntilIdle(); // Make sure we get a key-up and key-down. ASSERT_EQ(5U, mtv->keys_pressed().size()); EXPECT_EQ(ui::VKEY_9, mtv->keys_pressed()[0]); @@ -253,8 +255,8 @@ TEST_F(FocusManagerTest, IgnoreKeyupForAccelerators) { // Now send an accelerator key sequence. PostKeyDown(ui::VKEY_0); PostKeyUp(ui::VKEY_0); - MessageLoopForUI::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); - MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); + run_loop.reset(new base::RunLoop(&accelerator_handler)); + run_loop->RunUntilIdle(); EXPECT_TRUE(mtv->keys_pressed().empty()); EXPECT_TRUE(mtv->keys_released().empty()); EXPECT_TRUE(mtv->accelerator_pressed()); @@ -268,8 +270,8 @@ TEST_F(FocusManagerTest, IgnoreKeyupForAccelerators) { PostKeyDown(ui::VKEY_0); PostKeyUp(ui::VKEY_1); PostKeyUp(ui::VKEY_0); - MessageLoopForUI::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); - MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); + run_loop.reset(new base::RunLoop(&accelerator_handler)); + run_loop->RunUntilIdle(); EXPECT_TRUE(mtv->keys_pressed().empty()); EXPECT_TRUE(mtv->keys_released().empty()); EXPECT_TRUE(mtv->accelerator_pressed()); diff --git a/ui/views/test/views_test_base.cc b/ui/views/test/views_test_base.cc index 329c9f3..67c49c4 100644 --- a/ui/views/test/views_test_base.cc +++ b/ui/views/test/views_test_base.cc @@ -4,6 +4,8 @@ #include "ui/views/test/views_test_base.h" +#include "base/run_loop.h" + #if defined(USE_AURA) #include "ui/aura/env.h" #include "ui/aura/test/aura_test_helper.h" @@ -47,12 +49,11 @@ void ViewsTestBase::TearDown() { } void ViewsTestBase::RunPendingMessages() { + base::RunLoop run_loop; #if defined(USE_AURA) - message_loop_.RunAllPendingWithDispatcher( - aura::Env::GetInstance()->GetDispatcher()); -#else - message_loop_.RunAllPending(); + run_loop.set_dispatcher(aura::Env::GetInstance()->GetDispatcher()); #endif + run_loop.RunUntilIdle(); } } // namespace views |