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

Unified Diff: content/renderer/device_orientation/device_motion_event_pump_unittest.cc

Issue 20707002: Implement Device Orientation using shared memory in content/renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/device_orientation/device_motion_event_pump_unittest.cc
diff --git a/content/renderer/device_orientation/device_motion_event_pump_unittest.cc b/content/renderer/device_orientation/device_motion_event_pump_unittest.cc
index 2b628d4c80ef9bdf48f0507363ef4890c25651d4..066294b0aebd353ebb06333520912689ffb302c6 100644
--- a/content/renderer/device_orientation/device_motion_event_pump_unittest.cc
+++ b/content/renderer/device_orientation/device_motion_event_pump_unittest.cc
@@ -42,34 +42,13 @@ class DeviceMotionEventPumpForTesting : public DeviceMotionEventPump {
public:
DeviceMotionEventPumpForTesting() { }
virtual ~DeviceMotionEventPumpForTesting() { }
- void OnDidStartDeviceMotion(base::SharedMemoryHandle handle);
- bool SetListener(WebKit::WebDeviceMotionListener*);
- bool StartFetchingDeviceMotion();
- bool StopFetchingDeviceMotion();
-};
-
-bool DeviceMotionEventPumpForTesting::StartFetchingDeviceMotion() {
- state_ = PENDING_START;
- return true;
-}
-
-bool DeviceMotionEventPumpForTesting::StopFetchingDeviceMotion() {
- if (timer_.IsRunning())
- timer_.Stop();
- state_ = STOPPED;
- return true;
-}
-bool DeviceMotionEventPumpForTesting::SetListener(
- WebKit::WebDeviceMotionListener* listener) {
- listener_ = listener;
- return (listener_) ? StartFetchingDeviceMotion() : StopFetchingDeviceMotion();
-}
-
-void DeviceMotionEventPumpForTesting::OnDidStartDeviceMotion(
- base::SharedMemoryHandle handle) {
- DeviceMotionEventPump::OnDidStartDeviceMotion(handle);
-}
+ void OnDidStart(base::SharedMemoryHandle renderer_handle) {
+ DeviceMotionEventPump::OnDidStart(renderer_handle);
+ }
+ virtual bool SendStartMessage() OVERRIDE { return true; }
+ virtual bool SendStopMessage() OVERRIDE { return true; }
+};
// Always failing in the win try bot. See http://crbug.com/256782.
#if defined(OS_WIN)
@@ -102,9 +81,9 @@ TEST_F(DeviceMotionEventPumpTest, MAYBE_DidStartPolling) {
data.allAvailableSensorsAreActive = true;
motion_pump->SetListener(listener.get());
- motion_pump->OnDidStartDeviceMotion(handle);
+ motion_pump->OnDidStart(handle);
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
- DeviceMotionEventPump::GetDelayMillis() * 2));
+ motion_pump->GetDelayMillis() * 2));
RunAllPendingInMessageLoop();
motion_pump->SetListener(0);
@@ -159,9 +138,9 @@ TEST_F(DeviceMotionEventPumpTest, MAYBE_DidStartPollingNotAllSensorsActive) {
data.allAvailableSensorsAreActive = false;
motion_pump->SetListener(listener.get());
- motion_pump->OnDidStartDeviceMotion(handle);
+ motion_pump->OnDidStart(handle);
base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(
- DeviceMotionEventPump::GetDelayMillis() * 2));
+ motion_pump->GetDelayMillis() * 2));
RunAllPendingInMessageLoop();
motion_pump->SetListener(0);

Powered by Google App Engine
This is Rietveld 408576698