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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/chromium/resources/clients-openwindow.js

Issue 1668473002: ServiceWorker: Wait for the completion of async tasks on ExtendableMessageEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // This helper will setup a small test framework that will use TESTS and run 1 // This helper will setup a small test framework that will use TESTS and run
2 // them sequentially and call self.postMessage('quit') when done. 2 // them sequentially and call self.postMessage('quit') when done.
3 // This helper also exposes |client|, |postMessage()|, |runNextTestOrQuit()|, 3 // This helper also exposes |client|, |postMessage()|, |runNextTestOrQuit()|,
4 // |synthesizeNotificationClick()| and |initialize()|. 4 // |synthesizeNotificationClick()| and |initialize()|.
5 importScripts('sw-test-helpers.js'); 5 importScripts('sw-test-helpers.js');
6 importScripts('../../../resources/get-host-info.js'); 6 importScripts('../../../resources/get-host-info.js');
7 7
8 var TESTS = [ 8 var TESTS = [
9 function testWithNoNotificationClick() { 9 function testWithNoNotificationClick() {
10 clients.openWindow('/').catch(function(e) { 10 clients.openWindow('/').catch(function(e) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 clients.openWindow('file:///').catch(function(error) { 88 clients.openWindow('file:///').catch(function(error) {
89 self.postMessage('openWindow() can not open file scheme'); 89 self.postMessage('openWindow() can not open file scheme');
90 self.postMessage('openWindow() error is: ' + error.name); 90 self.postMessage('openWindow() error is: ' + error.name);
91 }).then(runNextTestOrQuit); 91 }).then(runNextTestOrQuit);
92 }); 92 });
93 }, 93 },
94 ]; 94 ];
95 95
96 self.onmessage = function(e) { 96 self.onmessage = function(e) {
97 if (e.data == 'start') { 97 if (e.data == 'start') {
98 initialize().then(runNextTestOrQuit); 98 e.waitUntil(initialize().then(runNextTestOrQuit));
99 } else { 99 } else {
100 initialize().then(function() { 100 e.waitUntil(initialize().then(function() {
101 self.postMessage('received unexpected message'); 101 self.postMessage('received unexpected message');
102 self.postMessage('quit'); 102 self.postMessage('quit');
103 }); 103 }));
104 } 104 }
105 }; 105 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698