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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html

Issue 1872243002: ServiceWorker: Check the equality of JS-level SW/SWR objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent and add add_completion_callback to reclaim the registration Created 4 years, 8 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 | third_party/WebKit/LayoutTests/http/tests/serviceworker/synced-state.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html
index dce8b1129d9969fc7eec09860fa75ecf84bb7728..2ee1784b80cc0b433fb63cb753c303ad9f60083a 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/registration-service-worker-attributes.html
@@ -3,14 +3,18 @@
<script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script>
<script>
-async_test(function(t) {
+promise_test(function(t) {
var scope = 'resources/scope/installing-waiting-active-after-registration';
var worker_url = 'resources/empty-worker.js';
var expected_url = normalizeURL(worker_url);
+ var installing_worker;
+ var registration;
- service_worker_unregister_and_register(t, worker_url, scope)
+ return service_worker_unregister_and_register(t, worker_url, scope)
.then(function(r) {
+ add_completion_callback(function() { r.unregister(); });
registration = r;
+ installing_worker = registration.installing;
assert_equals(registration.installing.scriptURL, expected_url,
'installing before updatefound');
assert_equals(registration.waiting, null,
@@ -19,8 +23,8 @@ async_test(function(t) {
'active before updatefound');
return wait_for_update(t, registration);
})
- .then(function(worker) {
- assert_equals(registration.installing.scriptURL, expected_url,
+ .then(function() {
+ assert_equals(registration.installing, installing_worker,
'installing after updatefound');
assert_equals(registration.waiting, null,
'waiting after updatefound');
@@ -31,7 +35,7 @@ async_test(function(t) {
.then(function() {
assert_equals(registration.installing, null,
'installing after installed');
- assert_equals(registration.waiting.scriptURL, expected_url,
+ assert_equals(registration.waiting, installing_worker,
'waiting after installed');
assert_equals(registration.active, null,
'active after installed');
@@ -42,7 +46,7 @@ async_test(function(t) {
'installing after activated');
assert_equals(registration.waiting, null,
'waiting after activated');
- assert_equals(registration.active.scriptURL, expected_url,
+ assert_equals(registration.active, installing_worker,
'active after activated');
return Promise.all([
wait_for_state(t, registration.active, 'redundant'),
@@ -60,8 +64,6 @@ async_test(function(t) {
// resolved, this will be gone.
assert_equals(registration.active, null,
'active should be null after redundant');
- t.done();
- })
- .catch(unreached_rejection(t));
+ });
}, 'installing/waiting/active after registration');
</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/synced-state.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698