Commit f745ace7 authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

ServiceWorker: Remove controlled frames using add_cleanup() helper

clients-matchall-client-types.https.html manually cleans up controlled frames at
the end of each test case. This doesn't work when the tests fail on the
way, and that unexpectedly prolongs lifetime of a service worker. This is the
reason why the second test failed with the following message.

  "Error: wait_for_state must be passed a ServiceWorker"

This CL fixes it by cleaning up the frames using add_cleanup() helper.

Bug: n/a
Change-Id: I0f0e71a55814d114665eff824c917c918ac993f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2010600Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733498}
parent 01116522
This is a testharness.js-based test.
FAIL Verify matchAll() with window client type assert_array_equals: expected property 2 to be "https://web-platform.test:8444/service-workers/service-worker/resources/clients-matchall-client-types-iframe.html" but got "https://web-platform.test:8444/service-workers/service-worker/resources/url-modified-via-pushstate.html" (expected array ["visible", true, "https://web-platform.test:8444/service-workers/service-worker/resources/clients-matchall-client-types-iframe.html", "window", "nested"] got ["visible", true, "https://web-platform.test:8444/service-workers/service-worker/resources/url-modified-via-pushstate.html", "window", "nested"])
FAIL Verify matchAll() with {window, sharedworker, worker} client types promise_test: Unhandled rejection with value: object "Error: wait_for_state must be passed a ServiceWorker"
FAIL Verify matchAll() with {window, sharedworker, worker} client types assert_array_equals: expected property 2 to be "https://web-platform.test:8444/service-workers/service-worker/resources/clients-matchall-client-types-iframe.html" but got "https://web-platform.test:8444/service-workers/service-worker/resources/url-modified-via-pushstate.html" (expected array ["visible", true, "https://web-platform.test:8444/service-workers/service-worker/resources/clients-matchall-client-types-iframe.html", "window", "nested"] got ["visible", true, "https://web-platform.test:8444/service-workers/service-worker/resources/url-modified-via-pushstate.html", "window", "nested"])
Harness: the test ran to completion.
......@@ -63,13 +63,11 @@ promise_test(function(t) {
.then(function() { return with_iframe(iframe_url); })
.then(function(f) {
frame = f;
t.add_cleanup(function() { frame.remove(); });
return test_matchall(frame, expected_only_window, {});
})
.then(function() {
return test_matchall(frame, expected_only_window, {type:'window'});
})
.then(function() {
frame.remove();
});
}, 'Verify matchAll() with window client type');
......@@ -87,6 +85,7 @@ promise_test(function(t) {
.then(function() { return with_iframe(iframe_url); })
.then(function(f) {
frame = f;
t.add_cleanup(function() { frame.remove(); });
return new Promise(function(resolve, reject) {
var w = new SharedWorker(shared_worker_url);
w.port.onmessage = resolve;
......@@ -115,9 +114,6 @@ promise_test(function(t) {
})
.then(function() {
return test_matchall(frame, expected_all_clients, {type:'all'});
})
.then(function() {
frame.remove();
});
}, 'Verify matchAll() with {window, sharedworker, worker} client types');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment