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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/registration-stress.html
diff --git a/LayoutTests/http/tests/serviceworker/registration-stress.html b/LayoutTests/http/tests/serviceworker/registration-stress.html
new file mode 100644
index 0000000000000000000000000000000000000000..6269e3a0c54befce24236d7b98edbeb0b6c6dee8
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/registration-stress.html
@@ -0,0 +1,38 @@
+<!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.
+<title>ServiceWorker: registration stress test</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.js"></script>
+<body>
+<script>
+async_test(function(t) {
+ 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.
+ var url = 'resources/worker-no-op.js';
+ var frames = [];
+
+ var number_of_workers = 50;
+ var register_promises = [];
+
+ for (var i = 0; i < number_of_workers; i++) {
+ var scope = i;
+ register_promises.push(with_iframe(scope)
+ .then(step(function(f) {
+ frames.push(f);
+ return navigator.serviceWorker.register(url, {scope: scope});
+ })));
+ }
+
+ Promise.all(register_promises)
+ .then(step(function(workers) {
+ var unregister_promises = [];
+ for (var i = 0; i < number_of_workers; i++) {
+ frames[i].remove();
+ 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.
+ 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
+ }
+ return Promise.all(unregister_promises);
+ }))
+ .then(step(function() { t.done(); }))
+ .catch(unreached_rejection(t));
+ }, 'Registration: stress test');
+</script>
« 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