Bug 1452180 [wpt PR 10023] - Add tests for throwing 'NotSupportedError' if an unsupported sensor option is passed to the constructor., a=testonly
authorkaixinjxq <xiuqix.jiang@intel.com>
Mon, 09 Apr 2018 16:45:34 +0000
changeset 413507 b54fd13d3ac4eaadd44ad12b346084654cf86158
parent 413506 4743879be1c1712f976bf8a4007bd28d3a0f0353
child 413508 aacd2f782b2b40c0f7f11b69d29ba72fb9a55ba7
push id33850
push userapavel@mozilla.com
push dateMon, 16 Apr 2018 09:53:48 +0000
treeherdermozilla-central@6276ec7ebbf3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1452180, 10023
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1452180 [wpt PR 10023] - Add tests for throwing 'NotSupportedError' if an unsupported sensor option is passed to the constructor., a=testonly Automatic update from web-platform-testsAdd sensor tests to throw NotSupportedError for an unsupported option (#10023) reflect to w3c/sensors#356 wpt-commits: 07b4a27c84b5d98f2886779a9b7cb9dc334a193b wpt-pr: 10023 wpt-commits: 07b4a27c84b5d98f2886779a9b7cb9dc334a193b wpt-pr: 10023
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/sensors/generic-sensor-tests.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -590940,17 +590940,17 @@
    "99bcfb42c91e084a3b847ab4bab2bad80e548540",
    "testharness"
   ],
   "sensors/generic-sensor-feature-policy-test.sub.js": [
    "c7c9c4d1c578f267cbb4241d7ea7a981be6f49ee",
    "support"
   ],
   "sensors/generic-sensor-tests.js": [
-   "383a4f839c4a74b5b4d2a6cff9c83a61bc5aee04",
+   "983fcde578270e32e6ba3ab4b6420b53ae3bbbc2",
    "support"
   ],
   "sensors/idlharness.https.html": [
    "02c734b907075c8abb7504fc7e2b93730ac80a0c",
    "testharness"
   ],
   "server-timing/cross_origin.html": [
    "74333db517babacbb84bb20c91ccfc8b2627b934",
--- a/testing/web-platform/tests/sensors/generic-sensor-tests.js
+++ b/testing/web-platform/tests/sensors/generic-sensor-tests.js
@@ -246,16 +246,24 @@ function runGenericSensorTests(sensorTyp
     await sensorWatcher.wait_for("reading");
     const cachedSensor3 = reading_to_array(sensor);
     assert_greater_than(sensor.timestamp, cachedTimestamp);
 
     sensor.stop();
   }, `${sensorType.name}: sensor receives suspend / resume notifications when\
   cross-origin subframe is focused`);
 
+  test(() => {
+     assert_throws("NotSupportedError", () => { new sensorType({invalid: 1}) });
+     assert_throws("NotSupportedError", () => { new sensorType({frequency: 60, invalid: 1}) });
+     if (spatialSensors.indexOf(sensorType.name) == -1) {
+       assert_throws("NotSupportedError", () => { new sensorType({referenceFrame: "screen"}) });
+     }
+  }, `${sensorType.name}: throw 'NotSupportedError' for an unsupported sensor option`);
+
   if (spatialSensors.indexOf(sensorType.name) == -1) {
     // The sensorType does not represent a spatial sensor.
     return;
   }
 
   promise_test(async t => {
     const sensor = new sensorType({referenceFrame: "screen"});
     const sensorWatcher = new EventWatcher(t, sensor, ["reading", "error"]);