| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/device_sensors/sensor_manager_chromeos.h" | 5 #include "device/sensors/sensor_manager_chromeos.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chromeos/accelerometer/accelerometer_types.h" | 10 #include "chromeos/accelerometer/accelerometer_types.h" |
| 11 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" | 11 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" |
| 12 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" | 12 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const double kMeanGravity = -9.80665; | 17 const double kMeanGravity = -9.80665; |
| 18 | 18 |
| 19 // Isolated content::SensorManagerChromeOS from the active | 19 // Isolated device::SensorManagerChromeOS from the active |
| 20 // chromeos::AccelerometerReader. This allows for direct control over which | 20 // chromeos::AccelerometerReader. This allows for direct control over which |
| 21 // accelerometer events are provided to the sensor manager. | 21 // accelerometer events are provided to the sensor manager. |
| 22 class TestSensorManagerChromeOS : public content::SensorManagerChromeOS { | 22 class TestSensorManagerChromeOS : public device::SensorManagerChromeOS { |
| 23 public: | 23 public: |
| 24 TestSensorManagerChromeOS() {} | 24 TestSensorManagerChromeOS() {} |
| 25 ~TestSensorManagerChromeOS() override {}; | 25 ~TestSensorManagerChromeOS() override{}; |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 void StartObservingAccelerometer() override {} | 28 void StartObservingAccelerometer() override {} |
| 29 void StopObservingAccelerometer() override {} | 29 void StopObservingAccelerometer() override {} |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(TestSensorManagerChromeOS); | 32 DISALLOW_COPY_AND_ASSIGN(TestSensorManagerChromeOS); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 namespace content { | 37 namespace device { |
| 38 | 38 |
| 39 class SensorManagerChromeOSTest : public testing::Test { | 39 class SensorManagerChromeOSTest : public testing::Test { |
| 40 public: | 40 public: |
| 41 SensorManagerChromeOSTest() { | 41 SensorManagerChromeOSTest() { |
| 42 motion_buffer_.reset(new DeviceMotionHardwareBuffer); | 42 motion_buffer_.reset(new DeviceMotionHardwareBuffer); |
| 43 orientation_buffer_.reset(new DeviceOrientationHardwareBuffer); | 43 orientation_buffer_.reset(new DeviceOrientationHardwareBuffer); |
| 44 } | 44 } |
| 45 | 45 |
| 46 ~SensorManagerChromeOSTest() override {} | 46 ~SensorManagerChromeOSTest() override {} |
| 47 | 47 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 motion->data.accelerationIncludingGravityX); | 219 motion->data.accelerationIncludingGravityX); |
| 220 EXPECT_FLOAT_EQ(0.0f, motion->data.accelerationIncludingGravityY); | 220 EXPECT_FLOAT_EQ(0.0f, motion->data.accelerationIncludingGravityY); |
| 221 EXPECT_FLOAT_EQ(-kMeanGravity / 2.0f, | 221 EXPECT_FLOAT_EQ(-kMeanGravity / 2.0f, |
| 222 motion->data.accelerationIncludingGravityZ); | 222 motion->data.accelerationIncludingGravityZ); |
| 223 | 223 |
| 224 DeviceOrientationHardwareBuffer* orientation = orientation_buffer(); | 224 DeviceOrientationHardwareBuffer* orientation = orientation_buffer(); |
| 225 EXPECT_FLOAT_EQ(0.0f, orientation->data.beta); | 225 EXPECT_FLOAT_EQ(0.0f, orientation->data.beta); |
| 226 EXPECT_FLOAT_EQ(45.0f, orientation->data.gamma); | 226 EXPECT_FLOAT_EQ(45.0f, orientation->data.gamma); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace content | 229 } // namespace device |
| OLD | NEW |