| Index: LayoutTests/http/tests/serviceworker/fetch-request-redirect.html
|
| diff --git a/LayoutTests/http/tests/serviceworker/fetch-request-redirect.html b/LayoutTests/http/tests/serviceworker/fetch-request-redirect.html
|
| index 341f1ccee1745030849b20d199d302e257ce9208..9af3a6e243247ab0ba8ea91696c751a876b55743 100644
|
| --- a/LayoutTests/http/tests/serviceworker/fetch-request-redirect.html
|
| +++ b/LayoutTests/http/tests/serviceworker/fetch-request-redirect.html
|
| @@ -7,37 +7,33 @@
|
| <script>
|
|
|
| function assert_resolves(promise, description) {
|
| - return promise.catch(function() { throw description; });
|
| + return promise.catch(function(reason) {
|
| + throw new Error(description + ' - ' + reason.message);
|
| + });
|
| }
|
|
|
| function assert_rejects(promise, description) {
|
| return promise.then(
|
| - function() { throw description; },
|
| + function() { throw new Error(description); },
|
| function() {});
|
| }
|
|
|
| function iframe_test(url) {
|
| return new Promise(function(resolve, reject) {
|
| var frame = document.createElement('iframe');
|
| - // We can't catch the network error on iframe. So we use the timer.
|
| - var timer = setTimeout(function() {
|
| - reject();
|
| - frame.remove();
|
| - }, 500);
|
| frame.src = url;
|
| frame.onload = function() {
|
| - clearTimeout(timer);
|
| if (frame.contentDocument.body.textContent == 'Hello world\n')
|
| resolve();
|
| else
|
| - reject();
|
| + reject(new Error('content mismatch'));
|
| frame.remove();
|
| };
|
| document.body.appendChild(frame);
|
| });
|
| }
|
|
|
| -async_test(function(t) {
|
| +promise_test(function(t) {
|
| var SCOPE = 'resources/fetch-request-redirect-iframe.html';
|
| var SCRIPT = 'resources/fetch-rewrite-worker.js';
|
| var host_info = get_host_info();
|
| @@ -58,7 +54,7 @@ async_test(function(t) {
|
|
|
| var worker;
|
| var frame;
|
| - service_worker_unregister_and_register(t, SCRIPT, SCOPE)
|
| + return service_worker_unregister_and_register(t, SCRIPT, SCOPE)
|
| .then(function(registration) {
|
| worker = registration.installing;
|
| return wait_for_state(t, worker, 'activated');
|
| @@ -150,6 +146,10 @@ async_test(function(t) {
|
| '&redirect-mode=follow'),
|
| 'Redirected iframe loading with Request.redirect=follow should'+
|
| ' succeed.'),
|
| +
|
| + /*
|
| + TODO(horo): iframe load failure detection is unreliable.
|
| + Rework these. crbug.com/522587
|
| assert_rejects(
|
| iframe_test(SCOPE + '?url=' +
|
| encodeURIComponent(REDIRECT_TO_HTML_URL) +
|
| @@ -162,12 +162,12 @@ async_test(function(t) {
|
| '&redirect-mode=manual'),
|
| 'Redirected iframe loading with Request.redirect=manual should'+
|
| ' succeed.'),
|
| + */
|
| ]);
|
| })
|
| .then(function() {
|
| frame.remove();
|
| service_worker_unregister_and_done(t, SCOPE);
|
| - })
|
| - .catch(unreached_rejection(t));
|
| + });
|
| }, 'Verify redirect mode of Fetch API and ServiceWorker FetchEvent.');
|
| </script>
|
|
|