Chromium Code Reviews| Index: content/renderer/device_sensors/device_motion_event_pump.cc |
| diff --git a/content/renderer/device_sensors/device_motion_event_pump.cc b/content/renderer/device_sensors/device_motion_event_pump.cc |
| index 860cf68e2f16fb18b13f6d794e047f229991d468..125b2a2051afc06fe84d30ce6ec3ce0ba912a623 100644 |
| --- a/content/renderer/device_sensors/device_motion_event_pump.cc |
| +++ b/content/renderer/device_sensors/device_motion_event_pump.cc |
| @@ -4,34 +4,26 @@ |
| #include "device_motion_event_pump.h" |
| -#include "content/common/device_sensors/device_motion_messages.h" |
| #include "content/public/renderer/render_thread.h" |
| #include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionListener.h" |
| namespace content { |
| DeviceMotionEventPump::DeviceMotionEventPump(RenderThread* thread) |
| - : DeviceSensorEventPump<blink::WebDeviceMotionListener>(thread) { |
| -} |
| + : DeviceMojoClientMixin< |
| + DeviceSensorEventPump<blink::WebDeviceMotionListener>, |
| + device::mojom::MotionSensor>(thread) {} |
| DeviceMotionEventPump::~DeviceMotionEventPump() { |
| } |
| -bool DeviceMotionEventPump::OnControlMessageReceived( |
| - const IPC::Message& message) { |
| - bool handled = true; |
| - IPC_BEGIN_MESSAGE_MAP(DeviceMotionEventPump, message) |
| - IPC_MESSAGE_HANDLER(DeviceMotionMsg_DidStartPolling, OnDidStart) |
| - IPC_MESSAGE_UNHANDLED(handled = false) |
| - IPC_END_MESSAGE_MAP() |
| - return handled; |
| -} |
| - |
| void DeviceMotionEventPump::FireEvent() { |
| DCHECK(listener()); |
| blink::WebDeviceMotionData data; |
| - if (reader_->GetLatestData(&data) && data.allAvailableSensorsAreActive) |
| + if (!using_fake_data_for_testing_ && reader_->GetLatestData(&data) && |
|
timvolodine
2016/06/09 17:43:47
don't think this should be called in testing mode
Sam McNally
2016/06/10 01:07:51
Done. Previously, I hadn't replicated the testing
|
| + data.allAvailableSensorsAreActive) { |
| listener()->didChangeDeviceMotion(data); |
| + } |
| } |
| bool DeviceMotionEventPump::InitializeReader(base::SharedMemoryHandle handle) { |
| @@ -40,15 +32,8 @@ bool DeviceMotionEventPump::InitializeReader(base::SharedMemoryHandle handle) { |
| return reader_->Initialize(handle); |
| } |
| -void DeviceMotionEventPump::SendStartMessage() { |
| - RenderThread::Get()->Send(new DeviceMotionHostMsg_StartPolling()); |
| -} |
| - |
| -void DeviceMotionEventPump::SendStopMessage() { |
| - RenderThread::Get()->Send(new DeviceMotionHostMsg_StopPolling()); |
| -} |
| - |
| void DeviceMotionEventPump::SendFakeDataForTesting(void* fake_data) { |
| + using_fake_data_for_testing_ = true; |
| blink::WebDeviceMotionData data = |
| *static_cast<blink::WebDeviceMotionData*>(fake_data); |