<!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>
