Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js

Issue 2704123006: [Sensors] Clamp given sampling frequency to the minimum supported one (Closed)
Patch Set: rebased Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 e514fe0be1c09b4fe52efa257f53062611c7586c..7d3c97e46cd7e60e4251b3b8b544df0de2780c12 100644
--- a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
+++ b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
@@ -249,6 +249,7 @@ function sensor_mocks(mojo) {
this.resolve_func_ = null;
this.is_continuous_ = false;
this.max_frequency_ = 60;
+ this.min_frequency_ = 1;
this.binding_ = new bindings.Binding(sensor_provider.SensorProvider,
this);
}
@@ -288,6 +289,7 @@ function sensor_mocks(mojo) {
buffer_offset: offset,
mode: reporting_mode,
default_configuration: default_config,
+ minimum_frequency: this.min_frequency_,
maximum_frequency: this.max_frequency_});
if (this.resolve_func_ !== null) {
@@ -319,6 +321,7 @@ function sensor_mocks(mojo) {
this.get_sensor_should_fail_ = false;
this.resolve_func_ = null;
this.max_frequency_ = 60;
+ this.min_frequency_ = 1;
this.is_continuous_ = false;
this.binding_.close();
}
@@ -349,6 +352,11 @@ function sensor_mocks(mojo) {
setMaximumSupportedFrequency(frequency) {
this.max_frequency_ = frequency;
}
+
+ // Sets the minimum frequency for a concrete sensor.
+ setMinimumSupportedFrequency(frequency) {
+ this.min_frequency_ = frequency;
+ }
}
let mockSensorProvider = new MockSensorProvider;

Powered by Google App Engine
This is Rietveld 408576698