Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>ServiceWorkerGlobalScope: update</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 | |
| 8 promise_test(function(t) { | |
| 9 var script = 'resources/update-worker.php'; | |
| 10 var scope = 'resources/scope/update'; | |
| 11 var registration; | |
| 12 var frame1; | |
| 13 | |
| 14 return service_worker_unregister_and_register(t, script, scope) | |
| 15 .then(function(r) { | |
| 16 registration = r; | |
| 17 return wait_for_state(t, registration.installing, 'activated'); | |
| 18 }) | |
| 19 .then(function() { return with_iframe(scope); }) | |
| 20 .then(function(f) { | |
| 21 frame1 = f; | |
| 22 registration.active.postMessage('update'); | |
| 23 return wait_for_update(t, registration); | |
| 24 }) | |
| 25 .then(function() { return with_iframe(scope); }) | |
| 26 .then(function(frame2) { | |
| 27 var expected_events_seen = [ | |
| 28 'updatefound', // by register(). | |
| 29 'activate', | |
| 30 'fetch', | |
| 31 'message', | |
| 32 'updatefound', // by update() in the message handler. | |
| 33 'fetch', | |
| 34 ]; | |
| 35 assert_equals( | |
| 36 frame2.contentDocument.body.textContent, | |
| 37 expected_events_seen.toString(), | |
| 38 'Service Worker should respond to fetch'); | |
|
falken
2015/06/10 04:14:39
this description seems of what you're asserting se
nhiroki
2015/06/10 06:47:21
Done.
| |
| 39 frame1.remove(); | |
| 40 frame2.remove(); | |
| 41 return service_worker_unregister_and_done(t, scope); | |
| 42 }); | |
| 43 }, 'Update a registration on ServiceWorkerGlobalScope'); | |
| 44 | |
| 45 </script> | |
| OLD | NEW |