blob: 824de3f9d3c3cacfcc7aff27b4b6ee6095f64583 [file] [log] [blame]
<script src=resources/common.js></script>
<script src=../resources/testharness.js></script>
<script src=../resources/testharnessreport.js></script>
<script>
test(t => {
t.add_cleanup(clearUseCounter);
assert_false(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is not use-counted before the importance ' +
'IDL attribute is set');
const image = new Image();
image.importance = 'high';
assert_true(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is use-counted once the importance IDL ' +
'attribute is set');
}, 'Priority Hints use-counter works properly with the <img> importance ' +
'IDL attribute');
test(t => {
t.add_cleanup(clearUseCounter);
assert_false(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is not use-counted before the importance ' +
'content attribute is set');
const image = new Image();
image.setAttribute('importance', 'high');
assert_true(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is use-counted once the importance content ' +
'attribute is set');
}, 'Priority Hints use-counter works properly with the <img> importance ' +
'content attribute');
const t = async_test('Priority Hints is use-counted when the importance ' +
'content attribute is parsed on the <img> element');
t.add_cleanup(clearUseCounter);
t.step_func(() => {
assert_false(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is not use-counted before the importance ' +
'content attribute is parsed');
});
window.addEventListener('DOMContentLoaded', t.step_func_done(() => {
document.body.innerHTML +=
'<img importance=high src../resources/square.png>';
assert_true(internals.isUseCounted(document, kPriorityHints),
'Priority Hints is use-counted once the importance content ' +
'attribute is parsed');
}));
</script>