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

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

Issue 1737443002: Make DeviceOrientationEvent.prototype.absolute non-nullable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address feedback Created 4 years, 9 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 "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chromeos/accelerometer/accelerometer_types.h" 9 #include "chromeos/accelerometer/accelerometer_types.h"
10 #include "content/common/device_sensors/device_motion_hardware_buffer.h" 10 #include "content/common/device_sensors/device_motion_hardware_buffer.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 EXPECT_TRUE(buffer->data.allAvailableSensorsAreActive); 109 EXPECT_TRUE(buffer->data.allAvailableSensorsAreActive);
110 110
111 sensor_manager()->StopFetchingDeviceMotionData(); 111 sensor_manager()->StopFetchingDeviceMotionData();
112 EXPECT_FALSE(buffer->data.allAvailableSensorsAreActive); 112 EXPECT_FALSE(buffer->data.allAvailableSensorsAreActive);
113 } 113 }
114 114
115 // Tests that starting to process orientation data will update the associated 115 // Tests that starting to process orientation data will update the associated
116 // buffer. 116 // buffer.
117 TEST_F(SensorManagerChromeOSTest, OrientationBuffer) { 117 TEST_F(SensorManagerChromeOSTest, OrientationBuffer) {
118 DeviceOrientationHardwareBuffer* buffer = orientation_buffer(); 118 DeviceOrientationHardwareBuffer* buffer = orientation_buffer();
119 EXPECT_TRUE(buffer->data.hasAbsolute);
120 EXPECT_FALSE(buffer->data.hasAlpha); 119 EXPECT_FALSE(buffer->data.hasAlpha);
121 EXPECT_FALSE(buffer->data.hasBeta); 120 EXPECT_FALSE(buffer->data.hasBeta);
122 EXPECT_FALSE(buffer->data.hasGamma); 121 EXPECT_FALSE(buffer->data.hasGamma);
123 EXPECT_FALSE(buffer->data.allAvailableSensorsAreActive); 122 EXPECT_FALSE(buffer->data.allAvailableSensorsAreActive);
124 123
125 OnAccelerationIncludingGravity(0.0f, 0.0f, 1.0f); 124 OnAccelerationIncludingGravity(0.0f, 0.0f, 1.0f);
126 EXPECT_FLOAT_EQ(0.0f, buffer->data.alpha); 125 EXPECT_FLOAT_EQ(0.0f, buffer->data.alpha);
127 EXPECT_FALSE(buffer->data.hasAlpha); 126 EXPECT_FALSE(buffer->data.hasAlpha);
128 EXPECT_TRUE(buffer->data.hasBeta); 127 EXPECT_TRUE(buffer->data.hasBeta);
129 EXPECT_TRUE(buffer->data.hasGamma); 128 EXPECT_TRUE(buffer->data.hasGamma);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 EXPECT_FLOAT_EQ(0.0f, motion->data.accelerationIncludingGravityY); 219 EXPECT_FLOAT_EQ(0.0f, motion->data.accelerationIncludingGravityY);
221 EXPECT_FLOAT_EQ(-kMeanGravity / 2.0f, 220 EXPECT_FLOAT_EQ(-kMeanGravity / 2.0f,
222 motion->data.accelerationIncludingGravityZ); 221 motion->data.accelerationIncludingGravityZ);
223 222
224 DeviceOrientationHardwareBuffer* orientation = orientation_buffer(); 223 DeviceOrientationHardwareBuffer* orientation = orientation_buffer();
225 EXPECT_FLOAT_EQ(0.0f, orientation->data.beta); 224 EXPECT_FLOAT_EQ(0.0f, orientation->data.beta);
226 EXPECT_FLOAT_EQ(45.0f, orientation->data.gamma); 225 EXPECT_FLOAT_EQ(45.0f, orientation->data.gamma);
227 } 226 }
228 227
229 } // namespace content 228 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698