sensors: Stop using "reading" events to check if a sensor is suspended. #25534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tests using generic-sensor-iframe-tests.sub.js have been flaky on the
Mac bots for a long time. The flakiness is usually seen in the
same-origin iframe focus traversal test, where the "is_sensor_suspended"
command returns true rather than false.
The cause is the same one as r805674 ("sensors: Rewrite the frequency
hint test"): the mock platform sensor uses window.setInterval() to
simulate the periodic reading of sensor data, but setInterval()'s actual
frequency can vary a lot (especially on the Mac bots), to the point that
we cannot rely on the other timer we created in
iframe_sensor_handler.html will consistently have a period longer than
setInterval()'s.
The only way to reliably check if a sensor is suspended or not is to
query the mock platform sensor directly at the expense of no longer
using only the public API: we now have a isReadingData() method in
MockSensor that we use to query if the sensor is fetching new readings
or not.
Bug: 1073865
Change-Id: I99941b88722fc68163cca54e44ac6fc61a6425cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2411933
Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807421}