fune/testing/web-platform/tests/longtask-timing/longtask-before-observer.window.js
Nicolás Peña Moreno 3512342231 Bug 1679024 [wpt PR 26614] - [LongTasks] Truncate duration to 1 ms resolution, a=testonly
Automatic update from web-platform-tests
[LongTasks] Truncate duration to 1 ms resolution

Bug: 1146022
Change-Id: I71c726fdb85d432271220c66557a0fc64bdd341d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2552846
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832970}

--

wpt-commits: d1aaf685cfb02e0350701550afe4146d555f2461
wpt-pr: 26614
2020-12-07 09:26:04 +00:00

16 lines
646 B
JavaScript

// META: script=resources/utils.js
async_test(t => {
assert_implements(window.PerformanceLongTaskTiming, 'Longtasks are not supported.');
// Create a long task before any observer.
const begin = window.performance.now();
while (window.performance.now() < begin + 60);
// After a timeout, add an observer with buffered flag.
t.step_timeout(() => {
new PerformanceObserver(t.step_func_done(list => {
list.getEntries().forEach(entry => {
checkLongTaskEntry(entry);
});
})).observe({type: 'longtask', buffered: true});
}, 0);
}, 'PerformanceObserver with buffered flag can see previous longtask entries.');