Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e6eace2065a92f50e4d27f3ac8f56e19e11d1cfe |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html |
| @@ -0,0 +1,37 @@ |
| +<!DOCTYPE html> |
| +<meta charset="utf-8"> |
| +<title>Navigation Preload request must abort when the page load finished</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../resources/test-helpers.js"></script> |
| +<script> |
| +promise_test(t => { |
| + var script = 'resources/abort-when-responded-worker.js'; |
| + var scope = 'resources/abort-when-responded-scope.php'; |
| + var worker; |
| + return service_worker_unregister_and_register(t, script, scope) |
| + .then(registration => { |
| + add_completion_callback(_ => registration.unregister()); |
| + worker = registration.installing; |
| + return wait_for_state(t, worker, 'activated'); |
| + }) |
| + .then(_ => with_iframe(scope)) |
| + .then(frame => { |
| + assert_equals(frame.contentDocument.body.textContent, 'OK'); |
| + }) |
| + .then(_ => { |
| + var saw_message = new Promise(resolve => { |
| + navigator.serviceWorker.onmessage = |
| + e => { resolve(e.data); }; |
| + }); |
| + worker.postMessage(''); |
| + return saw_message; |
| + }) |
| + .then(txt => { |
| + assert_equals( |
| + txt, |
| + 'REJECTED: NetworkError: Service Worker navigation preload ' + |
| + 'network error.'); |
|
falken
2017/01/19 01:27:37
Testing the error string isn't right for an WPT te
|
| + }); |
| + }, 'Navigation Preload request must abort when the page load finished.'); |
| +</script> |