| Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html
|
| index 61a8a2dfba6db07c3e7c9bf7f93ddae77365578d..82db1920d86ac8be8453caa4023f5ee6edefd8b0 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/update.html
|
| @@ -9,7 +9,6 @@ promise_test(function(t) {
|
| var worker_url = 'resources/update-worker.php';
|
| var expected_url = normalizeURL(worker_url);
|
| var registration;
|
| -
|
| return service_worker_unregister_and_register(t, worker_url, scope)
|
| .then(function(r) {
|
| registration = r;
|
| @@ -69,7 +68,52 @@ promise_test(function(t) {
|
| '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);
|
| +
|
| + // A new worker(generated by update-worker.py) should be found.
|
| + // The returned promise should reject as update-worker.py returns
|
| + // a worker script with a syntax error.
|
| + return registration.update();
|
| + })
|
| + .then(
|
| + function() { assert_unreached("update() should reject."); },
|
| + function(e) {
|
| + assert_throws({name: 'TypeError'}, function () { throw e; },
|
| + 'A script syntax error should make update() ' +
|
| + 'promise reject with a TypeError.');
|
| + assert_equals(registration.active.scriptURL, expected_url,
|
| + 'active should still exist after update failure.');
|
| +
|
| + // A new worker(generated by update-worker.py) should be found.
|
| + // The returned promise should not reject, even though
|
| + // update-worker.py returns a worker script that throws in the
|
| + // install event handler.
|
| + return Promise.all([registration.update(),
|
| + wait_for_update(t, registration)]);
|
| + })
|
| + .then(function() {
|
| + assert_equals(registration.installing.scriptURL, expected_url,
|
| + 'installing should be set after update resolves (throw-install).');
|
| + assert_equals(registration.waiting, null,
|
| + 'waiting should still be null after update resolves (throw-install).');
|
| + assert_equals(registration.active.scriptURL, expected_url,
|
| + 'active should still exist after update found (throw-install).');
|
| +
|
| + // We need to hold a client alive so that unregister() below doesn't
|
| + // remove the registration before update() has had a chance to look
|
| + // at the pending uninstall flag.
|
| + return with_iframe(scope);
|
| + })
|
| + .then(function(frame) {
|
| + return Promise.all([registration.unregister(),
|
| + registration.update()]);
|
| + })
|
| + .then(
|
| + function() { assert_unreached("update() should reject."); },
|
| + function(e) {
|
| + assert_throws({name: 'TypeError'}, function () { throw e; },
|
| + 'Calling update() while the uninstalling flag is ' +
|
| + 'set should return a promise that rejects with an ' +
|
| + 'TypeError.');
|
| });
|
| }, 'Update a registration.');
|
| </script>
|
|
|