| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="http://127.0.0.1:8000/resources/checkResourcePriority.js"></script> |
| |
| <script> |
| const tests = [ |
| {description: 'high fetchpriority on <link rel=stylesheet>s not fetched by the preload scanner must load with very high priority', fetchPriority: 'high', expected_priority: "ResourceLoadPriorityVeryHigh"}, |
| {description: 'low fetchpriority on <link rel=stylesheet>s not fetched by the preload scanner must load with medium priority', fetchPriority: 'low', expected_priority: "ResourceLoadPriorityMedium"}, |
| {description: 'auto fetchpriority on <link rel=stylesheet>s not fetched by the preload scanner must have no effect on resource load priority', fetchPriority: 'auto', expected_priority: "ResourceLoadPriorityHigh"}, |
| {description: 'invalid fetchpriority on <link rel=stylesheet>s not fetched by the preload scanner must have no effect on resource load priority', fetchPriority: 'xyz', expected_priority: "ResourceLoadPriorityHigh"}, |
| {description: 'missing fetchpriority on <link rel=stylesheet>s not fetched by the preload scanner must have no effect on resource load priority', expected_priority: "ResourceLoadPriorityHigh"} |
| ]; |
| |
| let iteration = 0; |
| for (const test of tests) { |
| async_test(t => { |
| const link = document.createElement('link'); |
| link.rel = 'stylesheet'; |
| if (test.fetchPriority) link.fetchPriority = test.fetchPriority; |
| const url = new URL(`/resources/square100.png?${iteration++}`, location); |
| link.href = url; |
| link.onload = t.step_func(() => { checkResourcePriority(url, test.expected_priority, test.description); t.done(); }); |
| document.head.appendChild(link); |
| }); |
| } |
| </script> |