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

Unified Diff: LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/unregister.html

Issue 900793002: ServiceWorker: Support SWRegistration.unregister() in SWGlobalScope [2/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: WIP: add test Created 5 years, 10 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: LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/unregister.html
diff --git a/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/unregister.html b/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/unregister.html
new file mode 100644
index 0000000000000000000000000000000000000000..4b59e4713ca57e7c3d06ae619447401d54f8b94d
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/unregister.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<title>ServiceWorkerGlobalScope: unregister</title>
+<script src='../../resources/testharness.js'></script>
+<script src='../../resources/testharnessreport.js'></script>
+<script src='../resources/test-helpers.js'></script>
+<script>
+
+promise_test(function(t) {
+ var script = 'resources/unregister-on-script-evaluation-worker.js';
+ var scope = 'resources/scope/unregister-on-script-evaluation';
+ var worker;
+ var state_transition = [];
+
+ return service_worker_unregister_and_register(t, script, scope)
+ .then(function(registration) {
+ worker = registration.installing;
+ return new Promise(t.step_func(function(resolve) {
+ worker.addEventListener('statechange', function() {
+ state_transition.push(worker.state);
+ if (worker.state === 'redundant')
+ resolve(worker.state);
+ });
+ }))
+ })
+ .then(function() {
+ var expected_state_transition = [
+ 'installed', 'activating', 'redundant'
+ ];
+ assert_equals(
+ expected_state_transition.toString(),
+ state_transition.toString(),
+ 'unregister() should be processed after register() finished');
+ return service_worker_unregister_and_done(t, scope);
+ });
+ }, 'Unregister on script evaluation');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698