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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/register-wait-forever-in-install-worker.https.html

Issue 2415873002: Import w3c tests for the service workers (Closed)
Patch Set: Rebase Created 4 years, 2 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Service Worker: Register wait-forever-in-install-worker</title>
3 <script src="/resources/testharness.js"></script>
4 <script src="resources/testharness-helpers.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="resources/test-helpers.sub.js"></script>
7 <script>
8
9 promise_test(function(t) {
10 var bad_script = 'resources/wait-forever-in-install-worker.js';
11 var good_script = 'resources/empty-worker.js';
12 var scope = 'resources/wait-forever-in-install-worker';
13 var other_scope = 'resources/wait-forever-in-install-worker-other';
14 var registration;
15 var registerPromise;
16
17 return navigator.serviceWorker.register(bad_script, {scope: scope})
18 .then(function(r) {
19 registration = r;
20 assert_equals(registration.installing.scriptURL,
21 normalizeURL(bad_script));
22
23 // This register job should not start until the first
24 // register for the same scope completes.
25 registerPromise =
26 navigator.serviceWorker.register(good_script, {scope: scope});
27
28 // In order to test that the above register does not complete
29 // we will perform a register() on a different scope. The
30 // assumption here is that the previous register call would
31 // have completed in the same timeframe if it was able to do
32 // so.
33 return navigator.serviceWorker.register(good_script,
34 {scope: other_scope});
35 })
36 .then(function(swr) {
37 return swr.unregister();
38 })
39 .then(function() {
40 assert_equals(registration.installing.scriptURL,
41 normalizeURL(bad_script));
42 registration.installing.postMessage('STOP_WAITING');
43 return registerPromise;
44 })
45 .then(function(swr) {
46 assert_equals(registration.installing.scriptURL,
47 normalizeURL(good_script));
48 return wait_for_state(t, registration.installing, 'activated');
49 })
50 .then(function() {
51 return service_worker_unregister_and_done(t, scope);
52 })
53 }, 'register worker that calls waitUntil with a promise that never ' +
54 'resolves in oninstall');
55
56 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698