2 <title>Service Worker: registration stress test
</title>
3 <script src=
"../../resources/testharness.js"></script>
4 <script src=
"../../resources/testharnessreport.js"></script>
5 <script src=
"../resources/test-helpers.js"></script>
9 async_test(function(t
) {
10 var step
= t
.step_func
.bind(t
);
11 var url
= '../resources/empty-worker.js';
14 var number_of_registrations
= 50;
15 var register_promises
= [];
17 for (var i
= 0; i
< number_of_registrations
; i
++) {
18 var scope
= base_path() + '../resources/registration-stress' + i
;
19 register_promises
.push(with_iframe(scope
)
20 .then(step(function(f
) {
22 return service_worker_unregister_and_register(t
, url
, scope
);
26 Promise
.all(register_promises
)
27 .then(step(function(registrations
) {
28 var unregister_promises
= [];
29 for (var i
= 0; i
< number_of_registrations
; i
++) {
31 unregister_promises
.push(registrations
[i
].unregister());
33 return Promise
.all(unregister_promises
);
35 .then(step(function() { t
.done(); }))
36 .catch(unreached_rejection(t
));
37 }, 'Registration: stress test');