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

Unified Diff: content/renderer/device_sensors/device_orientation_event_pump_unittest.cc

Issue 2037513002: Convert device_sensors to use mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@conversion--mime-registry
Patch Set: Created 4 years, 6 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_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(
+ 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();

Powered by Google App Engine
This is Rietveld 408576698