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

Side by Side Diff: LayoutTests/http/tests/serviceworker/activation-after-registration.html

Issue 247263010: ServiceWorker: Wait for registration promise to resolve before changing states. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: yhirano comments Created 6 years, 8 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Service Worker: Activation occurs after registration</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/testutils.js"></script>
6 <body>
7 <script>
8 var t = async_test('activation occurs after registration');
9 t.step(function() {
10 var scope = 'resources/blank.html';
11 navigator.serviceWorker.unregister(scope).then(doTest, doTest);
12 function doTest() {
13 navigator.serviceWorker.register(
14 'resources/worker-no-op.js', {scope: scope}
15 ).then(t.step_func(onRegister), t.step_func(function(reason) {
16 assert_unreached('Registration should succeed, but failed: ' + reaso n.name);
17 }));
18 }
19
20 function onRegister(worker) {
21 assert_equals(worker.state, 'parsed', 'worker should be in the "parsed" state upon registration');
22 worker.addEventListener('statechange', t.step_func(function(event) {
23 if (event.target.state == 'active')
24 t.done();
25 }));
26 }
27 });
28 </script>
29 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698