summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/resource-timing/ping-rt-entries.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/resource-timing/ping-rt-entries.html')
-rw-r--r--testing/web-platform/tests/resource-timing/ping-rt-entries.html29
1 files changed, 29 insertions, 0 deletions
diff --git a/testing/web-platform/tests/resource-timing/ping-rt-entries.html b/testing/web-platform/tests/resource-timing/ping-rt-entries.html
new file mode 100644
index 0000000000..34dad10b9f
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/ping-rt-entries.html
@@ -0,0 +1,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>