diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/magnetometer | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/magnetometer')
14 files changed, 182 insertions, 0 deletions
diff --git a/testing/web-platform/tests/magnetometer/META.yml b/testing/web-platform/tests/magnetometer/META.yml new file mode 100644 index 0000000000..9193c0d459 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/META.yml @@ -0,0 +1,5 @@ +spec: https://w3c.github.io/magnetometer/ +suggested_reviewers: + - riju + - Honry + - rakuco diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-disabled-by-feature-policy.https.html b/testing/web-platform/tests/magnetometer/Magnetometer-disabled-by-feature-policy.https.html new file mode 100644 index 0000000000..6e496c1390 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-disabled-by-feature-policy.https.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<body> +<title>Magnetometer 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('Magnetometer'); +run_fp_tests_disabled('UncalibratedMagnetometer'); +</script> +</body> diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-disabled-by-feature-policy.https.html.headers b/testing/web-platform/tests/magnetometer/Magnetometer-disabled-by-feature-policy.https.html.headers new file mode 100644 index 0000000000..afbd45465c --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-disabled-by-feature-policy.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: magnetometer 'none' diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy-attribute-redirect-on-load.https.html b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy-attribute-redirect-on-load.https.html new file mode 100644 index 0000000000..4b65317818 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy-attribute-redirect-on-load.https.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<body> +<title>Magnetometer 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('Magnetometer'); +run_fp_tests_enabled_by_attribute_redirect_on_load('UncalibratedMagnetometer'); +</script> +</body> diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy-attribute.https.html b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy-attribute.https.html new file mode 100644 index 0000000000..4c120f6d74 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy-attribute.https.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<body> +<title>Magnetometer 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('Magnetometer'); +run_fp_tests_enabled_by_attribute('UncalibratedMagnetometer'); +</script> +</body> diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy.https.html b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy.https.html new file mode 100644 index 0000000000..ae5983411d --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy.https.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<body> +<title>Magnetometer 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('Magnetometer'); +run_fp_tests_enabled('UncalibratedMagnetometer'); +</script> +</body> diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy.https.html.headers b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy.https.html.headers new file mode 100644 index 0000000000..64ec55e3e4 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-by-feature-policy.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: magnetometer * diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-enabled-on-self-origin-by-feature-policy.https.html b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-on-self-origin-by-feature-policy.https.html new file mode 100644 index 0000000000..e6210407ab --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-on-self-origin-by-feature-policy.https.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<body> +<title>Magnetometer 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('Magnetometer'); +run_fp_tests_enabled_on_self_origin('UncalibratedMagnetometer'); +</script> +</body> diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-enabled-on-self-origin-by-feature-policy.https.html.headers b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-on-self-origin-by-feature-policy.https.html.headers new file mode 100644 index 0000000000..4223f53ffa --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-enabled-on-self-origin-by-feature-policy.https.html.headers @@ -0,0 +1 @@ +Feature-Policy: magnetometer 'self' diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-iframe-access.https.html b/testing/web-platform/tests/magnetometer/Magnetometer-iframe-access.https.html new file mode 100644 index 0000000000..3dc90e3dd7 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-iframe-access.https.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Magnetometer iframe test</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="https://www.w3.org/TR/magnetometer/"> +<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('Magnetometer'); +run_generic_sensor_iframe_tests('UncalibratedMagnetometer'); +</script> diff --git a/testing/web-platform/tests/magnetometer/Magnetometer-supported-by-feature-policy.html b/testing/web-platform/tests/magnetometer/Magnetometer-supported-by-feature-policy.html new file mode 100644 index 0000000000..a049363895 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer-supported-by-feature-policy.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<title>Test that magnetometer 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('magnetometer', document.featurePolicy.features()); +}, 'document.featurePolicy.features should advertise magnetometer.'); +</script> diff --git a/testing/web-platform/tests/magnetometer/Magnetometer.https.html b/testing/web-platform/tests/magnetometer/Magnetometer.https.html new file mode 100644 index 0000000000..0cc443784b --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer.https.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Magnetometer Test</title> +<meta name="timeout" content="long"> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="https://www.w3.org/TR/magnetometer/"> +<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: [ + [-19.2, 12.1, -44.3] + ], + expectedReadings: [ + [-19.2, 12.1, -44.3] + ], + expectedRemappedReadings: [ + [-12.1, -19.2, -44.3] + ] +}; + +runGenericSensorTests( + 'Magnetometer', + kReadings, + verifyXyzSensorReading, + ['magnetometer']); + +runGenericSensorTests( + 'UncalibratedMagnetometer', + kReadings, + verifyXyzSensorReading, + ['magnetometer']); + +</script> diff --git a/testing/web-platform/tests/magnetometer/Magnetometer_insecure_context.html b/testing/web-platform/tests/magnetometer/Magnetometer_insecure_context.html new file mode 100644 index 0000000000..45ff584b42 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/Magnetometer_insecure_context.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Magnetometer Test: insecure context</title> +<link rel="author" title="Intel" href="http://www.intel.com"> +<link rel="help" href="https://www.w3.org/TR/magnetometer/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/generic-sensor/generic-sensor-tests.js"></script> +<div id="log"></div> +<h2>Precondition</h2> +<ol> + <li> + Run test in an insecure context, e.g. http://example.com/. + </li> +</ol> +<script> + +runGenericSensorInsecureContext("Magnetometer"); +runGenericSensorInsecureContext("UncalibratedMagnetometer"); + +</script> diff --git a/testing/web-platform/tests/magnetometer/idlharness.https.window.js b/testing/web-platform/tests/magnetometer/idlharness.https.window.js new file mode 100644 index 0000000000..e6b8f7d238 --- /dev/null +++ b/testing/web-platform/tests/magnetometer/idlharness.https.window.js @@ -0,0 +1,17 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +// https://w3c.github.io/magnetometer/ + +'use strict'; + +idl_test( + ['magnetometer'], + ['generic-sensor', 'dom'], + idl_array => { + idl_array.add_objects({ + Magnetometer: ['new Magnetometer();'], + UncalibratedMagnetometer: ['new UncalibratedMagnetometer();'] + }); + } +); |