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

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

Issue 394133002: ServiceWorker: Add stress test for registration (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
dominicc (has gone to gerrit) 2014/07/16 04:16:04 Let's move this to chromium/ because stress is kin
nhiroki 2014/07/16 06:54:51 Done.
2 <title>ServiceWorker: 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>
6 <body>
7 <script>
8 async_test(function(t) {
9 var step = t.step_func.bind(t);
dominicc (has gone to gerrit) 2014/07/16 04:16:04 Let's indent two spaces, like this: async_test(fu
nhiroki 2014/07/16 04:29:49 Hmmm... your example (and wiki's examples) has 4-s
nhiroki 2014/07/16 04:42:28 Ah, maybe I got what you mean. I should fix indent
nhiroki 2014/07/16 06:54:51 Done.
10 var url = 'resources/worker-no-op.js';
11 var frames = [];
12
13 var number_of_workers = 50;
14 var register_promises = [];
15
16 for (var i = 0; i < number_of_workers; i++) {
17 var scope = i;
18 register_promises.push(with_iframe(scope)
19 .then(step(function(f) {
20 frames.push(f);
21 return navigator.serviceWorker.register(url, {scope: scope});
22 })));
23 }
24
25 Promise.all(register_promises)
26 .then(step(function(workers) {
27 var unregister_promises = [];
28 for (var i = 0; i < number_of_workers; i++) {
29 frames[i].remove();
30 unregister_promises.push(
dominicc (has gone to gerrit) 2014/07/16 04:16:04 I wonder if you should unregister them all first a
nhiroki 2014/07/16 06:54:51 Done.
31 navigator.serviceWorker.unregister(workers[i].scope));
dominicc (has gone to gerrit) 2014/07/16 04:16:04 I wonder if you should unregister them all first a
32 }
33 return Promise.all(unregister_promises);
34 }))
35 .then(step(function() { t.done(); }))
36 .catch(unreached_rejection(t));
37 }, 'Registration: stress test');
38 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698