sensors: Rewrite the frequency hint test.
This test has been flaky on the Mac bots for a very long time. Previous efforts such as r770328 ('sensors: Make frequency hint test wait for another slow sensor "tick"') did improve things a bit, but the flakiness has not been fully fixed. The problem is that our mock platform sensor dispatches sensor reading notifications via window.setInterval(), and the actual period of the callback can vary significantly, to the point where we cannot make any assumptions about how precise it will be. The Mac bots in particular seem to have big deviations in the timer's precision. Consequently, we also cannot assume a faster sensor will really receive more "reading" events than a slower one, or how long it will take for it to happen. Make the test deterministic at the expense of testing a less "real" use case: instead of comparing how many times each sensor receives a "reading" event, we just check that MockSensor.getSamplingFrequency() is adjusted accordingly depending on which sensors are active. Bug: 731018 Change-Id: Idc994d7e7d1cfb30d7c4e2f4b285494faff7160c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401139 Commit-Queue: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> Reviewed-by:Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#805674}
Loading
Please register or sign in to comment