| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <title>Service Worker: FetchEvent.respondWith() argument type test.</title> | |
| 3 <script src="../resources/testharness.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <script src="resources/test-helpers.js"></script> | |
| 6 <script> | |
| 7 var resolve_test_done; | |
| 8 | |
| 9 var test_done_promise = new Promise(function(resolve) { | |
| 10 resolve_test_done = resolve; | |
| 11 }); | |
| 12 | |
| 13 // Called by the child frame. | |
| 14 function notify_test_done(result) { | |
| 15 resolve_test_done(result); | |
| 16 } | |
| 17 | |
| 18 promise_test(function(t) { | |
| 19 var scope = 'resources/fetch-event-respond-with-argument-iframe.html'; | |
| 20 var script = 'resources/fetch-event-respond-with-argument-worker.js'; | |
| 21 var frame; | |
| 22 | |
| 23 return service_worker_unregister_and_register(t, script, scope) | |
| 24 .then(function(registration) { | |
| 25 return wait_for_state(t, registration.installing, 'activated'); | |
| 26 }) | |
| 27 .then(function() { | |
| 28 return with_iframe(scope); | |
| 29 }) | |
| 30 .then(function(f) { | |
| 31 frame = f; | |
| 32 return test_done_promise; | |
| 33 }) | |
| 34 .then(function(result) { | |
| 35 frame.remove(); | |
| 36 assert_equals(result, 'PASS'); | |
| 37 return service_worker_unregister_and_done(t, scope); | |
| 38 }); | |
| 39 }, 'respondWith() takes either a Response or a promise that resolves ' + | |
| 40 'with a Response. Other values should raise a network error.'); | |
| 41 </script> | |
| OLD | NEW |