summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/installedapp
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/installedapp
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/installedapp')
-rw-r--r--testing/web-platform/tests/installedapp/META.yml1
-rw-r--r--testing/web-platform/tests/installedapp/idlharness.https.window.js18
-rw-r--r--testing/web-platform/tests/installedapp/installedapp.https.window.js30
-rw-r--r--testing/web-platform/tests/installedapp/resources/iframe.html2
4 files changed, 51 insertions, 0 deletions
diff --git a/testing/web-platform/tests/installedapp/META.yml b/testing/web-platform/tests/installedapp/META.yml
new file mode 100644
index 0000000000..fa67e2fdfa
--- /dev/null
+++ b/testing/web-platform/tests/installedapp/META.yml
@@ -0,0 +1 @@
+spec: https://wicg.github.io/get-installed-related-apps/spec/
diff --git a/testing/web-platform/tests/installedapp/idlharness.https.window.js b/testing/web-platform/tests/installedapp/idlharness.https.window.js
new file mode 100644
index 0000000000..7774da6803
--- /dev/null
+++ b/testing/web-platform/tests/installedapp/idlharness.https.window.js
@@ -0,0 +1,18 @@
+// META: global=window
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+// META: timeout=long
+
+'use strict';
+
+// https://wicg.github.io/get-installed-related-apps/spec/
+
+idl_test(
+ ['get-installed-related-apps'],
+ ['html'],
+ idl_array => {
+ idl_array.add_objects({
+ Navigator: ['navigator'],
+ });
+ }
+)
diff --git a/testing/web-platform/tests/installedapp/installedapp.https.window.js b/testing/web-platform/tests/installedapp/installedapp.https.window.js
new file mode 100644
index 0000000000..44fa30278a
--- /dev/null
+++ b/testing/web-platform/tests/installedapp/installedapp.https.window.js
@@ -0,0 +1,30 @@
+// META: script=resources/utils.js
+
+'use strict';
+
+// https://wicg.github.io/get-installed-related-app/spec
+
+promise_test(async t => {
+
+ assert_true('getInstalledRelatedApps' in navigator);
+ assert_array_equals(await navigator.getInstalledRelatedApps(), []);
+
+}, 'Check calling getInstalledRelatedApps works as expected');
+
+promise_test(async t => {
+
+ const iframeWindow = await new Promise(resolve => {
+ const iframe = document.createElement('iframe');
+ iframe.src = 'resources/iframe.html';
+ iframe.onload = () => resolve(iframe.contentWindow);
+ document.body.appendChild(iframe);
+ });
+
+ try {
+ await iframeWindow.navigator.getInstalledRelatedApps();
+ assert_unreached('expected a DOMException, but none was thrown');
+ } catch (e) {
+ assert_equals(e.name, 'InvalidStateError');
+ }
+
+}, 'Calling getInstalledrelatedApps from an iframe fails'); \ No newline at end of file
diff --git a/testing/web-platform/tests/installedapp/resources/iframe.html b/testing/web-platform/tests/installedapp/resources/iframe.html
new file mode 100644
index 0000000000..8c7fe21114
--- /dev/null
+++ b/testing/web-platform/tests/installedapp/resources/iframe.html
@@ -0,0 +1,2 @@
+<html>
+</html> \ No newline at end of file