OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>InstallPhaseEvent: waitUntil</title> | 2 <title>ExtendableEvent: waitUntil</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 // Temporary measure to diagnose timeouts on Win XP. Let the W3C harness | 7 // Temporary measure to diagnose timeouts on Win XP. Let the W3C harness |
8 // timeout before run-webkit-tests does, so it can report the particular | 8 // timeout before run-webkit-tests does, so it can report the particular |
9 // test that timed out. | 9 // test that timed out. |
10 // FIXME: Remove after the cause of timeout is fixed. | 10 // FIXME: Remove after the cause of timeout is fixed. |
11 var properties = {timeout: 5500}; | 11 var properties = {timeout: 5500}; |
12 | 12 |
13 function runTest(test, scope, onRegister) { | 13 function runTest(test, scope, onRegister) { |
14 var script = 'resources/install-phase-event-waituntil.js'; | 14 var script = 'resources/extendable-event-waituntil.js'; |
15 service_worker_unregister_and_register(test, script, scope) | 15 service_worker_unregister_and_register(test, script, scope) |
16 .then(function(registration) { | 16 .then(function(registration) { |
17 return get_newest_worker(registration); | 17 return get_newest_worker(registration); |
18 }) | 18 }) |
19 .then(test.step_func(onRegister)); | 19 .then(test.step_func(onRegister)); |
20 } | 20 } |
21 | 21 |
22 function syncWorker(test, worker, obj) { | 22 function syncWorker(test, worker, obj) { |
23 var channel = new MessageChannel(); | 23 var channel = new MessageChannel(); |
24 channel.port1.onmessage = test.step_func(function(e) { | 24 channel.port1.onmessage = test.step_func(function(e) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 .then(function() { | 109 .then(function() { |
110 assert_true( | 110 assert_true( |
111 obj1.synced && obj2.synced, | 111 obj1.synced && obj2.synced, |
112 'state should be "activated" after all waitUntil promises ' + | 112 'state should be "activated" after all waitUntil promises ' + |
113 'for "onactivate" are fulfilled.'); | 113 'for "onactivate" are fulfilled.'); |
114 service_worker_unregister_and_done(t, scope); | 114 service_worker_unregister_and_done(t, scope); |
115 }) | 115 }) |
116 .catch(unreached_rejection(t)); | 116 .catch(unreached_rejection(t)); |
117 }; | 117 }; |
118 runTest(t, scope, onRegister); | 118 runTest(t, scope, onRegister); |
119 }, 'Test InstallPhaseEvent multiple waitUntil fulfilled.', properties); | 119 }, 'Test ExtendableEvent multiple waitUntil fulfilled.', properties); |
120 | 120 |
121 async_test(function(t) { | 121 async_test(function(t) { |
122 var scope = 'activate-reject-precedence'; | 122 var scope = 'activate-reject-precedence'; |
123 var onRegister = function(worker) { | 123 var onRegister = function(worker) { |
124 wait_for_state(t, worker, 'redundant') | 124 wait_for_state(t, worker, 'redundant') |
125 .then(function() { | 125 .then(function() { |
126 service_worker_unregister_and_done(t, scope); | 126 service_worker_unregister_and_done(t, scope); |
127 }) | 127 }) |
128 .catch(unreached_rejection(t)); | 128 .catch(unreached_rejection(t)); |
129 }; | 129 }; |
130 runTest(t, scope, onRegister); | 130 runTest(t, scope, onRegister); |
131 }, 'Test InstallPhaseEvent waitUntil reject precedence.', properties); | 131 }, 'Test ExtendableEvent waitUntil reject precedence.', properties); |
132 </script> | 132 </script> |
OLD | NEW |