gecko-dev/testing/web-platform/tests/server-timing/sw.js
Yoav Weiss 20254748e9 Bug 1462609 [wpt PR 11013] - Server-Timing: clean up service-worker test, a=testonly
Automatic update from web-platform-testsMerge pull request #11013 from cvazac/master

Server-Timing: clean up service-worker test
--

wpt-commits: 5478850d0df6d1d0f2e8c10f77f62d3c6e2dd589
wpt-pr: 11013
2018-05-20 19:10:39 +00:00

19 lines
585 B
JavaScript

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)
})
})
})