summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resource-timing/ping-rt-entries.html
blob: 34dad10b9f28b6b3dc9724f571aa3db7a82ad32c (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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Resource Timing Entry For hyperlink audit (ping)</title>
<link rel="help" href="https://w3c.github.io/resource-timing/"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resource-timing/resources/observe-entry.js"></script>
</head>
<body>
<script>
    promise_test(async t => {
        const link = document.createElement('a');
        const delay = 500;
        const ping = `/xhr/resources/delay.py?ms=${delay}`;
        link.setAttribute('href', 'resources/close.html');
        link.setAttribute('target', '_blank');
        link.setAttribute('ping', ping);
        link.innerText = 'Link';
        document.body.appendChild(link);
        link.click();
        const entry = await observe_entry(ping);
        assert_equals(entry.initiatorType, 'ping');
        assert_greater_than(entry.duration, delay);
    }, "Hyperlink auditing (<a ping>) should have a resource timing entry");
</script>
</body>
</html>