summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/priority-hints
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/priority-hints
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/priority-hints')
-rw-r--r--testing/web-platform/tests/priority-hints/META.yml5
-rw-r--r--testing/web-platform/tests/priority-hints/fetch-api-request.tentative.any.js9
-rw-r--r--testing/web-platform/tests/priority-hints/iframe-attr-fetchpriority.tentative.html26
-rw-r--r--testing/web-platform/tests/priority-hints/img-attr-fetchpriority.tentative.html26
-rw-r--r--testing/web-platform/tests/priority-hints/link-attr-fetchpriority.tentative.html26
-rw-r--r--testing/web-platform/tests/priority-hints/resources/script.js0
-rw-r--r--testing/web-platform/tests/priority-hints/resources/stylesheet.css3
-rw-r--r--testing/web-platform/tests/priority-hints/script-attr-fetchpriority.tentative.html26
8 files changed, 121 insertions, 0 deletions
diff --git a/testing/web-platform/tests/priority-hints/META.yml b/testing/web-platform/tests/priority-hints/META.yml
new file mode 100644
index 0000000000..487b4013a0
--- /dev/null
+++ b/testing/web-platform/tests/priority-hints/META.yml
@@ -0,0 +1,5 @@
+spec: https://wicg.github.io/priority-hints/
+suggested_reviewers:
+ - addyosmani
+ - domfarolino
+ - yoavweiss
diff --git a/testing/web-platform/tests/priority-hints/fetch-api-request.tentative.any.js b/testing/web-platform/tests/priority-hints/fetch-api-request.tentative.any.js
new file mode 100644
index 0000000000..1b576e52da
--- /dev/null
+++ b/testing/web-platform/tests/priority-hints/fetch-api-request.tentative.any.js
@@ -0,0 +1,9 @@
+test(() => {
+ assert_throws_js(TypeError, () => {
+ new Request("", {priority: 'invalid'});
+ }, "a new Request() must throw a TypeError if RequestInit's priority is an invalid value");
+}, "new Request() throws a TypeError if any of RequestInit's members' values are invalid");
+
+promise_test(function(t) {
+ return promise_rejects_js(t, TypeError, fetch('resources/blank.html', { priority: 'invalid' }));
+}, "fetch() with an invalid priority returns a rejected promise with a TypeError"); \ No newline at end of file
diff --git a/testing/web-platform/tests/priority-hints/iframe-attr-fetchpriority.tentative.html b/testing/web-platform/tests/priority-hints/iframe-attr-fetchpriority.tentative.html
new file mode 100644
index 0000000000..386577690b
--- /dev/null
+++ b/testing/web-platform/tests/priority-hints/iframe-attr-fetchpriority.tentative.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>Priority Hints - iFrame element</title>
+<meta name="author" title="Patrick Meenan" href="mailto:patmeenan@gmail.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<iframe id=iframe1 src="/common/blank.html" fetchpriority=high></iframe>
+<iframe id=iframe2 src="/common/blank.html" fetchpriority=low></iframe>
+<iframe id=iframe3 src="/common/blank.html" fetchpriority=auto></iframe>
+<iframe id=iframe4 src="/common/blank.html" fetchpriority=xyz></iframe>
+<iframe id=iframe5 src="/common/blank.html"></iframe>
+
+<script>
+ test(() => {
+ assert_equals(iframe1.fetchPriority, "high", "high fetchPriority is a valid IDL value on the script element");
+ assert_equals(iframe2.fetchPriority, "low", "low fetchPriority is a valid IDL value on the script element");
+ assert_equals(iframe3.fetchPriority, "auto", "auto fetchPriority is a valid IDL value on the script element");
+ assert_equals(iframe4.fetchPriority, "auto", "invalid fetchPriority reflects as 'auto' IDL attribute on the script element");
+ assert_equals(iframe5.fetchPriority, "auto", "missing fetchPriority reflects as 'auto' IDL attribute on the script element");
+ }, "fetchpriority attribute on <iframe> elements should reflect valid IDL values");
+
+ test(() => {
+ const iframe = document.createElement("iframe");
+ assert_equals(iframe.fetchPriority, "auto");
+ }, "default fetchpriority attribute on <iframe> elements should be 'auto'");
+</script>
diff --git a/testing/web-platform/tests/priority-hints/img-attr-fetchpriority.tentative.html b/testing/web-platform/tests/priority-hints/img-attr-fetchpriority.tentative.html
new file mode 100644
index 0000000000..996aa4d156
--- /dev/null
+++ b/testing/web-platform/tests/priority-hints/img-attr-fetchpriority.tentative.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>Priority Hints - Image element</title>
+<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<img id=img1 src=/images/green.png fetchpriority=high>
+<img id=img2 src=/images/green.png fetchpriority=low>
+<img id=img3 src=/images/green.png fetchpriority=auto>
+<img id=img4 src=/images/green.png fetchpriority=xyz>
+<img id=img5 src=/images/green.png>
+
+<script>
+ test(() => {
+ assert_equals(img1.fetchPriority, "high", "high fetchPriority is a valid IDL value on the image element");
+ assert_equals(img2.fetchPriority, "low", "low fetchPriority is a valid IDL value on the image element");
+ assert_equals(img3.fetchPriority, "auto", "auto fetchPriority is a valid IDL value on the image element");
+ assert_equals(img4.fetchPriority, "auto", "invalid fetchPriority reflects as 'auto' IDL attribute on the image element");
+ assert_equals(img5.fetchPriority, "auto", "missing fetchPriority reflects as 'auto' IDL attribute on the image element");
+ }, "fetchpriority attribute on <img> elements should reflect valid IDL values");
+
+ test(() => {
+ const img = new Image();
+ assert_equals(img.fetchPriority, "auto");
+ }, "fetchPriority of new Image() is 'auto'");
+</script>
diff --git a/testing/web-platform/tests/priority-hints/link-attr-fetchpriority.tentative.html b/testing/web-platform/tests/priority-hints/link-attr-fetchpriority.tentative.html
new file mode 100644
index 0000000000..32c318b760
--- /dev/null
+++ b/testing/web-platform/tests/priority-hints/link-attr-fetchpriority.tentative.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>Priority Hints - Link element</title>
+<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<link id=link1 href=resources/stylesheet.css fetchpriority=high>
+<link id=link2 href=resources/stylesheet.css fetchpriority=low>
+<link id=link3 href=resources/stylesheet.css fetchpriority=auto>
+<link id=link4 href=resources/stylesheet.css fetchpriority=xyz>
+<link id=link5 href=resources/stylesheet.css>
+
+<script>
+ test(() => {
+ assert_equals(link1.fetchPriority, "high", "high fetchPriority is a valid IDL value on the link element");
+ assert_equals(link2.fetchPriority, "low", "low fetchPriority is a valid IDL value on the link element");
+ assert_equals(link3.fetchPriority, "auto", "auto fetchPriority is a valid IDL value on the link element");
+ assert_equals(link4.fetchPriority, "auto", "invalid fetchPriority reflects as 'auto' IDL attribute on the link element");
+ assert_equals(link5.fetchPriority, "auto", "missing fetchPriority reflects as 'auto' IDL attribute on the link element");
+ }, "fetchpriority attribute on <link> elements should reflect valid IDL values");
+
+ test(() => {
+ const link = document.createElement("link");
+ assert_equals(link.fetchPriority, "auto");
+ }, "default fetchpriority attribute on <link> elements should be 'auto'");
+</script>
diff --git a/testing/web-platform/tests/priority-hints/resources/script.js b/testing/web-platform/tests/priority-hints/resources/script.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testing/web-platform/tests/priority-hints/resources/script.js
diff --git a/testing/web-platform/tests/priority-hints/resources/stylesheet.css b/testing/web-platform/tests/priority-hints/resources/stylesheet.css
new file mode 100644
index 0000000000..9d9d772fb4
--- /dev/null
+++ b/testing/web-platform/tests/priority-hints/resources/stylesheet.css
@@ -0,0 +1,3 @@
+body {
+ background-color: green;
+}
diff --git a/testing/web-platform/tests/priority-hints/script-attr-fetchpriority.tentative.html b/testing/web-platform/tests/priority-hints/script-attr-fetchpriority.tentative.html
new file mode 100644
index 0000000000..8639d04d86
--- /dev/null
+++ b/testing/web-platform/tests/priority-hints/script-attr-fetchpriority.tentative.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>Priority Hints - Script element</title>
+<meta name="author" title="Patrick Meenan" href="mailto:patmeenan@gmail.com">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script id=script1 src="resources/script.js" fetchpriority=high></script>
+<script id=script2 src="resources/script.js" fetchpriority=low></script>
+<script id=script3 src="resources/script.js" fetchpriority=auto></script>
+<script id=script4 src="resources/script.js" fetchpriority=xyz></script>
+<script id=script5 src="resources/script.js"></script>
+
+<script>
+ test(() => {
+ assert_equals(script1.fetchPriority, "high", "high fetchPriority is a valid IDL value on the script element");
+ assert_equals(script2.fetchPriority, "low", "low fetchPriority is a valid IDL value on the script element");
+ assert_equals(script3.fetchPriority, "auto", "auto fetchPriority is a valid IDL value on the script element");
+ assert_equals(script4.fetchPriority, "auto", "invalid fetchPriority reflects as 'auto' IDL attribute on the script element");
+ assert_equals(script5.fetchPriority, "auto", "missing fetchPriority reflects as 'auto' IDL attribute on the script element");
+ }, "fetchpriority attribute on <script> elements should reflect valid IDL values");
+
+ test(() => {
+ const script = document.createElement("script");
+ assert_equals(script.fetchPriority, "auto");
+ }, "default fetchpriority attribute on <script> elements should be 'auto'");
+</script>