Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Side by Side Diff: LayoutTests/http/tests/serviceworker/state.html

Issue 354953002: Promisify Service Worker test unregister_and_register helper function (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: patch for landing Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/serviceworker/serviceworkerobject-scope.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="resources/test-helpers.js"></script> 4 <script src="resources/test-helpers.js"></script>
5 <body> 5 <body>
6 <script> 6 <script>
7 (function () { 7 (function () {
8 var t = async_test('Service Worker state property and "statechange" event'); 8 var t = async_test('Service Worker state property and "statechange" event');
9 var currentState = 'test-is-starting'; 9 var currentState = 'test-is-starting';
10 var scope = '/state/*'; 10 var scope = '/state/*';
11 11
12 service_worker_unregister_and_register( 12 service_worker_unregister_and_register(t, 'resources/worker-no-op.js', scope ).then(t.step_func(onRegister));
13 t, 'resources/worker-no-op.js', scope, onRegister);
14 13
15 function onRegister(sw) { 14 function onRegister(sw) {
16 sw.addEventListener('statechange', t.step_func(onStateChange(sw))); 15 sw.addEventListener('statechange', t.step_func(onStateChange(sw)));
17 assert_in_array(sw.state, ['parsed', 'installing'], 16 assert_in_array(sw.state, ['parsed', 'installing'],
18 'the service worker should be in a state up to ' + 17 'the service worker should be in a state up to ' +
19 '"installing".'); 18 '"installing".');
20 checkStateTransition(sw.state); 19 checkStateTransition(sw.state);
21 } 20 }
22 21
23 function checkStateTransition(newState) { 22 function checkStateTransition(newState) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 'the type of the event should be "statechange".'); 62 'the type of the event should be "statechange".');
64 63
65 checkStateTransition(event.target.state); 64 checkStateTransition(event.target.state);
66 65
67 if (event.target.state == 'active') 66 if (event.target.state == 'active')
68 service_worker_unregister_and_done(t, scope); 67 service_worker_unregister_and_done(t, scope);
69 }; 68 };
70 } 69 }
71 }()); 70 }());
72 </script> 71 </script>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/serviceworkerobject-scope.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698