chromium/third_party/blink/web_tests/http/tests/priority-hints/link-dynamic-insertion.html

<script src=../priorities/resources/common.js></script>
<script src=../resources/testharness.js></script>
<script src=../resources/testharnessreport.js></script>

<script>
  const tests = [
    {description: 'high fetchpriority on <link rel=stylesheet>s not fetched by the preload scanner must have no effect on resource load priority', fetchPriority: 'high', expected_priority: kVeryHigh},
    {description: 'low fetchpriority on <link rel=stylesheet>s not fetched by the preload scanner must load with kHigh priority', fetchPriority: 'low', expected_priority: kHigh},
    {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: kVeryHigh},
    {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: kVeryHigh},
    {description: 'missing fetchpriority on <link rel=stylesheet>s not fetched by the preload scanner must have no effect on resource load priority', expected_priority: kVeryHigh}
  ];

  let iteration = 0;
  for (const test of tests) {
    promise_test(async () => {
      const link = document.createElement('link');
      link.rel = 'stylesheet';
      if (test.fetchPriority) link.fetchPriority = test.fetchPriority;

      const url = new URL(`../resources/square.png?${iteration++}`, location);
      const priorityPromise = internals.getInitialResourcePriority(url, document);
      link.href = url;
      document.head.appendChild(link);
      const load_priority = await priorityPromise;
      assert_equals(load_priority, test.expected_priority, test.description);
    });
  }
</script>