From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/installedapp/META.yml | 1 + .../tests/installedapp/idlharness.https.window.js | 18 +++++++++++++ .../installedapp/installedapp.https.window.js | 30 ++++++++++++++++++++++ .../tests/installedapp/resources/iframe.html | 2 ++ 4 files changed, 51 insertions(+) create mode 100644 testing/web-platform/tests/installedapp/META.yml create mode 100644 testing/web-platform/tests/installedapp/idlharness.https.window.js create mode 100644 testing/web-platform/tests/installedapp/installedapp.https.window.js create mode 100644 testing/web-platform/tests/installedapp/resources/iframe.html (limited to 'testing/web-platform/tests/installedapp') 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 @@ + + \ No newline at end of file -- cgit v1.2.3