ServiceWorker: Tweak the repetitive registrations test
The "register-50-times" test case added in
https://codereview.chromium.org/851233003/ made the test slow (timeout
sometimes). This patch moves the test case to its own file, and reduces
the number of registration to 30. Also marks the new test as Slow.
BUG=448670
Review URL: https://codereview.chromium.org/872313002
git-svn-id: svn://svn.chromium.org/blink/trunk@188942 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/LayoutTests/SlowTests b/third_party/WebKit/LayoutTests/SlowTests
index a52a8fd..89fd8c0 100644
--- a/third_party/WebKit/LayoutTests/SlowTests
+++ b/third_party/WebKit/LayoutTests/SlowTests
@@ -178,3 +178,4 @@
crbug.com/372424 fast/dom/DOMImplementation/createDocument-with-used-doctype.html [ Slow ]
crbug.com/372424 http/tests/serviceworker/chromium/registration-stress.html [ Slow ]
+crbug.com/448670 http/tests/serviceworker/chromium/register-different-script-many-times.html [ Slow ]
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/register-different-script-many-times.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/register-different-script-many-times.html
new file mode 100644
index 0000000..35fe076f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/register-different-script-many-times.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../resources/test-helpers.js"></script>
+<script>
+var script1 = normalizeURL('../resources/empty-worker.js');
+var script2 = normalizeURL('../resources/empty-worker.js?new');
+
+promise_test(function(t) {
+ var scope = '../resources/scope/register-30-times';
+
+ return service_worker_unregister(t, scope)
+ .then(function() {
+ var promises = [];
+ for (var i = 0; i < 15; ++i) {
+ promises.push(navigator.serviceWorker.register(script1,
+ { scope: scope }));
+ promises.push(navigator.serviceWorker.register(script2,
+ { scope: scope }));
+ }
+ return Promise.all(promises);
+ })
+ .then(function(registrations) {
+ return registrations[0].unregister();
+ });
+ }, 'Repetitive registrations with the same scope should not trigger OOM');
+
+</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/register-same-scope-different-script-url.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/register-same-scope-different-script-url.html
index a86742c8a..50aa0480 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/register-same-scope-different-script-url.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/register-same-scope-different-script-url.html
@@ -230,24 +230,4 @@
.catch(unreached_rejection(t));
}, 'Register same-scope new script url effect on controller');
-async_test(function(t) {
- var scope = 'resources/scope/register-50-times';
-
- service_worker_unregister(t, scope)
- .then(function() {
- var promises = [];
- for (var i = 0; i < 25; ++i) {
- promises.push(navigator.serviceWorker.register(script1,
- { scope: scope }));
- promises.push(navigator.serviceWorker.register(script2,
- { scope: scope }));
- }
- return Promise.all(promises);
- })
- .then(function(registrations) {
- return registrations[0].unregister();
- })
- .then(function() { t.done(); })
- .catch(unreached_rejection(t));
-}, 'Repetitive registrations with the same scope should not trigger OOM');
</script>