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

Unified Diff: content/browser/device_sensors/sensor_manager_android_unittest.cc

Issue 292693004: [DeviceLight] Browser+java part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/device_sensors/sensor_manager_android_unittest.cc
diff --git a/content/browser/device_sensors/sensor_manager_android_unittest.cc b/content/browser/device_sensors/sensor_manager_android_unittest.cc
index 8299164c910d594d583c439420037bac1601c78e..560f3142bae72aa4e7a4d12dcd3d44a2ee46e5bb 100644
--- a/content/browser/device_sensors/sensor_manager_android_unittest.cc
+++ b/content/browser/device_sensors/sensor_manager_android_unittest.cc
@@ -42,10 +42,12 @@ class FakeSensorManagerAndroid : public SensorManagerAndroid {
class AndroidSensorManagerTest : public testing::Test {
protected:
AndroidSensorManagerTest() {
+ light_buffer_.reset(new DeviceLightHardwareBuffer);
motion_buffer_.reset(new DeviceMotionHardwareBuffer);
orientation_buffer_.reset(new DeviceOrientationHardwareBuffer);
}
+ scoped_ptr<DeviceLightHardwareBuffer> light_buffer_;
scoped_ptr<DeviceMotionHardwareBuffer> motion_buffer_;
scoped_ptr<DeviceOrientationHardwareBuffer> orientation_buffer_;
};
@@ -142,6 +144,19 @@ TEST_F(AndroidSensorManagerTest, DeviceOrientationSensorsActive) {
ASSERT_FALSE(orientation_buffer_->data.allAvailableSensorsAreActive);
}
+// DeviceLight
+TEST_F(AndroidSensorManagerTest, DeviceLightSensorsActive) {
+ FakeSensorManagerAndroid::Register(base::android::AttachCurrentThread());
+ FakeSensorManagerAndroid sensorManager;
+
+ sensorManager.StartFetchingDeviceLightData(light_buffer_.get());
+
+ sensorManager.GotLight(0, 0, 100);
+ ASSERT_EQ(100, light_buffer_->data.value);
+
+ sensorManager.StopFetchingDeviceLightData();
+ ASSERT_EQ(-1, light_buffer_->data.value);
+}
} // namespace
« no previous file with comments | « content/browser/device_sensors/sensor_manager_android.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698