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

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

Issue 10822030: Move ui_test_utils::RunMessageLoop to test_utils so that it can be reused by content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « chrome/test/base/ui_test_utils_win.cc ('k') | chrome/test/ppapi/ppapi_test.cc » ('j') | 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) 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 "chrome/test/base/view_event_test_base.h" 5 #include "chrome/test/base/view_event_test_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // Flush any pending events to make sure we start with a clean slate. 153 // Flush any pending events to make sure we start with a clean slate.
154 ui_test_utils::RunAllPendingInMessageLoop(); 154 ui_test_utils::RunAllPendingInMessageLoop();
155 155
156 // Schedule a task that starts the test. Need to do this as we're going to 156 // Schedule a task that starts the test. Need to do this as we're going to
157 // run the message loop. 157 // run the message loop.
158 MessageLoop::current()->PostTask( 158 MessageLoop::current()->PostTask(
159 FROM_HERE, 159 FROM_HERE,
160 base::Bind(&ViewEventTestBase::DoTestOnMessageLoop, this)); 160 base::Bind(&ViewEventTestBase::DoTestOnMessageLoop, this));
161 161
162 ui_test_utils::RunMessageLoop(); 162 content::RunMessageLoop();
163 } 163 }
164 164
165 gfx::Size ViewEventTestBase::GetPreferredSize() { 165 gfx::Size ViewEventTestBase::GetPreferredSize() {
166 return gfx::Size(); 166 return gfx::Size();
167 } 167 }
168 168
169 void ViewEventTestBase::ScheduleMouseMoveInBackground(int x, int y) { 169 void ViewEventTestBase::ScheduleMouseMoveInBackground(int x, int y) {
170 if (!dnd_thread_.get()) { 170 if (!dnd_thread_.get()) {
171 dnd_thread_.reset(new base::Thread("mouse-move-thread")); 171 dnd_thread_.reset(new base::Thread("mouse-move-thread"));
172 dnd_thread_->Start(); 172 dnd_thread_->Start();
173 } 173 }
174 dnd_thread_->message_loop()->PostDelayedTask( 174 dnd_thread_->message_loop()->PostDelayedTask(
175 FROM_HERE, 175 FROM_HERE,
176 base::Bind(base::IgnoreResult(&ui_controls::SendMouseMove), x, y), 176 base::Bind(base::IgnoreResult(&ui_controls::SendMouseMove), x, y),
177 base::TimeDelta::FromMilliseconds(kMouseMoveDelayMS)); 177 base::TimeDelta::FromMilliseconds(kMouseMoveDelayMS));
178 } 178 }
179 179
180 void ViewEventTestBase::StopBackgroundThread() { 180 void ViewEventTestBase::StopBackgroundThread() {
181 dnd_thread_.reset(NULL); 181 dnd_thread_.reset(NULL);
182 } 182 }
183 183
184 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { 184 void ViewEventTestBase::RunTestMethod(const base::Closure& task) {
185 StopBackgroundThread(); 185 StopBackgroundThread();
186 186
187 task.Run(); 187 task.Run();
188 if (HasFatalFailure()) 188 if (HasFatalFailure())
189 Done(); 189 Done();
190 } 190 }
OLDNEW
« no previous file with comments | « chrome/test/base/ui_test_utils_win.cc ('k') | chrome/test/ppapi/ppapi_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698