summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/tentative/include-frames-one-remote-child.sub.html
blob: 61e7a1f6480bdc122a87cce1b6d38a22c8db2ca7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
</body>
<script>
promise_test(() => {
    return new Promise(resolve => {
        performance.clearResourceTimings()

        // Create Remote child iframe.
        const childFrame = document.createElement('iframe')
        childFrame.src = "http://{{hosts[][www]}}:{{ports[http][0]}}/resources/child-frame.html"
        document.body.appendChild(childFrame)

        childFrame.addEventListener("load", () => {
            const entries = performance.getEntries(true)
            const navigationEntries = performance.getEntriesByType("navigation", true)
            const markedEntries = performance.getEntriesByName("entry-name", undefined, true)

            // 3 entries for parent, 0 for child.
            assert_equals(entries.length, 3)

            // 1 entry for parent.
            assert_equals(navigationEntries.length, 1)

            // 0 entries.
            assert_equals(markedEntries.length, 0)

            resolve()
        })
    })
}, "GetEntries of a parent Frame with one Cross-Origin child")
</script>