blob: 4296acf440413a58ea093577ae34dfa327f83601 [file] [log] [blame]
<script src=../priorities/resources/common.js></script>
<script src=../resources/testharness.js></script>
<script src=../resources/testharnessreport.js></script>
<script>
const t = async_test('low importance on in-viewport images must be fetched with kLow resource load priority');
const url = new URL('../resources/slow-image.php?sleep=1000&name=square.png', location);
const priorityPromise = internals.getResourcePriority(url, document);
// Synchronous wait to delay layout by .5 seconds
const end = Date.now() + 500;
while (Date.now() < end) {}
priorityPromise.then(priority => {
assert_equals(priority, kLow);
t.done();
});
</script>
<!--
In-viewport images get re-prioritized if layout is computed mid-flight. With importance=low, re-prioritization should have no effect,
we delay both the image request (will be fetched by preload scanner) by a second, and finish layout mid-flight. As long as the final
resource load priority is kLow, we know the image was not re-prioritized.
-->
<img importance=low src="../resources/slow-image.php?sleep=1000&name=square.png" alt=img>