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..408037e08cffda24461105ddab44c1816bb7ebee |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/unregister-on-detached-iframe.html |
| @@ -0,0 +1,36 @@ |
| +<!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); |
|
nhiroki
2016/04/25 04:56:35
+2 space indents
shimazu
2016/04/26 02:33:29
I think in this case 2-space indent is correct.
[1
|
| + }) |
| + .then(function(r) { |
| + frame.remove(); |
| + return promise_rejects(t, 'InvalidStateError', r.unregister()); |
| + }); |
| + }, 'Unregistration on a detached iframe should fail and throw ' + |
| + 'InvalidStateError exception'); |
| +</script> |