-
Raphael Kubo da Costa authored
The two changes are independent, but it is easier to land them together. The idea behind them is to make it easier to then land some changes to sensor/ambient-light-sensor.html that will cause it to round the values made available to users of the Ambient Light Sensor API. sensor-helpers.js now has a small RingBuffer class that is used to wrap the readings passed via MockSensor.setSensorReading() so that we iterate over the array of readings (and wrap around) and every time a reading event is fired a potentially different value is emitted. This is useful for ALS because we will no longer be able to use the same value in succession and expect two reading events to be fired (only one will). In order to make it easier to implement those changes in sensor-helpers.js, runGenericSensorTests()'s signature has been simplified and all raw readings and expected values have a standardized format, an array of arrays, where each item corresponds to one reading. This also allows us to stop using Function.prototype.bind() for the reading verification function and be more explicit in telling which expected value we want in a specific reading callback. Bug: 642731, 606766 Change-Id: Ib9103b86116e99eff2f017806393489a8c1e99f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1760954 Commit-Queue: Reilly Grant <reillyg@chromium.org> Reviewed-by:
Reilly Grant <reillyg@chromium.org> Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> Cr-Commit-Position: refs/heads/master@{#689658}
a14c9c6a