Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/unregister-on-detached-iframe.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/unregister-on-detached-iframe.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/unregister-on-detached-iframe.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d79b0404958edfa28dbc1061c3944ed153ed143b |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/unregister-on-detached-iframe.html |
| @@ -0,0 +1,40 @@ |
| +<!DOCTYPE html> |
| +<meta charset="utf-8"> |
| +<title>Service Worker: Unregistration on detached iframe context</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../../resources/testharness-helpers.js"></script> |
| +<script src="../resources/test-helpers.js"></script> |
| +<script> |
| +promise_test(function(t) { |
| + var url = './resources/blank.html'; |
| + var scope_for_iframe = './unregister-on-detached-iframe' |
| + var scope_for_main = './resources/' + scope_for_iframe; |
| + var script = './resources/empty-worker.js'; |
| + var frame; |
| + |
| + return service_worker_unregister(t, scope_for_main) |
| + .then(function() { |
| + return with_iframe(url); |
| + }) |
| + .then(function(f) { |
| + frame = f; |
| + return navigator.serviceWorker.register(script, |
| + {scope: scope_for_main}); |
| + }) |
| + .then(function(r) { |
| + add_completion_callback(function() { r.unregister(); } ); |
| + return frame.contentWindow.navigator.serviceWorker.getRegistration( |
| + scope_for_iframe); |
| + }) |
| + .then(function(r) { |
| + frame.remove(); |
| + return assert_promise_rejects( |
|
Marijn Kruisselbrink
2016/04/21 16:47:18
drive-by nit: new code should probably use promise
shimazu
2016/04/22 05:44:02
Thanks, I didn't know that. Fixed.
|
| + r.unregister(), |
| + 'InvalidStateError', |
| + 'Unregistration on a detached iframe should throw an exception' |
| + ); |
| + }); |
| + }, 'Unregistration on a detached iframe should fail and throw ' + |
| + 'InvalidStateError exception'); |
| +</script> |