Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html |
| diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html |
| index a0dea5428db141c6c70688b705ebe60c85d0a54d..8fd566dadc62a78ef0836bbc63000473f884d7c7 100644 |
| --- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html |
| +++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-service-worker-attributes.https.html |
| @@ -3,14 +3,21 @@ |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="resources/test-helpers.sub.js"></script> |
| <script> |
| -async_test(function(t) { |
| +'use strict'; |
|
falken
2017/05/18 02:26:13
Are we going to add this to all the tests from now
|
| +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 newest_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) { |
| + t.add_cleanup(function() { |
| + r.unregister(); |
| + }); |
| registration = r; |
| + newest_worker = registration.installing; |
| assert_equals(registration.installing.scriptURL, expected_url, |
| 'installing before updatefound'); |
| assert_equals(registration.waiting, null, |
| @@ -19,8 +26,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, newest_worker, |
| 'installing after updatefound'); |
| assert_equals(registration.waiting, null, |
| 'waiting after updatefound'); |
| @@ -31,22 +38,19 @@ async_test(function(t) { |
| .then(function() { |
| assert_equals(registration.installing, null, |
| 'installing after installed'); |
| - var newest = registration.waiting || registration.active; |
| - assert_equals(newest.scriptURL, expected_url, |
| - 'waiting or active after installed'); |
| - if (registration.waiting) { |
| - return wait_for_state(t, registration.waiting, 'activated') |
| - .then(function() { |
| - assert_equals(registration.installing, null, |
| - 'installing after activated'); |
| - assert_equals(registration.waiting, null, |
| - 'waiting after activated'); |
| - assert_equals(registration.active.scriptURL, expected_url, |
| - 'active after activated'); |
| - }); |
| - } |
| + assert_equals(registration.waiting, newest_worker, |
| + 'waiting after installed'); |
| + assert_equals(registration.active, null, |
| + 'active after installed'); |
| + return wait_for_state(t, registration.waiting, 'activated'); |
| }) |
| .then(function() { |
| + assert_equals(registration.installing, null, |
| + 'installing after activated'); |
| + assert_equals(registration.waiting, null, |
| + 'waiting after activated'); |
| + assert_equals(registration.active, newest_worker, |
| + 'active after activated'); |
| return Promise.all([ |
| wait_for_state(t, registration.active, 'redundant'), |
| registration.unregister() |
| @@ -63,8 +67,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> |