From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../orientation-member-landscape-manual.html | 25 ++++++++++ .../orientation-member-portrait-manual.html | 25 ++++++++++ .../orientation-member-service-worker.js | 53 +++++++++++++++++++++ .../orientation-member/resources/icon.png | Bin 0 -> 9871 bytes .../orientation-member-landscape.webmanifest | 12 +++++ ...rientation-member-landscape.webmanifest.headers | 1 + .../resources/orientation-member-manual.js | 4 ++ .../orientation-member-portrait.webmanifest | 12 +++++ ...orientation-member-portrait.webmanifest.headers | 1 + 9 files changed, 133 insertions(+) create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/orientation-member-landscape-manual.html create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/orientation-member-portrait-manual.html create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/orientation-member-service-worker.js create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/icon.png create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest.headers create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-manual.js create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest create mode 100644 testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest.headers (limited to 'testing/web-platform/tests/appmanifest/orientation-member') diff --git a/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-landscape-manual.html b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-landscape-manual.html new file mode 100644 index 0000000000..8df1117964 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-landscape-manual.html @@ -0,0 +1,25 @@ + +Test that orientation member with landscape value is supported + + + + +

Testing support for orientation member with "landscape" value

+ +

+ Please set the phone orientation to portrait. +

+

+ To pass, after installing the display orientation must be landscape and the background must be green. +

diff --git a/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-portrait-manual.html b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-portrait-manual.html new file mode 100644 index 0000000000..ed866f3561 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-portrait-manual.html @@ -0,0 +1,25 @@ + +Test that orientation member with portrait value is supported + + + + +

Testing support for orientation member with "portrait" value

+ +

+ Please set the phone orientation to landscape. +

+

+ To pass, after installing the display orientation must be portrait and the background must be green. +

diff --git a/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-service-worker.js b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-service-worker.js new file mode 100644 index 0000000000..26f53c9816 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/orientation-member-service-worker.js @@ -0,0 +1,53 @@ +// Some user agents only offer app installation if there is a SW and it handles +// offline requests. + +const cacheVersion = "1.2"; +const CACHE_NAME = `cache-v${cacheVersion}`; + +// The resources cached by this service worker. +const resources = [ + "orientation-member-landscape-manual.html", + "orientation-member-portrait-manual.html", + "orientation-member-service-worker.js", + "resources/orientation-member-manual.js", + "resources/icon.png", +]; + +// Load all resources for this service worker. +const precache = async () => { + const cache = await caches.open(CACHE_NAME); + await cache.addAll(resources); +}; + +// Get a resource from the cache. +const fromCache = async request => { + const cache = await caches.open(CACHE_NAME); + return await cache.match(request.url); +}; + +// Attempt to get resources from the network first, fallback to the cache if we're +// offline. +const networkFallbackToCache = async request => { + try { + const response = await fetch(request); + if (response.ok) return response; + } catch (err) {} + return await fromCache(request); +}; + +// When we have a new service worker, update the caches and swap immediately. +self.addEventListener("install", e => { + e.waitUntil(precache().then(() => self.skipWaiting())); +}); + +// Claim existing clients. +self.addEventListener("activate", e => { + e.waitUntil(self.clients.claim()); +}); + +// When a resource need to be fetched, check whether it is +// contained in the cache and return the cached version, otherwise +// get it from the network. +self.addEventListener("fetch", e => { + e.respondWith(networkFallbackToCache(e.request)); +}); diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/icon.png b/testing/web-platform/tests/appmanifest/orientation-member/resources/icon.png new file mode 100644 index 0000000000..fecb1d2da4 Binary files /dev/null and b/testing/web-platform/tests/appmanifest/orientation-member/resources/icon.png differ diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest new file mode 100644 index 0000000000..c930d292e5 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Orientation member with landscape value WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../orientation-member-landscape-manual.html", + "display": "standalone", + "orientation": "landscape" +} diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest.headers b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-landscape.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-manual.js b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-manual.js new file mode 100644 index 0000000000..6929c997a4 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-manual.js @@ -0,0 +1,4 @@ +if ('serviceWorker' in navigator) { + navigator.serviceWorker.register( + 'orientation-member-service-worker.js'); +} diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest new file mode 100644 index 0000000000..7ddf0851ac --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Orientation member with portrait value WPT", + "icons": [ + { + "src": "icon.png", + "sizes": "192x192" + } + ], + "start_url": "../orientation-member-portrait-manual.html", + "display": "standalone", + "orientation": "portrait" +} diff --git a/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest.headers b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest.headers new file mode 100644 index 0000000000..2bab061d43 --- /dev/null +++ b/testing/web-platform/tests/appmanifest/orientation-member/resources/orientation-member-portrait.webmanifest.headers @@ -0,0 +1 @@ +Content-Type: application/manifest+json; charset=utf-8 -- cgit v1.2.3