Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/update.html |
| diff --git a/LayoutTests/http/tests/serviceworker/update.html b/LayoutTests/http/tests/serviceworker/update.html |
| index 9eb392a9898336b51f14b1d476611b9d50b2046c..8537c3d20eec69dc7aaae7ef98e3a20695a9f60b 100644 |
| --- a/LayoutTests/http/tests/serviceworker/update.html |
| +++ b/LayoutTests/http/tests/serviceworker/update.html |
| @@ -17,42 +17,59 @@ promise_test(function(t) { |
| }) |
| .then(function() { |
| assert_equals(registration.installing, null, |
| - 'installing should be null in the initial state'); |
| + 'installing should be null in the initial state.'); |
| assert_equals(registration.waiting, null, |
| - 'waiting should be null in the initial state'); |
| + 'waiting should be null in the initial state.'); |
| assert_equals(registration.active.scriptURL, expected_url, |
| - 'active should exist in the initial state'); |
| + 'active should exist in the initial state.'); |
| - // A new worker should be found. |
| - registration.update(); |
| - return wait_for_update(t, registration); |
| + // A new worker (generated by update-worker.php) should be found. |
| + // The returned promise should resolve when a new worker script is |
| + // fetched and starts installing. |
| + return registration.update(); |
|
nhiroki
2015/08/10 02:32:42
To make sure that the updatefound event is correct
jungkees
2015/08/10 03:20:41
Addressed.
|
| }) |
| .then(function() { |
| assert_equals(registration.installing.scriptURL, expected_url, |
| - 'new installing should be set after updatefound'); |
| + 'new installing should be set after update resolves.'); |
| assert_equals(registration.waiting, null, |
| - 'waiting should still be null after updatefound'); |
| + 'waiting should still be null after update resolves.'); |
| assert_equals(registration.active.scriptURL, expected_url, |
| - 'active should still exist after update found'); |
| + 'active should still exist after update found.'); |
| return wait_for_state(t, registration.installing, 'installed'); |
| }) |
| .then(function() { |
| assert_equals(registration.installing, null, |
| - 'installing should be null after installing'); |
| + 'installing should be null after installing.'); |
| assert_equals(registration.waiting.scriptURL, expected_url, |
| - 'waiting should be set after installing'); |
| + 'waiting should be set after installing.'); |
| assert_equals(registration.active.scriptURL, expected_url, |
| - 'active should still exist after installing'); |
| + 'active should still exist after installing.'); |
| return wait_for_state(t, registration.waiting, 'activated'); |
| }) |
| .then(function() { |
| assert_equals(registration.installing, null, |
| - 'installing should be null after activated'); |
| + 'installing should be null after activated.'); |
| assert_equals(registration.waiting, null, |
| - 'waiting should be null after activated'); |
| + 'waiting should be null after activated.'); |
| assert_equals(registration.active.scriptURL, expected_url, |
| - 'new worker should be promoted to active'); |
| + 'new worker should be promoted to active.'); |
| + }) |
| + .then(function() { |
| + // A new worker(generated by update-worker.php) should be found. |
| + // The returned promise should reject as update-worker.php sets the |
| + // mimetype to a disallowed value for this attempt. |
| + return registration.update(); |
| + }) |
| + .then( |
| + function() { assert_unreached("update() should reject."); }, |
| + function(e) { |
| + assert_throws('SecurityError', function() { throw e; }, |
| + 'Using a disallowed mimetype should make update() ' + |
| + 'promise reject with a SecurityError.'); |
| + assert_equals(registration.active.scriptURL, expected_url, |
| + 'active should still exist after update failure.'); |
| return service_worker_unregister_and_done(t, scope); |
| }) |
| - }, 'Update a registration'); |
| + .catch(unreached_rejection(t));; |
|
nhiroki
2015/08/10 02:32:42
promise_test() does not have to have a 'catch' blo
jungkees
2015/08/10 03:20:41
Removed it. Thanks.
|
| + }, 'Update a registration.'); |
| </script> |