| Philippe Le Hegaret | a83f934 | 2018-02-22 14:13:10 | [diff] [blame] | 1 | <!DOCTYPE HTML> |
| 2 | <meta charset=utf-8> |
| 3 | <title>PerformanceObservers: navigation</title> |
| 4 | <script src="/resources/testharness.js"></script> |
| 5 | <script src="/resources/testharnessreport.js"></script> |
| 6 | <h1>PerformanceObservers: navigation</h1> |
| 7 | <p> |
| 8 | Navigation will <a href="https://w3c.github.io/performance-timeline/#dfn-queue-a-performanceentry">queue a PerformanceEntry</a>. |
| 9 | </p> |
| 10 | <div id="log"></div> |
| 11 | <script> |
| 12 | async_test(function (t) { |
| 13 | function checkEntry(pes) { |
| 14 | assert_equals(pes.length, 1, "Only one navigation timing entry"); |
| 15 | assert_equals(pes[0].entryType, "navigation", "entryType is \"navigation\""); |
| 16 | assert_equals(pes[0].name, window.location.toString(), "name is the address of the document"); |
| 17 | } |
| 18 | var observer = new PerformanceObserver( |
| 19 | t.step_func(function (entryList, obs) { |
| 20 | checkEntry(entryList.getEntries()); |
| 21 | checkEntry(entryList.getEntriesByType("navigation")); |
| 22 | checkEntry(entryList.getEntriesByName(window.location.toString())); |
| 23 | observer.disconnect(); |
| 24 | t.done(); |
| 25 | }) |
| 26 | ); |
| 27 | observer.observe({entryTypes: ["navigation"]}); |
| 28 | }, "navigation entry is observable"); |
| 29 | </script> |