OLD | NEW |
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 Loading... |
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 }; |
OLD | NEW |