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 iteratively 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 | 6 |
7 var TESTS = [ | 7 var TESTS = [ |
8 function testWithNoNotificationClick() { | 8 function testWithNoNotificationClick() { |
9 clients.openWindow('/').catch(function(e) { | 9 clients.openWindow('/').catch(function(e) { |
10 self.postMessage('openWindow() can\'t open a window without a user i
nteraction'); | 10 self.postMessage('openWindow() can\'t open a window without a user i
nteraction'); |
11 self.postMessage('openWindow() error is ' + e.name); | 11 self.postMessage('openWindow() error is ' + e.name); |
12 }).then(runNextTestOrQuit); | 12 }).then(runNextTestOrQuit); |
(...skipping 25 matching lines...) Expand all Loading... |
38 self.postMessage(' url: ' + c.url); | 38 self.postMessage(' url: ' + c.url); |
39 self.postMessage(' visibilityState: ' + c.visibilityState); | 39 self.postMessage(' visibilityState: ' + c.visibilityState); |
40 self.postMessage(' focused: ' + c.focused); | 40 self.postMessage(' focused: ' + c.focused); |
41 self.postMessage(' frameType: ' + c.frameType); | 41 self.postMessage(' frameType: ' + c.frameType); |
42 }).then(runNextTestOrQuit); | 42 }).then(runNextTestOrQuit); |
43 }); | 43 }); |
44 } | 44 } |
45 ]; | 45 ]; |
46 | 46 |
47 self.onmessage = function(e) { | 47 self.onmessage = function(e) { |
48 if (e.data == "start") { | 48 if (e.data == 'start') { |
49 initialize().then(runNextTestOrQuit); | 49 initialize().then(runNextTestOrQuit); |
50 } else { | 50 } else { |
51 initialize().then(function() { | 51 initialize().then(function() { |
52 self.postMessage('received unexpected message'); | 52 self.postMessage('received unexpected message'); |
53 self.postMessage('quit'); | 53 self.postMessage('quit'); |
54 }); | 54 }); |
55 } | 55 } |
56 } | 56 }; |
OLD | NEW |