diff options
Diffstat (limited to '')
15 files changed, 207 insertions, 0 deletions
diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html new file mode 100644 index 0000000000..8fb9ea81b5 --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<body> +<title>GeolocationSensor Feature Policy Test: Disabled</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/feature-policy/resources/featurepolicy.js"></script> +<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script> +<script> +"use strict"; + +run_fp_tests_disabled('GeolocationSensor'); + +promise_test(async t => { + await promise_rejects_dom(t, 'SecurityError', GeolocationSensor.read()); +}, "GeolocationSensor.read(): 'SecurityError' is thrown when disabled by Feature Policy"); + +promise_test(async t => { + const controller = new AbortController(); + const signal = controller.signal; + controller.abort(); + + await promise_rejects_dom(t, 'AbortError', GeolocationSensor.read({ signal })); +}, "GeolocationSensor.read(): 'AbortError' takes priority"); +</script> +</body> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html.headers b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html.headers new file mode 100644 index 0000000000..7e75481ea6 --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-disabled-by-feature-policy.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: geolocation 'none' diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy-attribute-redirect-on-load.https.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy-attribute-redirect-on-load.https.html new file mode 100644 index 0000000000..2bc55d6d60 --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy-attribute-redirect-on-load.https.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<body> +<title>GeolocationSensor Feature Policy Test: Enabled by attribute redirect on load</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/feature-policy/resources/featurepolicy.js"></script> +<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script> +<script> +"use strict"; + +run_fp_tests_enabled_by_attribute_redirect_on_load('GeolocationSensor'); +</script> +</body> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy-attribute.https.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy-attribute.https.html new file mode 100644 index 0000000000..81c8c7b57f --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy-attribute.https.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<body> +<title>GeolocationSensor Feature Policy Test: Enabled by attribute</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/feature-policy/resources/featurepolicy.js"></script> +<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script> +<script> +"use strict"; + +run_fp_tests_enabled_by_attribute('GeolocationSensor'); +</script> +</body> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy.https.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy.https.html new file mode 100644 index 0000000000..d641a03d5e --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy.https.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<body> +<title>GeolocationSensor Feature Policy Test: Enabled</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/feature-policy/resources/featurepolicy.js"></script> +<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script> +<script> +"use strict"; + +run_fp_tests_enabled('GeolocationSensor'); +</script> +</body> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy.https.html.headers b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy.https.html.headers new file mode 100644 index 0000000000..40e9bc16ff --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-by-feature-policy.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: geolocation * diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-on-self-origin-by-feature-policy.https.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-on-self-origin-by-feature-policy.https.html new file mode 100644 index 0000000000..f253596eca --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-on-self-origin-by-feature-policy.https.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<body> +<title>GeolocationSensor Feature Policy Test: Enabled on self origin</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/feature-policy/resources/featurepolicy.js"></script> +<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script> +<script> +"use strict"; + +run_fp_tests_enabled_on_self_origin('GeolocationSensor'); +</script> +</body> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-on-self-origin-by-feature-policy.https.html.headers b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-on-self-origin-by-feature-policy.https.html.headers new file mode 100644 index 0000000000..b83264eee7 --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-enabled-on-self-origin-by-feature-policy.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: geolocation 'self' diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-iframe-access.https.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-iframe-access.https.html new file mode 100644 index 0000000000..bb0541de32 --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-iframe-access.https.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>GeolocationSensor iframe test</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="https://wicg.github.io/geolocation-sensor/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/generic-sensor/resources/generic-sensor-helpers.js"></script> +<script src="/generic-sensor/generic-sensor-iframe-tests.sub.js"></script> +<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script> +<div id="log"></div> +<script> +run_generic_sensor_iframe_tests('GeolocationSensor'); +</script> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-supported-by-feature-policy.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-supported-by-feature-policy.html new file mode 100644 index 0000000000..aa05f33a5e --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor-supported-by-feature-policy.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<title>Test that geolocation is advertised in the feature list</title> +<link rel="help" href="https://w3c.github.io/webappsec-feature-policy/#dom-featurepolicy-features"> +<link rel="help" href="https://w3c.github.io/sensors/#feature-policy-api"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +test(() => { + assert_in_array('geolocation', document.featurePolicy.features()); +}, 'document.featurePolicy.features should advertise geolocation.'); +</script> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor.https.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor.https.html new file mode 100644 index 0000000000..b71f964b12 --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor.https.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>GeolocationSensor Test</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="https://wicg.github.io/geolocation-sensor/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/generic-sensor/resources/generic-sensor-helpers.js"></script> +<script src="/generic-sensor/generic-sensor-tests.js"></script> +<script> + +'use strict'; + +const kReadings = { + readings: [ + [1.12345, 2.12345, 3.12345, 0.95, 0.96, 4.12345, 5.123] + ], + expectedReadings: [ + [1.12345, 2.12345, 3.12345, 0.95, 0.96, 4.12345, 5.123] + ] +}; + +runGenericSensorTests( + 'GeolocationSensor', + kReadings, + verifyXyzSensorReading, + ['geolocation']); + +</script> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_insecure_context.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_insecure_context.html new file mode 100644 index 0000000000..6a3a126c78 --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_insecure_context.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>GeolocationSensor Test: insecure context</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="https://wicg.github.io/geolocation-sensor/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/generic-sensor/generic-sensor-tests.js"></script> +<script> + +runGenericSensorInsecureContext("GeolocationSensor"); + +</script> diff --git a/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html new file mode 100644 index 0000000000..96352f641a --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>GeolocationSensor.read() Test</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="https://wicg.github.io/geolocation-sensor/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +const properties = [ + 'timestamp', + 'latitude', + 'longitude', + 'altitude', + 'accuracy', + 'altitudeAccuracy', + 'heading', + 'speed' +]; + +promise_test(async t => { + const geo = await GeolocationSensor.read({ signal: null }); + assert_not_equals(geo.timestamp, null); + properties.forEach(property => assert_own_property(geo, property)); +}, "Test that read() method resolves with valid reading when signal is null"); + +promise_test(async t => { + const geo = await GeolocationSensor.read(); + assert_not_equals(geo.timestamp, null); + properties.forEach(property => assert_own_property(geo, property)); +}, "Test that read() method resolves with valid reading"); + +promise_test(async t => { + const controller = new AbortController(); + const signal = controller.signal; + controller.abort(); + + await promise_rejects_dom(t, 'AbortError', GeolocationSensor.read({ signal })); +}, "Test that read() method rejects 'AbortError' if signal's aborted flag is set"); +</script> diff --git a/testing/web-platform/tests/geolocation-sensor/META.yml b/testing/web-platform/tests/geolocation-sensor/META.yml new file mode 100644 index 0000000000..939d6d0760 --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/META.yml @@ -0,0 +1,5 @@ +spec: https://w3c.github.io/geolocation-sensor/ +suggested_reviewers: + - anssiko + - Honry + - rakuco diff --git a/testing/web-platform/tests/geolocation-sensor/idlharness.https.window.js b/testing/web-platform/tests/geolocation-sensor/idlharness.https.window.js new file mode 100644 index 0000000000..d843dc67dd --- /dev/null +++ b/testing/web-platform/tests/geolocation-sensor/idlharness.https.window.js @@ -0,0 +1,16 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://wicg.github.io/geolocation-sensor/ + +'use strict'; + +idl_test( + ['geolocation-sensor'], + ['generic-sensor', 'dom'], + idl_array => { + idl_array.add_objects({ + GeolocationSensor: ['new GeolocationSensor'], + }); + } +); |