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

Side by Side Diff: content/browser/device_sensors/sensor_manager_chromeos_unittest.cc

Issue 1874893002: Convert //content/browser from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 "content/browser/device_sensors/sensor_manager_chromeos.h"
6 6
7 #include <memory>
8
7 #include "base/macros.h" 9 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "chromeos/accelerometer/accelerometer_types.h" 10 #include "chromeos/accelerometer/accelerometer_types.h"
10 #include "content/common/device_sensors/device_motion_hardware_buffer.h" 11 #include "content/common/device_sensors/device_motion_hardware_buffer.h"
11 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" 12 #include "content/common/device_sensors/device_orientation_hardware_buffer.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace { 15 namespace {
15 16
16 const double kMeanGravity = -9.80665; 17 const double kMeanGravity = -9.80665;
17 18
18 // Isolated content::SensorManagerChromeOS from the active 19 // Isolated content::SensorManagerChromeOS from the active
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 orientation_buffer_.get()); 69 orientation_buffer_.get());
69 } 70 }
70 71
71 void TearDown() override { 72 void TearDown() override {
72 sensor_manager_->StopFetchingDeviceMotionData(); 73 sensor_manager_->StopFetchingDeviceMotionData();
73 sensor_manager_->StopFetchingDeviceOrientationData(); 74 sensor_manager_->StopFetchingDeviceOrientationData();
74 testing::Test::TearDown(); 75 testing::Test::TearDown();
75 } 76 }
76 77
77 private: 78 private:
78 scoped_ptr<TestSensorManagerChromeOS> sensor_manager_; 79 std::unique_ptr<TestSensorManagerChromeOS> sensor_manager_;
79 scoped_ptr<DeviceMotionHardwareBuffer> motion_buffer_; 80 std::unique_ptr<DeviceMotionHardwareBuffer> motion_buffer_;
80 scoped_ptr<DeviceOrientationHardwareBuffer> orientation_buffer_; 81 std::unique_ptr<DeviceOrientationHardwareBuffer> orientation_buffer_;
81 82
82 DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOSTest); 83 DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOSTest);
83 }; 84 };
84 85
85 // Tests that starting to process motion data will update the associated buffer. 86 // Tests that starting to process motion data will update the associated buffer.
86 TEST_F(SensorManagerChromeOSTest, MotionBuffer) { 87 TEST_F(SensorManagerChromeOSTest, MotionBuffer) {
87 DeviceMotionHardwareBuffer* buffer = motion_buffer(); 88 DeviceMotionHardwareBuffer* buffer = motion_buffer();
88 EXPECT_FLOAT_EQ(100.0f, buffer->data.interval); 89 EXPECT_FLOAT_EQ(100.0f, buffer->data.interval);
89 EXPECT_FALSE(buffer->data.hasAccelerationIncludingGravityX); 90 EXPECT_FALSE(buffer->data.hasAccelerationIncludingGravityX);
90 EXPECT_FALSE(buffer->data.hasAccelerationIncludingGravityY); 91 EXPECT_FALSE(buffer->data.hasAccelerationIncludingGravityY);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 EXPECT_FLOAT_EQ(0.0f, motion->data.accelerationIncludingGravityY); 220 EXPECT_FLOAT_EQ(0.0f, motion->data.accelerationIncludingGravityY);
220 EXPECT_FLOAT_EQ(-kMeanGravity / 2.0f, 221 EXPECT_FLOAT_EQ(-kMeanGravity / 2.0f,
221 motion->data.accelerationIncludingGravityZ); 222 motion->data.accelerationIncludingGravityZ);
222 223
223 DeviceOrientationHardwareBuffer* orientation = orientation_buffer(); 224 DeviceOrientationHardwareBuffer* orientation = orientation_buffer();
224 EXPECT_FLOAT_EQ(0.0f, orientation->data.beta); 225 EXPECT_FLOAT_EQ(0.0f, orientation->data.beta);
225 EXPECT_FLOAT_EQ(45.0f, orientation->data.gamma); 226 EXPECT_FLOAT_EQ(45.0f, orientation->data.gamma);
226 } 227 }
227 228
228 } // namespace content 229 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698