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

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

Issue 324893002: Add tests for navigator.serviceWorker.waiting. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Put the expected result file at the right path. Created 6 years, 6 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>ServiceWorker: navigator.serviceWorker.waiting</title>
3 <script src="../resources/testharness.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <body>
7 <script>
8 // "waiting" is set
9 async_test(function(t) {
10 var step = t.step_func.bind(t);
11 var url = 'resources/worker-no-op.js';
12 var scope = 'resources/blank.html';
13 var frame;
14
15 navigator.serviceWorker.unregister(scope)
16 .then(step(function() { return with_iframe(scope); }),
17 unreached_rejection(t, 'Unregister should not fail'))
18 .then(step(function(f) {
19 frame = f;
20 return navigator.serviceWorker.register(url, {scope: scope});
21 }))
22 .then(step(function(serviceWorker) {
23 // FIXME: Replace this with .ready when that supports the in-waiting
24 // Service Worker.
25 return new Promise(step(function(resolve, reject) {
26 serviceWorker.onstatechange = step(function() {
27 if (serviceWorker.state == 'installed') {
28 resolve();
29 }
30 });
31 }));
32 }), unreached_rejection(t, 'Registration should not fail'))
33 .then(step(function() {
34 var container = frame.contentWindow.navigator.serviceWorker;
35 assert_equals(container.controller, null);
36 assert_equals(container.waiting.url, normalizeURL(url));
37
38 // FIXME: Add a test for a frame created after installation.
39 // Should the existing frame ("frame") block activation?
40 }))
41 .then(step(function() {
42 frame.remove();
43 return service_worker_unregister_and_done(t, scope);
44 }));
45 }, 'waiting is set');
46 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698