https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 53acfdab3796563ea320347c6da26df3f1d9a7d3 authored by Mike West on 19 June 2017, 09:19:34 UTC
fixup merge with ToT + cleanup navigation tests.
Tip revision: 53acfda
longtask-in-externalscript.html
<!DOCTYPE HTML>
<meta charset=utf-8>
<title>LongTask Timing: long task in external script</title>
<body>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/makelongtask.js"></script>

<h1>Long Task: External Script</h1>
<div id="log"></div>
<script>
  async_test(function (t) {
    var observer = new PerformanceObserver(
        t.step_func(function (entryList) {
            var entries = entryList.getEntries();
            assert_equals(entries.length, 1,
                "Exactly one entry is expected.");
            var longtask = entries[0];
            assert_equals(longtask.entryType, "longtask");
            assert_equals(longtask.name, "same-origin-self");
            assert_greater_than(longtask.duration, 50);
            assert_equals(longtask.startTime, Math.floor(longtask.startTime),
                "startTime expected to have 1 millisecond granularity");

            // Assert the TaskAttributionTiming entry in attribution.
            assert_equals(longtask.attribution.length, 1,
                "Exactly one attribution entry is expected");
            var attribution = longtask.attribution[0];
            assert_equals(attribution.entryType, "taskattribution");
            assert_equals(attribution.name, "frame");
            assert_equals(attribution.duration, 0);
            assert_equals(attribution.startTime, 0);
            assert_equals(attribution.frameId, "");
            assert_equals(attribution.frameName, "");
            assert_equals(attribution.frameSrc, "");
            observer.disconnect();
            t.done();
        })
    );
    observer.observe({entryTypes: ["longtask"]});

}, "Performance longtask entries are observable");
</script>

</body>
back to top