Chromium Code Reviews| 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() |