summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html')
-rw-r--r--testing/web-platform/tests/geolocation-sensor/GeolocationSensor_read.https.html39
1 files changed, 39 insertions, 0 deletions
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>