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

Side by Side Diff: content/browser/device_sensors/sensor_manager_android_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 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 "content/browser/device_sensors/sensor_manager_android.h" 5 #include "content/browser/device_sensors/sensor_manager_android.h"
6 6
7 #include <memory>
8
7 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
10 #include "content/browser/device_sensors/device_sensors_consts.h" 11 #include "content/browser/device_sensors/device_sensors_consts.h"
11 #include "content/public/test/test_browser_thread_bundle.h" 12 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 namespace { 17 namespace {
17 18
18 class FakeSensorManagerAndroid : public SensorManagerAndroid { 19 class FakeSensorManagerAndroid : public SensorManagerAndroid {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 double alpha, double beta, double gamma) { 55 double alpha, double beta, double gamma) {
55 ASSERT_TRUE(buffer->data.allAvailableSensorsAreActive); 56 ASSERT_TRUE(buffer->data.allAvailableSensorsAreActive);
56 ASSERT_EQ(alpha, buffer->data.alpha); 57 ASSERT_EQ(alpha, buffer->data.alpha);
57 ASSERT_TRUE(buffer->data.hasAlpha); 58 ASSERT_TRUE(buffer->data.hasAlpha);
58 ASSERT_EQ(beta, buffer->data.beta); 59 ASSERT_EQ(beta, buffer->data.beta);
59 ASSERT_TRUE(buffer->data.hasBeta); 60 ASSERT_TRUE(buffer->data.hasBeta);
60 ASSERT_EQ(gamma, buffer->data.gamma); 61 ASSERT_EQ(gamma, buffer->data.gamma);
61 ASSERT_TRUE(buffer->data.hasGamma); 62 ASSERT_TRUE(buffer->data.hasGamma);
62 } 63 }
63 64
64 scoped_ptr<DeviceLightHardwareBuffer> light_buffer_; 65 std::unique_ptr<DeviceLightHardwareBuffer> light_buffer_;
65 scoped_ptr<DeviceMotionHardwareBuffer> motion_buffer_; 66 std::unique_ptr<DeviceMotionHardwareBuffer> motion_buffer_;
66 scoped_ptr<DeviceOrientationHardwareBuffer> orientation_buffer_; 67 std::unique_ptr<DeviceOrientationHardwareBuffer> orientation_buffer_;
67 scoped_ptr<DeviceOrientationHardwareBuffer> orientation_absolute_buffer_; 68 std::unique_ptr<DeviceOrientationHardwareBuffer> orientation_absolute_buffer_;
68 content::TestBrowserThreadBundle thread_bundle_; 69 content::TestBrowserThreadBundle thread_bundle_;
69 }; 70 };
70 71
71 TEST_F(AndroidSensorManagerTest, ThreeDeviceMotionSensorsActive) { 72 TEST_F(AndroidSensorManagerTest, ThreeDeviceMotionSensorsActive) {
72 FakeSensorManagerAndroid::Register(base::android::AttachCurrentThread()); 73 FakeSensorManagerAndroid::Register(base::android::AttachCurrentThread());
73 FakeSensorManagerAndroid sensorManager; 74 FakeSensorManagerAndroid sensorManager;
74 sensorManager.SetNumberActiveDeviceMotionSensors(3); 75 sensorManager.SetNumberActiveDeviceMotionSensors(3);
75 76
76 sensorManager.StartFetchingDeviceMotionData(motion_buffer_.get()); 77 sensorManager.StartFetchingDeviceMotionData(motion_buffer_.get());
77 ASSERT_FALSE(motion_buffer_->data.allAvailableSensorsAreActive); 78 ASSERT_FALSE(motion_buffer_->data.allAvailableSensorsAreActive);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 sensorManager.GotLight(nullptr, nullptr, 100); 183 sensorManager.GotLight(nullptr, nullptr, 100);
183 ASSERT_EQ(100, light_buffer_->data.value); 184 ASSERT_EQ(100, light_buffer_->data.value);
184 185
185 sensorManager.StopFetchingDeviceLightData(); 186 sensorManager.StopFetchingDeviceLightData();
186 ASSERT_EQ(-1, light_buffer_->data.value); 187 ASSERT_EQ(-1, light_buffer_->data.value);
187 } 188 }
188 189
189 } // namespace 190 } // namespace
190 191
191 } // namespace content 192 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698