Skip to content

Commit

Permalink
Make priority hints tests more stable
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=254885

Reviewed by Alexey Proskuryakov.

Some priority hints tests do not produce unique urls, causing failures when using multiple
iterations, fix that by using unique prefixes.

* LayoutTests/TestExpectations:
* LayoutTests/http/tests/priority-hints/link-preload-dynamic-insertion.html:
* LayoutTests/http/tests/priority-hints/link-preload-initial-load.html:

Canonical link: https://commits.webkit.org/262499@main
  • Loading branch information
rwlbuis committed Apr 3, 2023
1 parent a972739 commit f64fa80
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
2 changes: 0 additions & 2 deletions LayoutTests/TestExpectations
Expand Up @@ -6296,6 +6296,4 @@ imported/w3c/web-platform-tests/css/css-ruby/ruby-whitespace-002.html [ ImageOnl
imported/w3c/web-platform-tests/css/css-ruby/ruby-with-floats-002.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-ruby/ruby-with-floats-003.html [ ImageOnlyFailure ]

webkit.org/b/254259 http/tests/priority-hints/fetch-api-priority.html [ Failure Pass ]

webkit.org/b/242658 http/tests/media/user-gesture-preserved-across-xmlhttprequest.html [ Slow Pass Failure ]
Expand Up @@ -98,7 +98,7 @@
link.as = test.as;
if (test.fetchPriority) link.fetchPriority = test.fetchPriority;

const url = new URL(`../resources/${test.resource}?${iteration++}`, location);
const url = new URL(`../resources/${test.resource}?lpdi${iteration++}`, location);
link.href = url;
link.onload = t.step_func(() => { checkResourcePriority(url, test.expected_priority, test.description); t.done(); });
document.head.appendChild(link);
Expand Down
Expand Up @@ -6,76 +6,76 @@
<script>
const priority_tests = [
{
url: new URL('../resources/dummy.css', location), expected_priority: "ResourceLoadPriorityMedium",
url: new URL('../resources/dummy.css?lpil', location), expected_priority: "ResourceLoadPriorityMedium",
description: 'low fetchpriority on <link rel=preload as=style> must be fetched with medium resource load priority'
},
{
url: new URL('../resources/dummy.css?1', location), expected_priority: "ResourceLoadPriorityHigh",
url: new URL('../resources/dummy.css?lpil1', location), expected_priority: "ResourceLoadPriorityHigh",
description: 'missing fetchpriority on <link rel=preload as=style> must have no effect on resource load priority'
},
{
url: new URL('../resources/dummy.css?2', location), expected_priority: "ResourceLoadPriorityVeryHigh",
url: new URL('../resources/dummy.css?lpil2', location), expected_priority: "ResourceLoadPriorityVeryHigh",
description: 'high fetchpriority on <link rel=preload as=style> must be fetched with very high resource load priority'
},
{
url: new URL('../resources/dummy.js', location), expected_priority: "ResourceLoadPriorityMedium",
url: new URL('../resources/dummy.js?lpil', location), expected_priority: "ResourceLoadPriorityMedium",
description: 'low fetchpriority on <link rel=preload as=script> must be fetched with medium resource load priority'
},
{
url: new URL('../resources/dummy.js?1', location), expected_priority: "ResourceLoadPriorityHigh",
url: new URL('../resources/dummy.js?lpil1', location), expected_priority: "ResourceLoadPriorityHigh",
description: 'missing fetchpriority on <link rel=preload as=script> must have no effect on resource load priority'
},
{
url: new URL('../resources/dummy.js?2', location), expected_priority: "ResourceLoadPriorityVeryHigh",
url: new URL('../resources/dummy.js?lpil2', location), expected_priority: "ResourceLoadPriorityVeryHigh",
description: 'high fetchpriority on <link rel=preload as=script> must be fetched with very high resource load priority'
},
{
url: new URL('../resources/dummy.txt', location), expected_priority: "ResourceLoadPriorityLow",
url: new URL('../resources/dummy.txt?lpil', location), expected_priority: "ResourceLoadPriorityLow",
description: 'low fetchpriority on <link rel=preload as=fetch> must be fetched with low resource load priority'
},
{
url: new URL('../resources/dummy.txt?1', location), expected_priority: "ResourceLoadPriorityMedium",
url: new URL('../resources/dummy.txt?lpil1', location), expected_priority: "ResourceLoadPriorityMedium",
description: 'missing fetchpriority on <link rel=preload as=fetch> must have no effect on resource load priority'
},
{
url: new URL('../resources/dummy.txt?2', location), expected_priority: "ResourceLoadPriorityHigh",
url: new URL('../resources/dummy.txt?lpil2', location), expected_priority: "ResourceLoadPriorityHigh",
description: 'high fetchpriority on <link rel=preload as=fetch> must be fetched with high resource load priority'
},
{
url: new URL('../resources/square.png', location), expected_priority: "ResourceLoadPriorityVeryLow",
url: new URL('../resources/square.png?lpil', location), expected_priority: "ResourceLoadPriorityVeryLow",
description: 'low fetchpriority on <link rel=preload as=image> must be fetched with very low resource load priority'
},
{
url: new URL('../resources/square.png?1', location), expected_priority: "ResourceLoadPriorityLow",
url: new URL('../resources/square.png?lpil1', location), expected_priority: "ResourceLoadPriorityLow",
description: 'missing fetchpriority on <link rel=preload as=image> must have no effect on resource load priority'
},
{
url: new URL('../resources/square.png?2', location), expected_priority: "ResourceLoadPriorityMedium",
url: new URL('../resources/square.png?lpil2', location), expected_priority: "ResourceLoadPriorityMedium",
description: 'high fetchpriority on <link rel=preload as=image> must be fetched with medium resource load priority'
}
];
</script>

<!-- as=style -->
<!-- don't need to test for invalid and explicit auto fetchpriority here, since we already do that in the other link test -->
<link id=link1 fetchpriority=low rel=preload as=style href=../resources/dummy.css>
<link id=link2 rel=preload as=style href=../resources/dummy.css?1>
<link id=link3 fetchpriority=high rel=preload as=style href=../resources/dummy.css?2>
<link id=link1 fetchpriority=low rel=preload as=style href=../resources/dummy.css?lpil>
<link id=link2 rel=preload as=style href=../resources/dummy.css?lpil1>
<link id=link3 fetchpriority=high rel=preload as=style href=../resources/dummy.css?lpil2>

<!-- as=script-->
<link id=link4 fetchpriority=low rel=preload as=script href=../resources/dummy.js>
<link id=link5 rel=preload as=script href=../resources/dummy.js?1>
<link id=link6 fetchpriority=high rel=preload as=script href=../resources/dummy.js?2>
<link id=link4 fetchpriority=low rel=preload as=script href=../resources/dummy.js?lpil>
<link id=link5 rel=preload as=script href=../resources/dummy.js?lpil1>
<link id=link6 fetchpriority=high rel=preload as=script href=../resources/dummy.js?lpil2>

<!-- as=fetch-->
<link id=link7 fetchpriority=low rel=preload as=fetch href=../resources/dummy.txt>
<link id=link8 rel=preload as=fetch href=../resources/dummy.txt?1>
<link id=link9 fetchpriority=high rel=preload as=fetch href=../resources/dummy.txt?2>
<link id=link7 fetchpriority=low rel=preload as=fetch href=../resources/dummy.txt?lpil>
<link id=link8 rel=preload as=fetch href=../resources/dummy.txt?lpil1>
<link id=link9 fetchpriority=high rel=preload as=fetch href=../resources/dummy.txt?lpil2>

<!-- as=image-->
<link id=link10 fetchpriority=low rel=preload as=image href=../resources/square.png>
<link id=link11 rel=preload as=image href=../resources/square.png?1>
<link id=link12 fetchpriority=high rel=preload as=image href=../resources/square.png?2>
<link id=link10 fetchpriority=low rel=preload as=image href=../resources/square.png?lpil>
<link id=link11 rel=preload as=image href=../resources/square.png?lpil1>
<link id=link12 fetchpriority=high rel=preload as=image href=../resources/square.png?lpil2>

<script>
promise_test(async (t) => {
Expand Down

0 comments on commit f64fa80

Please sign in to comment.