Index: third_party/WebKit/LayoutTests/external/wpt/server-timing/test_server_timing.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/server-timing/test_server_timing.html b/third_party/WebKit/LayoutTests/external/wpt/server-timing/test_server_timing.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2a6ffa264999e9b9b151c4f133e55739f688dc93 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/external/wpt/server-timing/test_server_timing.html |
@@ -0,0 +1,50 @@ |
+<!DOCTYPE html> |
+<head> |
+ <meta charset='utf-8' /> |
+ <script src="/resources/testharness.js"></script> |
+ <script src='/resources/testharnessreport.js'></script> |
+ <script src='resources/webperftestharness.js'></script> |
+ <script src="/common/performance-timeline-utils.js"></script> |
+ <script> |
+ setup({explicit_done: true}) |
+ |
+ window.addEventListener('load', function() { |
+ // there should be exactly two server-timing entries, 1 for document, 1 for img#one |
+ test_entries(performance.getEntriesByType('server'), [{ |
+ name: document.location.href, |
+ entryType: 'server', |
+ startTime: 0, |
+ duration: 1.2, |
+ metric: 'metric1', |
+ description: 'document', |
+ }, { |
+ name: document.querySelector('img#one').src, |
+ entryType: 'server', |
+ startTime: 0, |
+ duration: 3.4, |
+ metric: 'metric2', |
+ description: 'blue.png', |
+ }]) |
+ |
+ new PerformanceObserver(function(entryList, observer) { |
+ // there should be exactly one server-timing entry, 1 for img#two |
+ test_entries(entryList.getEntriesByType('server'), [{ |
+ name: document.querySelector('img#two').src, |
+ entryType: 'server', |
+ startTime: 0, |
+ duration: 5.6, |
+ metric: 'metric3', |
+ description: 'green.png', |
+ }]) |
+ observer.disconnect() |
+ done() |
+ }).observe({entryTypes: ['server']}) |
+ |
+ var img = document.createElement('img') |
+ img.id = 'two' |
+ img.src = './resources/green.png' |
+ document.getElementsByTagName('script')[0].parentNode.appendChild(img) |
+ }) |
+ </script> |
+</head> |
+<img id='one' src='resources/blue.png'> |