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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/install-event-type.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
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/testharness-helpers.js"></script>
4 <script src="resources/test-helpers.js"></script> 4 <script src="/resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.sub.js"></script>
5 <script> 6 <script>
6 function wait_for_install_event(worker) { 7 function wait_for_install_event(worker) {
7 return new Promise(function(resolve) { 8 return new Promise(function(resolve) {
8 worker.addEventListener('statechange', function(event) { 9 worker.addEventListener('statechange', function(event) {
9 if (worker.state == 'installed') 10 if (worker.state == 'installed')
10 resolve(true); 11 resolve(true);
11 else if (worker.state == 'redundant') 12 else if (worker.state == 'redundant')
12 resolve(false); 13 resolve(false);
13 }); 14 });
14 }); 15 });
15 } 16 }
16 17
17 promise_test(function(t) { 18 promise_test(function(t) {
18 var script = 'resources/install-event-type-worker.js'; 19 var script = 'resources/install-event-type-worker.js';
19 var scope = 'resources/install-event-type'; 20 var scope = 'resources/install-event-type';
20 return service_worker_unregister_and_register(t, script, scope) 21 return service_worker_unregister_and_register(t, script, scope)
21 .then(function(registration) { 22 .then(function(registration) {
22 return wait_for_install_event(registration.installing); 23 return wait_for_install_event(registration.installing);
23 }) 24 })
24 .then(function(did_install) { 25 .then(function(did_install) {
25 assert_true(did_install, 'The worker was installed'); 26 assert_true(did_install, 'The worker was installed');
26 }) 27 })
27 }, 'install event type'); 28 }, 'install event type');
28 29
29 </script> 30 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698