| Index: third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js
|
| diff --git a/third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js b/third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js
|
| index ee5f312333cceab119156d79549531e72f380954..fc1fc8ed316a9d98204c4853717e2f68f9ba8f2a 100644
|
| --- a/third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js
|
| +++ b/third_party/WebKit/LayoutTests/sensor/resources/generic-sensor-tests.js
|
| @@ -291,6 +291,7 @@ function runGenericSensorTests(sensorType, updateReading, verifyReading) {
|
| return new Promise((resolve, reject) => {
|
| let fastSensorNotifiedCounter = 0;
|
| let slowSensorNotifiedCounter = 0;
|
| + let readingUpdatesCounter = 0;
|
|
|
| let fastSensorWrapper = new CallbackWrapper(() => {
|
| fastSensorNotifiedCounter++;
|
| @@ -300,11 +301,16 @@ function runGenericSensorTests(sensorType, updateReading, verifyReading) {
|
| slowSensorNotifiedCounter++;
|
| if (slowSensorNotifiedCounter == 1) {
|
| fastSensor.start();
|
| + readingUpdatesCounter = mockSensor.reading_updates_count();
|
| } else if (slowSensorNotifiedCounter == 2) {
|
| // By the moment slow sensor (9 Hz) is notified for the
|
| // next time, the fast sensor (30 Hz) has been notified
|
| // for int(30/9) = 3 times.
|
| - assert_equals(fastSensorNotifiedCounter, 3);
|
| + // In actual implementation updates are bound to rAF,
|
| + // (not to a timer) so fluctuations are possible, so we
|
| + // reference to the actual elapsed updates count.
|
| + let elapsedUpdates = mockSensor.reading_updates_count() - readingUpdatesCounter;
|
| + assert_equals(fastSensorNotifiedCounter, elapsedUpdates);
|
| fastSensor.stop();
|
| slowSensor.stop();
|
| resolve(mockSensor);
|
|
|