OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8"> |
| 5 <title>Navigation Timing 2 WPT</title> |
| 6 <link rel="author" title="Google" href="http://www.google.com/" /> |
| 7 <link rel="help" href="http://www.w3.org/TR/navigation-timing-2/#sec-Per
formanceNavigationTiming"/> |
| 8 <script src="/resources/testharness.js"></script> |
| 9 <script src="/resources/testharnessreport.js"></script> |
| 10 </head> |
| 11 <body> |
| 12 <h1>Description</h1> |
| 13 <p>This test validates that PerformanceObserver can observe nav timing 2
instance and that the expected attributes in nav timing 2 instance exist (but d
oes not validate that the values are correct).</p> |
| 14 |
| 15 <script> |
| 16 var navTiming2Attributes = [ |
| 17 'connectEnd', |
| 18 'connectStart', |
| 19 'decodedBodySize', |
| 20 'domComplete', |
| 21 'domContentLoadedEventEnd', |
| 22 'domContentLoadedEventStart', |
| 23 'domInteractive', |
| 24 'domainLookupEnd', |
| 25 'domainLookupStart', |
| 26 'duration', |
| 27 'encodedBodySize', |
| 28 'entryType', |
| 29 'fetchStart', |
| 30 'initiatorType', |
| 31 'loadEventEnd', |
| 32 'loadEventStart', |
| 33 'name', |
| 34 'redirectCount', |
| 35 'redirectEnd', |
| 36 'redirectStart', |
| 37 'requestStart', |
| 38 'responseEnd', |
| 39 'responseStart', |
| 40 'secureConnectionStart', |
| 41 'transferSize', |
| 42 'type', |
| 43 'unloadEventEnd', |
| 44 'unloadEventStart', |
| 45 'workerStart' |
| 46 ]; |
| 47 async_test(function (t) { |
| 48 var observer = new PerformanceObserver( |
| 49 t.step_func(function (entryList) { |
| 50 var entries = entryList.getEntries(); |
| 51 assert_equals(entries.length, 1, |
| 52 "There should be only one navigation timing instance."); |
| 53 for (var i = 0; i < navTiming2Attributes.length; i++) { |
| 54 assert_true(navTiming2Attributes[i] in entries[0], |
| 55 "Expected attribute: " + navTiming2Attributes[i] + "
."); |
| 56 } |
| 57 observer.disconnect(); |
| 58 t.done(); |
| 59 }) |
| 60 ); |
| 61 observer.observe({entryTypes: ["navigation"]}); |
| 62 |
| 63 }, "Performance navigation timing entries are observable."); |
| 64 </script> |
| 65 </body> |
| 66 </html> |
OLD | NEW |