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

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

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: [Sensors] Consider maximum supported frequency 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 29d94cdbb2038c92ef6c8693c3776fd6805f08d0..df77c04f2f82cdedaff2ad90d6661ab18790821a 100644
--- a/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
+++ b/third_party/WebKit/LayoutTests/sensor/ambient-light-sensor.html
@@ -98,6 +98,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 frequency from the platform.');
shalamov 2016/11/03 12:54:05 nit: format
Mikhail 2016/11/03 13:28:16 Done.
+
+sensor_test(sensor => {
let ambientLightSensor = new AmbientLightSensor({frequency: 60});
ambientLightSensor.start();
let testPromise = sensor.mockSensorProvider.getCreatedSensor()

Powered by Google App Engine
This is Rietveld 408576698