| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device_motion_event_pump.h" | 5 #include "device_motion_event_pump.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/common/device_sensors/device_motion_hardware_buffer.h" | 10 #include "content/common/device_sensors/device_motion_hardware_buffer.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 class DeviceMotionEventPumpTest : public testing::Test { | 65 class DeviceMotionEventPumpTest : public testing::Test { |
| 66 public: | 66 public: |
| 67 DeviceMotionEventPumpTest() { | 67 DeviceMotionEventPumpTest() { |
| 68 EXPECT_TRUE(shared_memory_.CreateAndMapAnonymous( | 68 EXPECT_TRUE(shared_memory_.CreateAndMapAnonymous( |
| 69 sizeof(DeviceMotionHardwareBuffer))); | 69 sizeof(DeviceMotionHardwareBuffer))); |
| 70 } | 70 } |
| 71 | 71 |
| 72 protected: | 72 protected: |
| 73 virtual void SetUp() override { | 73 void SetUp() override { |
| 74 const DeviceMotionHardwareBuffer* null_buffer = NULL; | 74 const DeviceMotionHardwareBuffer* null_buffer = NULL; |
| 75 listener_.reset(new MockDeviceMotionListener); | 75 listener_.reset(new MockDeviceMotionListener); |
| 76 motion_pump_.reset(new DeviceMotionEventPumpForTesting); | 76 motion_pump_.reset(new DeviceMotionEventPumpForTesting); |
| 77 buffer_ = static_cast<DeviceMotionHardwareBuffer*>(shared_memory_.memory()); | 77 buffer_ = static_cast<DeviceMotionHardwareBuffer*>(shared_memory_.memory()); |
| 78 ASSERT_NE(null_buffer, buffer_); | 78 ASSERT_NE(null_buffer, buffer_); |
| 79 memset(buffer_, 0, sizeof(DeviceMotionHardwareBuffer)); | 79 memset(buffer_, 0, sizeof(DeviceMotionHardwareBuffer)); |
| 80 ASSERT_TRUE(shared_memory_.ShareToProcess(base::GetCurrentProcessHandle(), | 80 ASSERT_TRUE(shared_memory_.ShareToProcess(base::GetCurrentProcessHandle(), |
| 81 &handle_)); | 81 &handle_)); |
| 82 } | 82 } |
| 83 | 83 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 EXPECT_FALSE(received_data.hasAccelerationZ); | 152 EXPECT_FALSE(received_data.hasAccelerationZ); |
| 153 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityX); | 153 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityX); |
| 154 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityY); | 154 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityY); |
| 155 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityZ); | 155 EXPECT_FALSE(received_data.hasAccelerationIncludingGravityZ); |
| 156 EXPECT_FALSE(received_data.hasRotationRateAlpha); | 156 EXPECT_FALSE(received_data.hasRotationRateAlpha); |
| 157 EXPECT_FALSE(received_data.hasRotationRateBeta); | 157 EXPECT_FALSE(received_data.hasRotationRateBeta); |
| 158 EXPECT_FALSE(received_data.hasRotationRateGamma); | 158 EXPECT_FALSE(received_data.hasRotationRateGamma); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace content | 161 } // namespace content |
| OLD | NEW |