From e040ed925030f899f845d458c226f7e439f4ec8b Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 29 Apr 2018 11:49:50 +0200 Subject: moebius#158: The Performance Resource Timing (added support for "workerStart") https://github.com/MoonchildProductions/moebius/pull/158 --- .../service-workers/service-worker/resource-timing.https.html.ini | 7 ------- .../service-workers/service-worker/resource-timing.https.html | 4 ++++ .../service-worker/resources/resource-timing-worker.js | 6 +++++- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'testing') diff --git a/testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini index b399d5f386..b6f02262b6 100644 --- a/testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini +++ b/testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini @@ -1,9 +1,2 @@ [resource-timing.https.html] type: testharness - disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1178713 - [Controlled resource loads] - expected: FAIL - - [Non-controlled resource loads] - expected: FAIL - diff --git a/testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html b/testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html index f33c41d715..3a1adfa486 100644 --- a/testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html +++ b/testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html @@ -13,6 +13,10 @@ function verify(performance, resource, description) { assert_greater_than(entry.workerStart, 0, description); assert_greater_than_equal(entry.workerStart, entry.startTime, description); assert_less_than_equal(entry.workerStart, entry.fetchStart, description); + assert_greater_than_equal(entry.responseStart, entry.fetchStart, description); + assert_greater_than_equal(entry.responseEnd, entry.responseStart, description); + assert_greater_than(entry.responseEnd, entry.fetchStart, description); + assert_greater_than(entry.duration, 0, description); if (resource.indexOf('redirect.py') != -1) { assert_less_than_equal(entry.workerStart, entry.redirectStart, description); diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js b/testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js index 481a6536af..452876838f 100644 --- a/testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js +++ b/testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js @@ -1,5 +1,9 @@ self.addEventListener('fetch', function(event) { if (event.request.url.indexOf('dummy.js') != -1) { - event.respondWith(new Response()); + event.respondWith(new Promise(resolve => { + // Slightly delay the response so we ensure we get a non-zero + // duration. + setTimeout(_ => resolve(new Response()), 100); + })); } }); -- cgit v1.2.3