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

Unified Diff: third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comment from Tim Created 4 years, 1 month 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: third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
diff --git a/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html b/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
index 79956291b47f1ff336ee255148e36d32dc13fb96..3f199c3c25b2d39d75f0ef5b51bdb25a44baaa79 100644
--- a/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
+++ b/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
@@ -104,6 +104,34 @@ sensor_test(sensor => {
}, 'Test that frequency is capped to 60.0 Hz.');
sensor_test(sensor => {
+ let maxSupportedFrequency = 15;
+ sensor.mockSensorProvider.setMaximumSupportedFrequency(maxSupportedFrequency);
+ let ambientLightSensor = new AmbientLightSensor({frequency: 50});
+ ambientLightSensor.start();
+
+ let testPromise = sensor.mockSensorProvider.getCreatedSensor()
+ .then(mockSensor => { return mockSensor.addConfigurationCalled(); })
+ .then(mockSensor => {
+ return new Promise((resolve, reject) => {
+ ambientLightSensor.onstatechange = event => {
+ if (ambientLightSensor.state === 'idle') {
+ resolve(mockSensor);
+ }
+
+ if (ambientLightSensor.state === 'active') {
+ let configuration = mockSensor.active_sensor_configurations_[0];
+ assert_equals(configuration.frequency, maxSupportedFrequency);
+ ambientLightSensor.stop();
+ }
+ };
+ });
+ })
+ .then(mockSensor => { return mockSensor.removeConfigurationCalled(); });
+
+ return testPromise;
+}, 'Test that frequency is capped to the maximum supported from frequency.');
+
+sensor_test(sensor => {
let ambientLightSensor = new AmbientLightSensor({frequency: 60});
ambientLightSensor.start();
let testPromise = sensor.mockSensorProvider.getCreatedSensor()
« no previous file with comments | « device/generic_sensor/sensor_provider_impl.cc ('k') | third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698