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 nav timing 2 instance can be accessed by thr
ee different accessors once available: window.performance.getEntries()/getEntrie
sByType("navigation")/getEntriesByName("document")</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 |
| 48 async_test(function (t) { |
| 49 var observer = new PerformanceObserver( |
| 50 t.step_func(function (entryList) { |
| 51 var instance1 = performance.getEntries()[0]; |
| 52 var instance2 = performance.getEntriesByType("navigation")[0
]; |
| 53 var instance3 = performance.getEntriesByName("document")[0]; |
| 54 |
| 55 assert_equals(performance.getEntriesByType("navigation").len
gth, 1, "Expected there is only one navigation timing instance."); |
| 56 assert_equals(performance.getEntriesByName("document").lengt
h, 1, "Expected there is only one navigation timing instance."); |
| 57 |
| 58 for (var i = 0; i < navTiming2Attributes.length; i++) { |
| 59 assert_equals(instance1[navTiming2Attributes[i]], instan
ce2[navTiming2Attributes[i]]); |
| 60 } |
| 61 |
| 62 for (var i = 0; i < navTiming2Attributes.length; i++) { |
| 63 assert_equals(instance1[navTiming2Attributes[i]], instan
ce3[navTiming2Attributes[i]]); |
| 64 } |
| 65 observer.disconnect(); |
| 66 t.done(); |
| 67 }) |
| 68 ); |
| 69 observer.observe({entryTypes: ["navigation"]}); |
| 70 |
| 71 }, "Performance navigation timing entries are accessible through three d
ifferent accessors."); |
| 72 </script> |
| 73 </body> |
| 74 </html> |
OLD | NEW |