Chromium Code Reviews| Index: content/renderer/device_sensors/device_orientation_event_pump_unittest.cc |
| diff --git a/content/renderer/device_sensors/device_orientation_event_pump_unittest.cc b/content/renderer/device_sensors/device_orientation_event_pump_unittest.cc |
| index 141f8faabf40319b032481dc9aec45fa0b5d5df5..4217c3fddb946da09f910f95f8c01bb6dd43dbb2 100644 |
| --- a/content/renderer/device_sensors/device_orientation_event_pump_unittest.cc |
| +++ b/content/renderer/device_sensors/device_orientation_event_pump_unittest.cc |
| @@ -52,11 +52,11 @@ class MockDeviceOrientationListener |
| class DeviceOrientationEventPumpForTesting : public DeviceOrientationEventPump { |
| public: |
| DeviceOrientationEventPumpForTesting() |
| - : DeviceOrientationEventPump(0) { } |
| + : DeviceOrientationEventPump(nullptr) {} |
| ~DeviceOrientationEventPumpForTesting() override {} |
| - void OnDidStart(base::SharedMemoryHandle renderer_handle) { |
| - DeviceOrientationEventPump::OnDidStart(renderer_handle); |
| + void DidStart(mojo::ScopedSharedBufferHandle renderer_handle) { |
| + DeviceOrientationEventPump::DidStart(std::move(renderer_handle)); |
| } |
| void SendStartMessage() override {} |
| void SendStopMessage() override {} |
| @@ -86,8 +86,6 @@ class DeviceOrientationEventPumpTest : public testing::Test { |
| shared_memory_.memory()); |
| ASSERT_NE(null_buffer, buffer_); |
| memset(buffer_, 0, sizeof(DeviceOrientationHardwareBuffer)); |
| - ASSERT_TRUE(shared_memory_.ShareToProcess(base::GetCurrentProcessHandle(), |
| - &handle_)); |
| } |
| void InitBuffer() { |
| @@ -110,13 +108,16 @@ class DeviceOrientationEventPumpTest : public testing::Test { |
| DeviceOrientationEventPumpForTesting* orientation_pump() { |
| return orientation_pump_.get(); |
| } |
| - base::SharedMemoryHandle handle() { return handle_; } |
| + mojo::ScopedSharedBufferHandle handle() { |
| + return mojo::WrapSharedMemoryHandle( |
|
dcheng
2016/07/04 03:39:49
Here and elsewhere, would it make sense to just us
Sam McNally
2016/07/04 08:31:38
Done.
|
| + base::SharedMemory::DuplicateHandle(shared_memory_.handle()), |
| + sizeof(DeviceOrientationHardwareBuffer), false); |
| + } |
| DeviceOrientationHardwareBuffer* buffer() { return buffer_; } |
| private: |
| std::unique_ptr<MockDeviceOrientationListener> listener_; |
| std::unique_ptr<DeviceOrientationEventPumpForTesting> orientation_pump_; |
| - base::SharedMemoryHandle handle_; |
| base::SharedMemory shared_memory_; |
| DeviceOrientationHardwareBuffer* buffer_; |
| @@ -128,7 +129,7 @@ TEST_F(DeviceOrientationEventPumpTest, DidStartPolling) { |
| InitBuffer(); |
| orientation_pump()->Start(listener()); |
| - orientation_pump()->OnDidStart(handle()); |
| + orientation_pump()->DidStart(handle()); |
| base::MessageLoop::current()->Run(); |
| @@ -148,7 +149,7 @@ TEST_F(DeviceOrientationEventPumpTest, FireAllNullEvent) { |
| InitBufferNoData(); |
| orientation_pump()->Start(listener()); |
| - orientation_pump()->OnDidStart(handle()); |
| + orientation_pump()->DidStart(handle()); |
| base::MessageLoop::current()->Run(); |
| @@ -165,7 +166,7 @@ TEST_F(DeviceOrientationEventPumpTest, UpdateRespectsOrientationThreshold) { |
| InitBuffer(); |
| orientation_pump()->Start(listener()); |
| - orientation_pump()->OnDidStart(handle()); |
| + orientation_pump()->DidStart(handle()); |
| base::MessageLoop::current()->Run(); |