diff options
Diffstat (limited to 'testing/web-platform/tests/longtask-timing/longtask-before-observer.window.js')
-rw-r--r-- | testing/web-platform/tests/longtask-timing/longtask-before-observer.window.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/testing/web-platform/tests/longtask-timing/longtask-before-observer.window.js b/testing/web-platform/tests/longtask-timing/longtask-before-observer.window.js new file mode 100644 index 0000000000..79d6990cf8 --- /dev/null +++ b/testing/web-platform/tests/longtask-timing/longtask-before-observer.window.js @@ -0,0 +1,16 @@ +// 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.'); |