From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- .../scheduler/task-controller-setPriority2.any.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 testing/web-platform/tests/scheduler/task-controller-setPriority2.any.js (limited to 'testing/web-platform/tests/scheduler/task-controller-setPriority2.any.js') diff --git a/testing/web-platform/tests/scheduler/task-controller-setPriority2.any.js b/testing/web-platform/tests/scheduler/task-controller-setPriority2.any.js new file mode 100644 index 0000000000..716b3af33e --- /dev/null +++ b/testing/web-platform/tests/scheduler/task-controller-setPriority2.any.js @@ -0,0 +1,22 @@ +// META: title=Scheduler: TaskController.setPriority and Task Order +// META: global=window,worker +'use strict'; + +promise_test(async t => { + const tasks = []; + const runOrder = []; + const taskControllers = []; + + for (let i = 0; i < 5; i++) { + taskControllers.push(new TaskController({priority: 'background'})); + const signal = taskControllers[i].signal; + tasks.push(scheduler.postTask(() => { runOrder.push(i); }, {signal})); + } + + taskControllers[2].setPriority('user-blocking'); + assert_equals(taskControllers[2].signal.priority, 'user-blocking'); + + await Promise.all(tasks); + + assert_equals(runOrder.toString(), '2,0,1,3,4'); +}, 'Test TaskController.setPriority() affects task order.'); -- cgit v1.2.3