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

Unified Diff: ui/views/focus/focus_manager_unittest_win.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, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/examples/content_client/examples_browser_main_parts.cc ('k') | ui/views/test/views_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager_unittest_win.cc
diff --git a/ui/views/focus/focus_manager_unittest_win.cc b/ui/views/focus/focus_manager_unittest_win.cc
index 2a18e5450e2aa5211deb00b43cf50a7a303f660d..03802938452b162ef1e7150e77dc725f577722e1 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());
« no previous file with comments | « ui/views/examples/content_client/examples_browser_main_parts.cc ('k') | ui/views/test/views_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698