| OLD | NEW |
| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 } | 159 } |
| 160 | 160 |
| 161 void ViewEventTestBase::ScheduleMouseMoveInBackground(int x, int y) { | 161 void ViewEventTestBase::ScheduleMouseMoveInBackground(int x, int y) { |
| 162 if (!dnd_thread_.get()) { | 162 if (!dnd_thread_.get()) { |
| 163 dnd_thread_.reset(new base::Thread("mouse-move-thread")); | 163 dnd_thread_.reset(new base::Thread("mouse-move-thread")); |
| 164 dnd_thread_->Start(); | 164 dnd_thread_->Start(); |
| 165 } | 165 } |
| 166 dnd_thread_->message_loop()->PostDelayedTask( | 166 dnd_thread_->message_loop()->PostDelayedTask( |
| 167 FROM_HERE, | 167 FROM_HERE, |
| 168 base::Bind(base::IgnoreResult(&ui_controls::SendMouseMove), x, y), | 168 base::Bind(base::IgnoreResult(&ui_controls::SendMouseMove), x, y), |
| 169 kMouseMoveDelayMS); | 169 base::TimeDelta::FromMilliseconds(kMouseMoveDelayMS)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void ViewEventTestBase::StopBackgroundThread() { | 172 void ViewEventTestBase::StopBackgroundThread() { |
| 173 dnd_thread_.reset(NULL); | 173 dnd_thread_.reset(NULL); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { | 176 void ViewEventTestBase::RunTestMethod(const base::Closure& task) { |
| 177 StopBackgroundThread(); | 177 StopBackgroundThread(); |
| 178 | 178 |
| 179 task.Run(); | 179 task.Run(); |
| 180 if (HasFatalFailure()) | 180 if (HasFatalFailure()) |
| 181 Done(); | 181 Done(); |
| 182 } | 182 } |
| OLD | NEW |