| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Service Worker: registration end-to-end</title> | 2 <title>Service Worker: registration end-to-end</title> |
| 3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="resources/test-helpers.js"></script> | 5 <script src="resources/test-helpers.js"></script> |
| 6 <script> | 6 <script> |
| 7 var t = async_test('Registration: end-to-end'); | 7 var t = async_test('Registration: end-to-end'); |
| 8 t.step(function() { | 8 t.step(function() { |
| 9 | 9 |
| 10 var scope = '/in-scope/*'; | 10 var scope = '/in-scope/*'; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 switch (sw.state) { | 53 switch (sw.state) { |
| 54 case 'installing': | 54 case 'installing': |
| 55 assert_equals(lastServiceWorkerState, 'parsed'); | 55 assert_equals(lastServiceWorkerState, 'parsed'); |
| 56 break; | 56 break; |
| 57 case 'installed': | 57 case 'installed': |
| 58 assert_equals(lastServiceWorkerState, 'installing'); | 58 assert_equals(lastServiceWorkerState, 'installing'); |
| 59 break; | 59 break; |
| 60 case 'activating': | 60 case 'activating': |
| 61 assert_equals(lastServiceWorkerState, 'installed'); | 61 assert_equals(lastServiceWorkerState, 'installed'); |
| 62 break; | 62 break; |
| 63 case 'active': | 63 case 'activated': |
| 64 assert_equals(lastServiceWorkerState, 'activating'); | 64 assert_equals(lastServiceWorkerState, 'activating'); |
| 65 break; | 65 break; |
| 66 default: | 66 default: |
| 67 assert_unreached('Unexpected state: ' + sw.state); | 67 assert_unreached('Unexpected state: ' + sw.state); |
| 68 } | 68 } |
| 69 | 69 |
| 70 lastServiceWorkerState = sw.state; | 70 lastServiceWorkerState = sw.state; |
| 71 if (sw.state === 'active') | 71 if (sw.state === 'activated') |
| 72 resolve(); | 72 resolve(); |
| 73 }); | 73 }); |
| 74 })); | 74 })); |
| 75 | 75 |
| 76 Promise.all([sawMessage, sawActive]).then(t.step_func(function() { | 76 Promise.all([sawMessage, sawActive]).then(t.step_func(function() { |
| 77 assert_array_equals(serviceWorkerStates, | 77 assert_array_equals(serviceWorkerStates, |
| 78 ['parsed', 'installing', 'installed', 'activatin
g', 'active'], | 78 ['parsed', 'installing', 'installed', 'activatin
g', 'activated'], |
| 79 'Service worker should pass through four states'
); | 79 'Service worker should pass through four states'
); |
| 80 | 80 |
| 81 assert_equals(currentChangeCount, 0, | 81 assert_equals(currentChangeCount, 0, |
| 82 'Should not see current changes since document is out
of scope'); | 82 'Should not see current changes since document is out
of scope'); |
| 83 | 83 |
| 84 assert_equals(receivedMessageFromPort, 'Ack for: registering doc'); | 84 assert_equals(receivedMessageFromPort, 'Ack for: registering doc'); |
| 85 | 85 |
| 86 service_worker_unregister_and_done(t, scope); | 86 service_worker_unregister_and_done(t, scope); |
| 87 })); | 87 })); |
| 88 } | 88 } |
| 89 }); | 89 }); |
| 90 </script> | 90 </script> |
| OLD | NEW |