blob: 0610cfa69b65ff6c7523a2c9a5357c5d19d390f3 [file] [log] [blame]
<!doctype html>
<title>Scheduling API: TaskController.setPriority()</title>
<link rel="author" title="Scott Haseley" href="mailto:shaseley@chromium.org">
<link rel="help" href="https://github.com/WICG/main-thread-scheduling">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
async_test(t => {
let result = '';
let tc = new TaskController("user-visible");
for (let i = 0; i < 5; i++) {
let task = scheduler.postTask(() => {
result += i.toString();
}, { signal: tc.signal });
}
scheduler.postTask(() => { result += "5"; }, { priority : "user-blocking" });
scheduler.postTask(() => { result += "6"; }, { priority : "user-visible" });
tc.setPriority("background");
scheduler.postTask(t.step_func_done(() => {
assert_equals(result, '5601234');
}), { priority: "background" });
}, 'Test that TaskController.setPriority() changes the priority of all associated tasks');
</script>