diff --git a/generic-sensor/resources/generic-sensor-helpers.js b/generic-sensor/resources/generic-sensor-helpers.js index 8302f6f6cfbc77..afc2fadec9d8da 100644 --- a/generic-sensor/resources/generic-sensor-helpers.js +++ b/generic-sensor/resources/generic-sensor-helpers.js @@ -61,8 +61,11 @@ function sensor_test(func, name, properties) { } function verifySensorReading(pattern, values, timestamp, isNull) { + // If |val| cannot be converted to a float, we return the original value. + // This can happen when a value in |pattern| is not a number. function round(val) { - return Number.parseFloat(val).toPrecision(6); + const res = Number.parseFloat(val).toPrecision(6); + return res === "NaN" ? val : res; } if (isNull) { @@ -92,6 +95,10 @@ function verifyGeoSensorReading(pattern, {latitude, longitude, altitude, accuracy, altitudeAccuracy, heading, speed], timestamp, isNull); } +function verifyProximitySensorReading(pattern, {distance, max, near, timestamp}, isNull) { + return verifySensorReading(pattern, [distance, max, near], timestamp, isNull); +} + // A "sliding window" that iterates over |data| and returns one item at a // time, advancing and wrapping around as needed. |data| must be an array of // arrays. diff --git a/proximity/ProximitySensor-iframe-access.https.html b/proximity/ProximitySensor-iframe-access.https.html index 016ae48eb9824f..0ceba805be3ae0 100644 --- a/proximity/ProximitySensor-iframe-access.https.html +++ b/proximity/ProximitySensor-iframe-access.https.html @@ -5,7 +5,7 @@ - +
diff --git a/proximity/ProximitySensor.https.html b/proximity/ProximitySensor.https.html index 03db98e7d0dc18..648071382552fd 100644 --- a/proximity/ProximitySensor.https.html +++ b/proximity/ProximitySensor.https.html @@ -5,10 +5,28 @@ + - + diff --git a/proximity/ProximitySensor_onerror-manual.https.html b/proximity/ProximitySensor_onerror-manual.https.html deleted file mode 100644 index 7e506f0482e144..00000000000000 --- a/proximity/ProximitySensor_onerror-manual.https.html +++ /dev/null @@ -1,20 +0,0 @@ - - -