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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/skip-waiting-worker.js

Issue 723923002: ServiceWorker: Add support for .skipWaiting and controllerchange event(1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: webcallback->skipwaitingcallbacks, test re-write Created 6 years, 1 month 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/skip-waiting-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/skip-waiting-worker.js b/LayoutTests/http/tests/serviceworker/resources/skip-waiting-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..fdc31f8314c2353766259c70fbc6f206d2b945a4
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/resources/skip-waiting-worker.js
@@ -0,0 +1,24 @@
+importScripts('worker-testharness.js');
+
+promise_test(function() {
+ return self.skipWaiting()
+ .then(function(result) {
+ assert_equals(result, undefined,
+ 'Promise should be resolved with undefined');
+ })
+ .then(function() {
+ var num = 8;
+ var promises = [];
+ for (var i = 0; i < num; ++i)
+ promises.push(skipWaiting());
+ return Promise.all(promises)
+ .then(function(results) {
+ assert_equals(results.length, num,
+ 'All promises should be resolved');
falken 2014/12/01 02:28:48 Remove this assert. It's just testing the generic
xiang 2014/12/01 07:13:44 Done.
+ results.forEach(function(r) {
+ assert_equals(r, undefined,
+ 'Promises should be resolved with undefined');
+ });
+ });
+ });
+ }, 'skipWaiting');

Powered by Google App Engine
This is Rietveld 408576698