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

Side by Side Diff: chrome/test/base/view_event_test_base.cc

Issue 8799020: process all ui events before posting closure because menu depends (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 9 years 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
« no previous file with comments | « chrome/browser/automation/ui_controls_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/test/base/view_event_test_base.h" 5 #include "chrome/test/base/view_event_test_base.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <ole2.h> 8 #include <ole2.h>
9 #endif 9 #endif
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 method_factory_.RevokeAll(); 63 method_factory_.RevokeAll();
64 64
65 MessageLoop::current()->Quit(); 65 MessageLoop::current()->Quit();
66 66
67 #if defined(OS_WIN) 67 #if defined(OS_WIN)
68 // We need to post a message to tickle the Dispatcher getting called and 68 // We need to post a message to tickle the Dispatcher getting called and
69 // exiting out of the nested loop. Without this the quit never runs. 69 // exiting out of the nested loop. Without this the quit never runs.
70 PostMessage(window_->GetNativeWindow(), WM_USER, 0, 0); 70 PostMessage(window_->GetNativeWindow(), WM_USER, 0, 0);
71 #endif 71 #endif
72 72
73 // If we're in a nested message loop, as is the case with menus, we need 73 // If we're in a nested message loop, as is the case with menus, we
74 // to quit twice. The second quit does that for us. 74 // need to quit twice. The second quit does that for us. Finish all
75 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 75 // pending UI events before posting closure because events it may be
76 // executed before UI events are executed.
77 ui_controls::RunClosureAfterAllPendingUIEvents(MessageLoop::QuitClosure());
76 } 78 }
77 79
78 void ViewEventTestBase::SetUp() { 80 void ViewEventTestBase::SetUp() {
79 #if defined(OS_WIN) 81 #if defined(OS_WIN)
80 OleInitialize(NULL); 82 OleInitialize(NULL);
81 #endif 83 #endif
82 window_ = views::Widget::CreateWindow(this); 84 window_ = views::Widget::CreateWindow(this);
83 } 85 }
84 86
85 void ViewEventTestBase::TearDown() { 87 void ViewEventTestBase::TearDown() {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 dnd_thread_.reset(NULL); 165 dnd_thread_.reset(NULL);
164 } 166 }
165 167
166 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { 168 void ViewEventTestBase::RunTestMethod(const base::Closure& task) {
167 StopBackgroundThread(); 169 StopBackgroundThread();
168 170
169 task.Run(); 171 task.Run();
170 if (HasFatalFailure()) 172 if (HasFatalFailure())
171 Done(); 173 Done();
172 } 174 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/ui_controls_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698