summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/server-timing/sw.js
blob: a6fd72ad17bc0057f63bbf65caf97b66e2cce60c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
importScripts('/resources/testharness.js')

promise_test((test) => {
  return fetch('./sw.js').then((response) => {
    return new Promise((resolve, reject) => {
      step_timeout(() => {
        const entry = performance.getEntriesByName(response.url)[0]
        if (!entry) {
          reject('no entry: ' + response.url)
        }

        assert_not_equals(typeof entry.serverTiming,
          'undefined',
          'An instance of `PerformanceResourceTiming` should have a `serverTiming` attribute in the Service Worker context.')
        resolve()
      }, 250)
    })
  })
})