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

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/registration-stress.html

Issue 466723002: ServiceWorker: Enable ServiceWorkerRegistration and update layout tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@updatefound
Patch Set: apply horo@'s patch (PatchSet 25 on https://codereview.chromium.org/468753003/) Created 6 years, 4 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 <title>Service Worker: registration stress test</title> 2 <title>Service Worker: registration stress test</title>
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../resources/test-helpers.js"></script> 5 <script src="../resources/test-helpers.js"></script>
6 <body> 6 <body>
7 <script> 7 <script>
8 8
9 async_test(function(t) { 9 async_test(function(t) {
10 var step = t.step_func.bind(t); 10 var step = t.step_func.bind(t);
11 var url = '../resources/worker-no-op.js'; 11 var url = '../resources/worker-no-op.js';
12 var frames = []; 12 var frames = [];
13 13
14 var number_of_workers = 50; 14 var number_of_workers = 50;
15 var register_promises = []; 15 var register_promises = [];
16 16
17 for (var i = 0; i < number_of_workers; i++) { 17 for (var i = 0; i < number_of_workers; i++) {
18 var scope = i; 18 var scope = i;
19 register_promises.push(with_iframe(scope) 19 register_promises.push(with_iframe(scope)
20 .then(step(function(f) { 20 .then(step(function(f) {
21 frames.push(f); 21 frames.push(f);
22 return service_worker_unregister_and_register(t, url, scope); 22 return service_worker_unregister_and_register(t, url, scope);
23 }))); 23 })));
24 } 24 }
25 25
26 Promise.all(register_promises) 26 Promise.all(register_promises)
27 .then(step(function(workers) { 27 .then(step(function(registrations) {
28 var unregister_promises = []; 28 var unregister_promises = [];
29 for (var i = 0; i < number_of_workers; i++) { 29 for (var i = 0; i < number_of_workers; i++) {
30 var scope = i; 30 var scope = i;
31 frames[i].remove(); 31 frames[i].remove();
32 unregister_promises.push( 32 unregister_promises.push(
33 navigator.serviceWorker.unregister(scope)); 33 navigator.serviceWorker.unregister(scope));
34 } 34 }
35 return Promise.all(unregister_promises); 35 return Promise.all(unregister_promises);
36 })) 36 }))
37 .then(step(function() { t.done(); })) 37 .then(step(function() {
38 gc();
falken 2014/08/14 04:46:11 Can you add a comment explaining why we're calling
horo 2014/08/14 07:11:46 removed
39 t.done();
40 }))
38 .catch(unreached_rejection(t)); 41 .catch(unreached_rejection(t));
39 }, 'Registration: stress test'); 42 }, 'Registration: stress test');
40 43
41 </script> 44 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698