summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/longtask-timing/resources/utils.js
blob: 36bd6c7bc28a762343202d1fc44ace6ddbf03467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
function checkLongTaskEntry(longtask, name='self') {
  assert_equals(longtask.entryType, 'longtask');
  assert_equals(longtask.name, name);
  assert_true(Number.isInteger(longtask.duration));
  assert_greater_than_equal(longtask.duration, 50);
  assert_greater_than_equal(longtask.startTime, 0);
  const currentTime = performance.now();
  assert_less_than_equal(longtask.startTime, currentTime);
}

function hasUnrelatedTaskName(taskName, expectedTaskName) {
  return (taskName !== expectedTaskName);
}