diff options
Diffstat (limited to 'testing/web-platform/tests/server-timing/sw.js')
-rw-r--r-- | testing/web-platform/tests/server-timing/sw.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/server-timing/sw.js b/testing/web-platform/tests/server-timing/sw.js new file mode 100644 index 0000000000..a6fd72ad17 --- /dev/null +++ b/testing/web-platform/tests/server-timing/sw.js @@ -0,0 +1,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) + }) + }) +}) |