Index: LayoutTests/http/tests/serviceworker/fetch-event-network-error.html |
diff --git a/LayoutTests/http/tests/serviceworker/fetch-event-network-error.html b/LayoutTests/http/tests/serviceworker/fetch-event-network-error.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4f43ad839756a272a1fb50f69fb98f1ea8d1456c |
--- /dev/null |
+++ b/LayoutTests/http/tests/serviceworker/fetch-event-network-error.html |
@@ -0,0 +1,42 @@ |
+<!DOCTYPE html> |
+<title>Service Worker: Fetch event network error</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharness-helpers.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="resources/test-helpers.js"></script> |
+<script> |
+var resolve_test_done; |
+ |
+var test_done_promise = new Promise(function(resolve) { |
+ resolve_test_done = resolve; |
+ }); |
+ |
+// Called by the child frame. |
+function notify_test_done(result) { |
+ resolve_test_done(result); |
+} |
+ |
+promise_test(function(t) { |
+ var scope = 'resources/fetch-event-network-error-controllee-iframe.html'; |
+ var script = 'resources/fetch-event-network-error-worker.js'; |
+ var frame; |
+ |
+ return service_worker_unregister_and_register(t, script, scope) |
+ .then(function(registration) { |
+ return wait_for_activated(t, registration); |
+ }) |
+ .then(function() { |
+ return with_iframe(scope); |
+ }) |
+ .then(function(f) { |
+ frame = f; |
+ return test_done_promise; |
+ }) |
+ .then(function(result) { |
+ frame.remove(); |
+ assert_equals(result, 'PASS'); |
+ return service_worker_unregister_and_done(t, scope); |
+ }); |
+ }, 'Rejecting the fetch event or using preventDefault() causes a network ' + |
+ 'error'); |
+</script> |