summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-timing/supported-navigation-type.window.js
blob: 3239c7d29ffb11cbfebda12b4e5420bca0131094 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
test(() => {
  if (typeof PerformanceObserver.supportedEntryTypes === "undefined")
    assert_unreached("supportedEntryTypes is not supported.");
  assert_true(PerformanceObserver.supportedEntryTypes.includes("navigation"),
    "There should be an entry 'navigation' in PerformanceObserver.supportedEntryTypes");
}, "supportedEntryTypes contains 'navigation'.");

if (typeof PerformanceObserver.supportedEntryTypes !== "undefined") {
  const entryType = "navigation";
  if (PerformanceObserver.supportedEntryTypes.includes(entryType)) {
    promise_test(async() => {
      await new Promise((resolve) => {
        new PerformanceObserver(function (list, observer) {
          observer.disconnect();
          resolve();
        }).observe({entryTypes: [entryType]});
      })
    }, `'${entryType}' entries should be observable.`)
  }
}