OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device_motion_event_pump.h" | 5 #include "device_motion_event_pump.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 base::MessageLoopForUI loop; | 187 base::MessageLoopForUI loop; |
188 | 188 |
189 InitBuffer(true); | 189 InitBuffer(true); |
190 | 190 |
191 motion_pump()->set_stop_on_fire_event(false); | 191 motion_pump()->set_stop_on_fire_event(false); |
192 motion_pump()->Start(listener()); | 192 motion_pump()->Start(listener()); |
193 motion_pump()->OnDidStart(handle()); | 193 motion_pump()->OnDidStart(handle()); |
194 | 194 |
195 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 195 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
196 FROM_HERE, base::MessageLoop::QuitClosure(), | 196 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
197 base::TimeDelta::FromMilliseconds(100)); | 197 base::TimeDelta::FromMilliseconds(100)); |
198 base::MessageLoop::current()->Run(); | 198 base::MessageLoop::current()->Run(); |
199 motion_pump()->Stop(); | 199 motion_pump()->Stop(); |
200 | 200 |
201 // Check that the blink::WebDeviceMotionListener does not receive excess | 201 // Check that the blink::WebDeviceMotionListener does not receive excess |
202 // events. | 202 // events. |
203 EXPECT_TRUE(listener()->did_change_device_motion()); | 203 EXPECT_TRUE(listener()->did_change_device_motion()); |
204 EXPECT_GE(6, listener()->number_of_events()); | 204 EXPECT_GE(6, listener()->number_of_events()); |
205 } | 205 } |
206 | 206 |
207 } // namespace content | 207 } // namespace content |
OLD | NEW |