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

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

Issue 324893002: Add tests for navigator.serviceWorker.waiting. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Put the expected result file at the right path. Created 6 years, 6 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
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/waiting.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 425f41a1900f2091f27555e37909fd0787b49907..627e63d2a666d849322c423ebfc3785add9306ed 100644
--- a/LayoutTests/http/tests/serviceworker/resources/test-helpers.js
+++ b/LayoutTests/http/tests/serviceworker/resources/test-helpers.js
@@ -34,7 +34,7 @@ function service_worker_unregister_and_register(test, url, scope, onregister) {
}
function service_worker_unregister_and_done(test, scope) {
- navigator.serviceWorker.unregister(scope).then(
+ return navigator.serviceWorker.unregister(scope).then(
test.done.bind(test),
unreached_rejection(test, 'Unregister should not fail'));
}
@@ -48,12 +48,17 @@ function unreached_rejection(test, prefix) {
// FIXME: Clean up the iframe when the test completes.
function with_iframe(url, f) {
- var frame = document.createElement('iframe');
- frame.src = url;
- frame.onload = function() {
- f(frame);
- };
- document.body.appendChild(frame);
+ return new Promise(function(resolve, reject) {
+ var frame = document.createElement('iframe');
+ frame.src = url;
+ frame.onload = function() {
+ if (f) {
+ f(frame);
+ }
+ resolve(frame);
+ };
+ document.body.appendChild(frame);
+ });
}
function normalizeURL(url) {
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/waiting.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698