summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/scheduler/task-signal-onprioritychange.any.js
blob: 7f59e1f1f84ca2761195f6426ec0a0a3a2bd38b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// META: title=Scheduler: TaskSignal onprioritychange
// META: global=window,worker
'use strict';

async_test(t => {
  const controller = new TaskController({priority: 'user-visible'});
  controller.signal.onprioritychange = t.step_func_done((event) => {
    assert_equals(controller.signal.priority, 'background');
    assert_equals(event.type, 'prioritychange');
    assert_equals(event.target.priority, 'background');
    assert_equals(event.previousPriority, 'user-visible');
  });
  controller.setPriority('background');
}, 'Test that TaskSignal.onprioritychange listens for prioritychange events');