Bug 1865610: part 5) Separate tests for `<link rel=preload as=fetch>` from other `<link rel=preload>` tests. r=valentin

Allows passing the separated tests once `as=fetch` is supported, which
will happen in a following part.

For interoperability the expectations for `as=fetch` are adapted too
(https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/http/tests/priority-hints/link-preload-initial-load.html;l=39-52;drc=a7b04c9f4d4083e8e1a9d3ba15ba8030fe819719).

Differential Revision: https://phabricator.services.mozilla.com/D192332
This commit is contained in:
Mirko Brodesser 2023-11-23 14:45:22 +00:00
Родитель 135eba69cf
Коммит 9df16ef139
6 изменённых файлов: 96 добавлений и 29 удалений

Просмотреть файл

@ -7,5 +7,14 @@
[link-dynamic-preload.h2.html: test different 'fetchpriority' values]
expected: FAIL
[link-header.h2.html?pipe=header(Link,<dummy.txt?1>; rel=preload; as=fetch; fetchpriority=low,True)|header(Link,<dummy.txt?2>; rel=preload; as=fetch; fetchpriority=high,True)|header(Link,<dummy.txt?3>; rel=preload; as=fetch; fetchpriority=auto,True)|header(Link,<dummy.txt?4>; rel=preload; as=fetch,True)|header(Link,<dummy.font?1>; rel=preload; as=font; fetchpriority=low,True)|header(Link,<dummy.font?2>; rel=preload; as=font; fetchpriority=high,True)|header(Link,<dummy.font?3>; rel=preload; as=font; fetchpriority=auto,True)|header(Link,<dummy.font?4>; rel=preload; as=font,True)|header(Link,<dummy.image?1>; rel=preload; as=image; fetchpriority=low,True)|header(Link,<dummy.image?2>; rel=preload; as=image; fetchpriority=high,True)|header(Link,<dummy.image?3>; rel=preload; as=image; fetchpriority=auto,True)|header(Link,<dummy.image?4>; rel=preload; as=image,True): test different 'fetchpriority' values]
[link-initial-preload-fetch.h2.html: test different 'fetchpriority' values]
expected: FAIL
[link-dynamic-preload-fetch.h2.html: test different 'fetchpriority' values]
expected: FAIL
[link-header.h2.html?pipe=header(Link,<dummy.font?1>; rel=preload; as=font; fetchpriority=low,True)|header(Link,<dummy.font?2>; rel=preload; as=font; fetchpriority=high,True)|header(Link,<dummy.font?3>; rel=preload; as=font; fetchpriority=auto,True)|header(Link,<dummy.font?4>; rel=preload; as=font,True)|header(Link,<dummy.image?1>; rel=preload; as=image; fetchpriority=low,True)|header(Link,<dummy.image?2>; rel=preload; as=image; fetchpriority=high,True)|header(Link,<dummy.image?3>; rel=preload; as=image; fetchpriority=auto,True)|header(Link,<dummy.image?4>; rel=preload; as=image,True): test different 'fetchpriority' values]
expected: FAIL
[link-header.h2.html?pipe=header(Link,<dummy.txt?1>; rel=preload; as=fetch; fetchpriority=low,True)|header(Link,<dummy.txt?2>; rel=preload; as=fetch; fetchpriority=high,True)|header(Link,<dummy.txt?3>; rel=preload; as=fetch; fetchpriority=auto,True)|header(Link,<dummy.txt?4>; rel=preload; as=fetch,True): test different 'fetchpriority' values]
expected: FAIL

Просмотреть файл

@ -43,18 +43,6 @@ const kExpectedRequestsOfLoadStylesheet = [
];
const kExpectedRequestsOfLinkPreload = [
{ fileNameAndSuffix: "dummy.txt?1",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
},
{ fileNameAndSuffix: "dummy.txt?2",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
},
{ fileNameAndSuffix: "dummy.txt?3",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
},
{ fileNameAndSuffix: "dummy.txt?4",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_NORMAL
},
{ fileNameAndSuffix: "dummy.font?1",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
},
@ -81,6 +69,21 @@ const kExpectedRequestsOfLinkPreload = [
},
];
const kExpectedRequestsOfLinkPreloadFetch = [
{ fileNameAndSuffix: "dummy.txt?1",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
},
{ fileNameAndSuffix: "dummy.txt?2",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
},
{ fileNameAndSuffix: "dummy.txt?3",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
},
{ fileNameAndSuffix: "dummy.txt?4",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_HIGH
},
];
const kExpectedRequestsOfPreloadScript = [
{ fileNameAndSuffix: "dummy.js?1",
internalPriority: SpecialPowers.Ci.nsISupportsPriority.PRIORITY_LOW
@ -143,13 +146,8 @@ const kPipeHeaderLinksToStylesheets =
"|header(Link,<dummy.css?12>; rel=stylesheet; media=print,True)";
const kPipeHeaderPreloadLinks =
// as="fetch"
"=header(Link,<dummy.txt?1>; rel=preload; as=fetch; fetchpriority=low,True)" +
"|header(Link,<dummy.txt?2>; rel=preload; as=fetch; fetchpriority=high,True)" +
"|header(Link,<dummy.txt?3>; rel=preload; as=fetch; fetchpriority=auto,True)" +
"|header(Link,<dummy.txt?4>; rel=preload; as=fetch,True)" +
// as="font"
"|header(Link,<dummy.font?1>; rel=preload; as=font; fetchpriority=low,True)" +
"=header(Link,<dummy.font?1>; rel=preload; as=font; fetchpriority=low,True)" +
"|header(Link,<dummy.font?2>; rel=preload; as=font; fetchpriority=high,True)" +
"|header(Link,<dummy.font?3>; rel=preload; as=font; fetchpriority=auto,True)" +
"|header(Link,<dummy.font?4>; rel=preload; as=font,True)" +
@ -159,6 +157,12 @@ const kPipeHeaderPreloadLinks =
"|header(Link,<dummy.image?3>; rel=preload; as=image; fetchpriority=auto,True)" +
"|header(Link,<dummy.image?4>; rel=preload; as=image,True)";
const kPipeHeaderPreloadFetchLinks =
"=header(Link,<dummy.txt?1>; rel=preload; as=fetch; fetchpriority=low,True)" +
"|header(Link,<dummy.txt?2>; rel=preload; as=fetch; fetchpriority=high,True)" +
"|header(Link,<dummy.txt?3>; rel=preload; as=fetch; fetchpriority=auto,True)" +
"|header(Link,<dummy.txt?4>; rel=preload; as=fetch,True)";
const kPipeHeaderPreloadScriptLinks =
"=header(Link,<dummy.js?1>; rel=preload; as=script; fetchpriority=low,True)" +
"|header(Link,<dummy.js?2>; rel=preload; as=script; fetchpriority=high,True)" +
@ -208,6 +212,9 @@ export const kTestData = [
{ testFileName: "link-initial-preload.h2.html",
expectedRequests: kExpectedRequestsOfLinkPreload
},
{ testFileName: "link-initial-preload-fetch.h2.html",
expectedRequests: kExpectedRequestsOfLinkPreloadFetch
},
{ testFileName: "link-initial-preload-script.h2.html",
expectedRequests: kExpectedRequestsOfPreloadScript
},
@ -217,6 +224,9 @@ export const kTestData = [
{ testFileName: "link-dynamic-preload.h2.html",
expectedRequests: kExpectedRequestsOfLinkPreload
},
{ testFileName: "link-dynamic-preload-fetch.h2.html",
expectedRequests: kExpectedRequestsOfLinkPreloadFetch
},
{ testFileName: "link-dynamic-preload-script.h2.html",
expectedRequests: kExpectedRequestsOfPreloadScript
},
@ -226,6 +236,9 @@ export const kTestData = [
{ testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadLinks,
expectedRequests: kExpectedRequestsOfLinkPreload
},
{ testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadFetchLinks,
expectedRequests: kExpectedRequestsOfLinkPreloadFetch
},
{ testFileName: "link-header.h2.html?pipe" + kPipeHeaderPreloadScriptLinks,
expectedRequests: kExpectedRequestsOfPreloadScript
},

Просмотреть файл

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>fetchpriority</title>
</head>
<body>
<script>
onload = function() {
const kData = [
{ as: "fetch", href: "dummy.txt?1", fetchPriority: "low" },
{ as: "fetch", href: "dummy.txt?2", fetchPriority: "high" },
{ as: "fetch", href: "dummy.txt?3", fetchPriority: "auto" },
{ as: "fetch", href: "dummy.txt?4" },
];
let allLinkElements = [];
for (data of kData) {
let linkElement = document.createElement("link");
linkElement.rel = "preload";
linkElement.as = data.as;
linkElement.href = data.href;
if ("fetchPriority" in data) {
linkElement.fetchPriority = data.fetchPriority;
}
allLinkElements.push(linkElement);
}
document.head.append(...allLinkElements)
opener.postMessage("ChildLoaded", "*");
}
</script>
</body>
</html>

Просмотреть файл

@ -8,11 +8,6 @@
<script>
onload = function() {
const kData = [
// as="fetch"
{ as: "fetch", href: "dummy.txt?1", fetchPriority: "low" },
{ as: "fetch", href: "dummy.txt?2", fetchPriority: "high" },
{ as: "fetch", href: "dummy.txt?3", fetchPriority: "auto" },
{ as: "fetch", href: "dummy.txt?4" },
// as="font"
{ as: "font", href: "dummy.font?1", fetchPriority: "low" },
{ as: "font", href: "dummy.font?2", fetchPriority: "high" },

Просмотреть файл

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>fetchpriority</title>
<link rel="preload" as="fetch" href="dummy.txt?1" fetchpriority="low">
<link rel="preload" as="fetch" href="dummy.txt?2" fetchpriority="high">
<link rel="preload" as="fetch" href="dummy.txt?3" fetchpriority="auto">
<link rel="preload" as="fetch" href="dummy.txt?4">
</head>
<body>
<script>
onload = function() {
opener.postMessage("ChildLoaded", "*");
}
</script>
</body>
</html>

Просмотреть файл

@ -3,11 +3,6 @@
<head>
<meta charset="UTF-8">
<title>fetchpriority</title>
<!-- as="fetch"-->
<link rel="preload" as="fetch" href="dummy.txt?1" fetchpriority="low">
<link rel="preload" as="fetch" href="dummy.txt?2" fetchpriority="high">
<link rel="preload" as="fetch" href="dummy.txt?3" fetchpriority="auto">
<link rel="preload" as="fetch" href="dummy.txt?4">
<!-- as="font" -->
<link rel="preload" as="font" href="dummy.font?1" fetchpriority="low">
<link rel="preload" as="font" href="dummy.font?2" fetchpriority="high">