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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/test-helpers.js

Issue 416003003: Test for register canceling an unregister. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: mostly formatting fix Created 6 years, 4 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/resources/test-helpers.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js
index 5a72d31ca1bac7a061c90a030c25e6311e75204e..51d8ebbb0a4f05b4233d4301cd7c5dbab359481d 100644
--- a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js
+++ b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js
@@ -23,9 +23,9 @@ function service_worker_unregister_and_done(test, scope) {
// Rejection-specific helper that provides more details
function unreached_rejection(test, prefix) {
return test.step_func(function(error) {
- var reason = error.name ? error.name : error;
- var prefix = prefix ? prefix : "unexpected rejection";
- assert_unreached(prefix + ': ' + reason);
+ var reason = error.message || error.name || error;
+ var error_prefix = prefix || 'unexpected rejection';
+ assert_unreached(error_prefix + ': ' + reason);
});
}
@@ -44,6 +44,17 @@ function with_iframe(url, f) {
});
}
+function unload_iframe(iframe) {
+ var saw_unload = new Promise(function(resolve) {
+ iframe.contentWindow.addEventListener('unload', function() {
+ resolve();
+ });
+ });
+ iframe.src = '';
+ iframe.remove();
+ return saw_unload;
+}
+
function normalizeURL(url) {
return new URL(url, document.location).toString().replace(/#.*$/, '');
}

Powered by Google App Engine
This is Rietveld 408576698