Index: third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js |
diff --git a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js |
index 03f32d9418ec51e827ddf52841cb44a74f8de4da..1225458173fdaddd59fc9c06a0af4ea64684937d 100644 |
--- a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js |
+++ b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js |
@@ -39,6 +39,7 @@ function sensor_mocks(mojo) { |
this.reporting_mode_ = reportingMode; |
this.sensor_reading_timer_id_ = null; |
this.update_reading_function_ = null; |
+ this.reading_updates_count_ = 0; |
this.suspend_called_ = null; |
this.resume_called_ = null; |
this.add_configuration_called_ = null; |
@@ -62,6 +63,9 @@ function sensor_mocks(mojo) { |
return Promise.resolve({frequency: 5}); |
} |
+ reading_updates_count() { |
+ return this.reading_updates_count_; |
+ } |
// Adds configuration for the sensor and starts reporting fake data |
// through update_reading_function_ callback. |
addConfiguration(configuration) { |
@@ -197,9 +201,12 @@ function sensor_mocks(mojo) { |
this.active_sensor_configurations_[0].frequency; |
let timeout = (1 / max_frequency_used) * 1000; |
this.sensor_reading_timer_id_ = window.setInterval(() => { |
shalamov
2016/12/21 10:41:03
Should we clear previous interval if addConfigurat
Mikhail
2016/12/21 13:06:28
Right, thanks for the catch!
|
- if (this.update_reading_function_) |
+ if (this.update_reading_function_) { |
this.update_reading_function_(this.buffer_, |
- this.expects_modified_reading_); |
+ this.expects_modified_reading_, |
+ this.reading_updates_count_); |
+ this.reading_updates_count_++; |
+ } |
if (this.reporting_mode_ === sensor.ReportingMode.ON_CHANGE) { |
this.client_.sensorReadingChanged(); |
} |