Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/navigation-preload/abort-when-responded.html

Issue 2645493002: Increase the lifetime of Navigation Preload related objects. (Closed)
Patch Set: send abort error and fix flaky test and add abort-when-responded layouttest Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698