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

Side by Side Diff: device/sensors/sensor_manager_android_unittest.cc

Issue 2646093002: Move //content/browser/device_sensor/ into device/sensors (Closed)
Patch Set: update git log Created 3 years, 11 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 "device/sensors/sensor_manager_android.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "content/browser/device_sensors/device_sensors_consts.h" 12 #include "device/sensors/device_sensors_consts.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace content { 15 namespace device {
16 16
17 namespace { 17 namespace {
18 18
19 class FakeSensorManagerAndroid : public SensorManagerAndroid { 19 class FakeSensorManagerAndroid : public SensorManagerAndroid {
20 public: 20 public:
21 FakeSensorManagerAndroid() {} 21 FakeSensorManagerAndroid() {}
22 ~FakeSensorManagerAndroid() override {} 22 ~FakeSensorManagerAndroid() override {}
23 23
24 OrientationSensorType GetOrientationSensorTypeUsed() override { 24 OrientationSensorType GetOrientationSensorTypeUsed() override {
25 return SensorManagerAndroid::ROTATION_VECTOR; 25 return SensorManagerAndroid::ROTATION_VECTOR;
(...skipping 19 matching lines...) Expand all
45 protected: 45 protected:
46 AndroidSensorManagerTest() { 46 AndroidSensorManagerTest() {
47 light_buffer_.reset(new DeviceLightHardwareBuffer); 47 light_buffer_.reset(new DeviceLightHardwareBuffer);
48 motion_buffer_.reset(new DeviceMotionHardwareBuffer); 48 motion_buffer_.reset(new DeviceMotionHardwareBuffer);
49 orientation_buffer_.reset(new DeviceOrientationHardwareBuffer); 49 orientation_buffer_.reset(new DeviceOrientationHardwareBuffer);
50 orientation_absolute_buffer_.reset(new DeviceOrientationHardwareBuffer); 50 orientation_absolute_buffer_.reset(new DeviceOrientationHardwareBuffer);
51 } 51 }
52 52
53 void VerifyOrientationBufferValues( 53 void VerifyOrientationBufferValues(
54 const DeviceOrientationHardwareBuffer* buffer, 54 const DeviceOrientationHardwareBuffer* buffer,
55 double alpha, double beta, double gamma) { 55 double alpha,
56 double beta,
57 double gamma) {
56 ASSERT_TRUE(buffer->data.allAvailableSensorsAreActive); 58 ASSERT_TRUE(buffer->data.allAvailableSensorsAreActive);
57 ASSERT_EQ(alpha, buffer->data.alpha); 59 ASSERT_EQ(alpha, buffer->data.alpha);
58 ASSERT_TRUE(buffer->data.hasAlpha); 60 ASSERT_TRUE(buffer->data.hasAlpha);
59 ASSERT_EQ(beta, buffer->data.beta); 61 ASSERT_EQ(beta, buffer->data.beta);
60 ASSERT_TRUE(buffer->data.hasBeta); 62 ASSERT_TRUE(buffer->data.hasBeta);
61 ASSERT_EQ(gamma, buffer->data.gamma); 63 ASSERT_EQ(gamma, buffer->data.gamma);
62 ASSERT_TRUE(buffer->data.hasGamma); 64 ASSERT_TRUE(buffer->data.hasGamma);
63 } 65 }
64 66
65 std::unique_ptr<DeviceLightHardwareBuffer> light_buffer_; 67 std::unique_ptr<DeviceLightHardwareBuffer> light_buffer_;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 184
183 sensorManager.GotLight(nullptr, nullptr, 100); 185 sensorManager.GotLight(nullptr, nullptr, 100);
184 ASSERT_EQ(100, light_buffer_->data.value); 186 ASSERT_EQ(100, light_buffer_->data.value);
185 187
186 sensorManager.StopFetchingDeviceLightData(); 188 sensorManager.StopFetchingDeviceLightData();
187 ASSERT_EQ(-1, light_buffer_->data.value); 189 ASSERT_EQ(-1, light_buffer_->data.value);
188 } 190 }
189 191
190 } // namespace 192 } // namespace
191 193
192 } // namespace content 194 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698