| OLD | NEW |
| 1 // This worker remains in the installing phase so that the | 1 // This worker remains in the installing phase so that the |
| 2 // navigation preload API can be tested when there is no | 2 // navigation preload API can be tested when there is no |
| 3 // active worker. | 3 // active worker. |
| 4 importScripts('../../../resources/testharness.js'); | 4 importScripts('/resources/testharness.js'); |
| 5 importScripts('helpers.js'); | 5 importScripts('helpers.js'); |
| 6 | 6 |
| 7 function expect_rejection(promise) { | 7 function expect_rejection(promise) { |
| 8 return promise.then( | 8 return promise.then( |
| 9 () => { return Promise.reject('unexpected fulfillment'); }, | 9 () => { return Promise.reject('unexpected fulfillment'); }, |
| 10 err => { assert_equals('InvalidStateError', err.name); }); | 10 err => { assert_equals('InvalidStateError', err.name); }); |
| 11 } | 11 } |
| 12 | 12 |
| 13 function test_before_activation() { | 13 function test_before_activation() { |
| 14 const np = self.registration.navigationPreload; | 14 const np = self.registration.navigationPreload; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 31 .then(result => { | 31 .then(result => { |
| 32 e.source.postMessage(result); | 32 e.source.postMessage(result); |
| 33 resolve_done_promise(); | 33 resolve_done_promise(); |
| 34 })); | 34 })); |
| 35 }); | 35 }); |
| 36 | 36 |
| 37 // Don't become the active worker until the test is done. | 37 // Don't become the active worker until the test is done. |
| 38 self.addEventListener('install', e => { | 38 self.addEventListener('install', e => { |
| 39 e.waitUntil(done_promise); | 39 e.waitUntil(done_promise); |
| 40 }); | 40 }); |
| OLD | NEW |