summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/proximity
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/proximity
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/proximity')
-rw-r--r--testing/web-platform/tests/proximity/META.yml4
-rw-r--r--testing/web-platform/tests/proximity/ProximitySensor-iframe-access.https.html14
-rw-r--r--testing/web-platform/tests/proximity/ProximitySensor.https.html32
-rw-r--r--testing/web-platform/tests/proximity/ProximitySensor_insecure_context.html20
-rw-r--r--testing/web-platform/tests/proximity/idlharness.https.window.js16
5 files changed, 86 insertions, 0 deletions
diff --git a/testing/web-platform/tests/proximity/META.yml b/testing/web-platform/tests/proximity/META.yml
new file mode 100644
index 0000000000..8745078130
--- /dev/null
+++ b/testing/web-platform/tests/proximity/META.yml
@@ -0,0 +1,4 @@
+spec: https://w3c.github.io/proximity/
+suggested_reviewers:
+ - Honry
+ - rakuco
diff --git a/testing/web-platform/tests/proximity/ProximitySensor-iframe-access.https.html b/testing/web-platform/tests/proximity/ProximitySensor-iframe-access.https.html
new file mode 100644
index 0000000000..0ceba805be
--- /dev/null
+++ b/testing/web-platform/tests/proximity/ProximitySensor-iframe-access.https.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>ProximitySensor iframe test</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://w3c.github.io/proximity/">
+<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('ProximitySensor');
+</script>
diff --git a/testing/web-platform/tests/proximity/ProximitySensor.https.html b/testing/web-platform/tests/proximity/ProximitySensor.https.html
new file mode 100644
index 0000000000..6480713825
--- /dev/null
+++ b/testing/web-platform/tests/proximity/ProximitySensor.https.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>ProximitySensor Test</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://w3c.github.io/proximity/">
+<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';
+
+// near: 0 stands for false, 1 stands for true, which will be convert to boolean
+// in mock sensor
+const kReadings = {
+ readings: [
+ [1.12345, 2.12345, 1]
+ ],
+ expectedReadings: [
+ [1.12345, 2.12345, true]
+ ]
+};
+
+runGenericSensorTests(
+ 'ProximitySensor',
+ kReadings,
+ verifyProximitySensorReading,
+ ['proximity']);
+
+</script>
diff --git a/testing/web-platform/tests/proximity/ProximitySensor_insecure_context.html b/testing/web-platform/tests/proximity/ProximitySensor_insecure_context.html
new file mode 100644
index 0000000000..b524cdc321
--- /dev/null
+++ b/testing/web-platform/tests/proximity/ProximitySensor_insecure_context.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>ProximitySensor Test: insecure context</title>
+<link rel="author" title="Intel" href="http://www.intel.com">
+<link rel="help" href="https://w3c.github.io/proximity/">
+<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("ProximitySensor");
+
+</script>
diff --git a/testing/web-platform/tests/proximity/idlharness.https.window.js b/testing/web-platform/tests/proximity/idlharness.https.window.js
new file mode 100644
index 0000000000..bf27f278ce
--- /dev/null
+++ b/testing/web-platform/tests/proximity/idlharness.https.window.js
@@ -0,0 +1,16 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+
+// https://w3c.github.io/proximity/
+
+'use strict';
+
+idl_test(
+ ['proximity'],
+ ['generic-sensor','dom'],
+ idl_array => {
+ idl_array.add_objects({
+ ProximitySensor: ['new ProximitySensor();']
+ });
+ }
+);