Index: content/renderer/device_sensors/device_motion_event_pump_unittest.cc |
diff --git a/content/renderer/device_sensors/device_motion_event_pump_unittest.cc b/content/renderer/device_sensors/device_motion_event_pump_unittest.cc |
index bdba6c1688af91306375e5f4e0163d41d8c3985d..2662e5ae30a0a13d6cdb41462d4a0cdc16ed6d74 100644 |
--- a/content/renderer/device_sensors/device_motion_event_pump_unittest.cc |
+++ b/content/renderer/device_sensors/device_motion_event_pump_unittest.cc |
@@ -15,6 +15,7 @@ |
#include "base/threading/thread_task_runner_handle.h" |
#include "content/common/device_sensors/device_motion_hardware_buffer.h" |
#include "content/public/test/test_utils.h" |
+#include "mojo/public/cpp/system/buffer.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionListener.h" |
@@ -66,8 +67,8 @@ class DeviceMotionEventPumpForTesting : public DeviceMotionEventPump { |
int pump_delay_microseconds() const { return pump_delay_microseconds_; } |
- void OnDidStart(base::SharedMemoryHandle renderer_handle) { |
- DeviceMotionEventPump::OnDidStart(renderer_handle); |
+ void DidStart(mojo::ScopedSharedBufferHandle renderer_handle) { |
+ DeviceMotionEventPump::DidStart(std::move(renderer_handle)); |
} |
void SendStartMessage() override {} |
void SendStopMessage() override {} |
@@ -100,8 +101,6 @@ class DeviceMotionEventPumpTest : public testing::Test { |
buffer_ = static_cast<DeviceMotionHardwareBuffer*>(shared_memory_.memory()); |
ASSERT_NE(null_buffer, buffer_); |
memset(buffer_, 0, sizeof(DeviceMotionHardwareBuffer)); |
- ASSERT_TRUE(shared_memory_.ShareToProcess(base::GetCurrentProcessHandle(), |
- &handle_)); |
} |
void InitBuffer(bool allAvailableSensorsActive) { |
@@ -117,12 +116,15 @@ class DeviceMotionEventPumpTest : public testing::Test { |
MockDeviceMotionListener* listener() { return listener_.get(); } |
DeviceMotionEventPumpForTesting* motion_pump() { return motion_pump_.get(); } |
- base::SharedMemoryHandle handle() { return handle_; } |
+ mojo::ScopedSharedBufferHandle handle() { |
+ return mojo::WrapSharedMemoryHandle( |
+ base::SharedMemory::DuplicateHandle(shared_memory_.handle()), |
+ sizeof(DeviceMotionHardwareBuffer), false); |
+ } |
private: |
std::unique_ptr<MockDeviceMotionListener> listener_; |
std::unique_ptr<DeviceMotionEventPumpForTesting> motion_pump_; |
- base::SharedMemoryHandle handle_; |
base::SharedMemory shared_memory_; |
DeviceMotionHardwareBuffer* buffer_; |
@@ -135,7 +137,7 @@ TEST_F(DeviceMotionEventPumpTest, DidStartPolling) { |
InitBuffer(true); |
motion_pump()->Start(listener()); |
- motion_pump()->OnDidStart(handle()); |
+ motion_pump()->DidStart(handle()); |
base::MessageLoop::current()->Run(); |
@@ -162,7 +164,7 @@ TEST_F(DeviceMotionEventPumpTest, DidStartPollingNotAllSensorsActive) { |
InitBuffer(false); |
motion_pump()->Start(listener()); |
- motion_pump()->OnDidStart(handle()); |
+ motion_pump()->DidStart(handle()); |
base::MessageLoop::current()->Run(); |
@@ -194,7 +196,7 @@ TEST_F(DeviceMotionEventPumpTest, PumpThrottlesEventRate) { |
motion_pump()->set_stop_on_fire_event(false); |
motion_pump()->Start(listener()); |
- motion_pump()->OnDidStart(handle()); |
+ motion_pump()->DidStart(handle()); |
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |