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

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

Issue 1311103002: ServiceWorker: Make APIs that return ServiceWorkerRegistration coin a new JS object (3/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address review comments Created 5 years, 4 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: LayoutTests/http/tests/serviceworker/multiple-register.html
diff --git a/LayoutTests/http/tests/serviceworker/multiple-register.html b/LayoutTests/http/tests/serviceworker/multiple-register.html
index aa213a104270ae75fe610eab19b8fa278e5c8c9e..ea1095f28e227c7cf0df1bd7c1652abef3ceda26 100644
--- a/LayoutTests/http/tests/serviceworker/multiple-register.html
+++ b/LayoutTests/http/tests/serviceworker/multiple-register.html
@@ -18,8 +18,10 @@ async_test(function(t) {
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_registration_equals(new_registration, registration);
+ assert_not_equals(
+ new_registration, registration,
+ 'register should resolve to a new registration object');
assert_equals(new_registration.active, registration.active,
'register should resolve to the same worker');
assert_equals(new_registration.active.state, 'activated',
@@ -28,7 +30,8 @@ async_test(function(t) {
})
.then(function() { t.done(); })
.catch(unreached_rejection(t));
-}, 'Subsequent registrations resolve to the same registration object');
+}, 'Subsequent registrations resolve to a different registration object ' +
+ 'but they refer to the same registration and workers');
async_test(function(t) {
var scope = 'resources/scope/subsequent-register-from-different-iframe';
@@ -49,7 +52,7 @@ async_test(function(t) {
.then(function(new_registration) {
assert_not_equals(
registration, new_registration,
- 'register should resolve to the different registration');
+ 'register should resolve to a different registration');
assert_equals(
registration.scope, new_registration.scope,
'registrations should have the same scope');
@@ -69,7 +72,7 @@ async_test(function(t) {
assert_not_equals(
registration.active, new_registration.active,
- 'registration should have the different active worker');
+ 'registration should have a different active worker');
assert_equals(
registration.active.scriptURL,
new_registration.active.scriptURL,
@@ -90,25 +93,31 @@ async_test(function(t) {
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 < 10; ++i) {
+ 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) {
+ for (var i = 1; i < number_of_registrations; ++i) {
+ assert_registration_equals(registrations[i], registrations[0]);
+ assert_not_equals(
+ registrations[i], registrations[0],
+ 'register should resolve to a new registration object');
+ }
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');
+}, 'Concurrent registrations resolve to a different registration object ' +
+ 'but they refer to the same registration and workers');
</script>

Powered by Google App Engine
This is Rietveld 408576698