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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/multiple-register.html

Issue 2865313003: Upstream service worker tests to WPT (Closed)
Patch Set: Re-introduce resource script Created 3 years, 7 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
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/multiple-register.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/multiple-register.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/multiple-register.html
deleted file mode 100644
index f6fa22909e81627422858c71af52f77ad05ac4ff..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/multiple-register.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
-<script>
-var worker_url = 'resources/empty-worker.js';
-
-async_test(function(t) {
- var scope = 'resources/scope/subsequent-register-from-same-window';
- var registration;
-
- service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, r.installing, 'activated');
- })
- .then(function() {
- return navigator.serviceWorker.register(worker_url, { scope: scope });
- })
- .then(function(new_registration) {
- assert_equals(new_registration, registration,
- 'register should resolve to the same registration');
- assert_equals(new_registration.active, registration.active,
- 'register should resolve to the same worker');
- assert_equals(new_registration.active.state, 'activated',
- 'the worker should be in state "activated"');
- return registration.unregister();
- })
- .then(function() { t.done(); })
- .catch(unreached_rejection(t));
-}, 'Subsequent registrations resolve to the same registration object');
-
-async_test(function(t) {
- var scope = 'resources/scope/subsequent-register-from-different-iframe';
- var frame;
- var registration;
-
- service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, r.installing, 'activated');
- })
- .then(function() { return with_iframe('out-of-scope'); })
- .then(function(f) {
- frame = f;
- return frame.contentWindow.navigator.serviceWorker.register(
- worker_url, { scope: scope });
- })
- .then(function(new_registration) {
- assert_not_equals(
- registration, new_registration,
- 'register should resolve to a different registration');
- assert_equals(
- registration.scope, new_registration.scope,
- 'registrations should have the same scope');
-
- assert_equals(
- registration.installing, null,
- 'installing worker should be null');
- assert_equals(
- new_registration.installing, null,
- 'installing worker should be null');
- assert_equals(
- registration.waiting, null,
- 'waiting worker should be null')
- assert_equals(
- new_registration.waiting, null,
- 'waiting worker should be null')
-
- assert_not_equals(
- registration.active, new_registration.active,
- 'registration should have a different active worker');
- assert_equals(
- registration.active.scriptURL,
- new_registration.active.scriptURL,
- 'active workers should have the same script URL');
- assert_equals(
- registration.active.state,
- new_registration.active.state,
- 'active workers should be in the same state');
-
- frame.remove();
- return registration.unregister();
- })
- .then(function() { t.done(); })
- .catch(unreached_rejection(t));
-}, 'Subsequent registrations from a different iframe resolve to the ' +
- 'different registration object but they refer to the same ' +
- 'registration and workers');
-
-async_test(function(t) {
- var scope = 'resources/scope/concurrent-register';
- var number_of_registrations = 10;
-
- service_worker_unregister(t, scope)
- .then(function() {
- var promises = [];
- for (var i = 0; i < number_of_registrations; ++i) {
- promises.push(navigator.serviceWorker.register(worker_url,
- { scope: scope }));
- }
- return Promise.all(promises);
- })
- .then(function(registrations) {
- registrations.forEach(function(registration) {
- assert_equals(registration, registrations[0],
- 'register should resolve to the same registration');
- });
- return registrations[0].unregister();
- })
- .then(function() { t.done(); })
- .catch(unreached_rejection(t));
-}, 'Concurrent registrations resolve to the same registration object');
-
-</script>

Powered by Google App Engine
This is Rietveld 408576698