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..62dd0f32a6ef4accf72ef4387d3f7d03ba1298ec 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 from frequency.'); |
+ |
+sensor_test(sensor => { |
let ambientLightSensor = new AmbientLightSensor({frequency: 60}); |
ambientLightSensor.start(); |
let testPromise = sensor.mockSensorProvider.getCreatedSensor() |