Index: chrome/test/base/view_event_test_base.cc |
diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc |
index f370e3d34cad17f463ccae93e361bf81a8ff61cd..facfd59f1075be4dee4d4ec7f31e085d0f7c2c6b 100644 |
--- a/chrome/test/base/view_event_test_base.cc |
+++ b/chrome/test/base/view_event_test_base.cc |
@@ -70,9 +70,11 @@ void ViewEventTestBase::Done() { |
PostMessage(window_->GetNativeWindow(), WM_USER, 0, 0); |
#endif |
- // If we're in a nested message loop, as is the case with menus, we need |
- // to quit twice. The second quit does that for us. |
- MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
+ // If we're in a nested message loop, as is the case with menus, we |
+ // need to quit twice. The second quit does that for us. Finish all |
+ // pending UI events before posting closure because events it may be |
+ // executed before UI events are executed. |
+ ui_controls::RunClosureAfterAllPendingUIEvents(MessageLoop::QuitClosure()); |
} |
void ViewEventTestBase::SetUp() { |