| OLD | NEW |
| 1 #library('DOMIsolatesTest'); | 1 #library('DOMIsolatesTest'); |
| 2 #import('../../lib/unittest/unittest.dart'); | 2 #import('../../lib/unittest/unittest.dart'); |
| 3 #import('../../lib/unittest/html_config.dart'); | 3 #import('../../lib/unittest/html_config.dart'); |
| 4 #import('dart:html'); | 4 #import('dart:html'); |
| 5 #import('dart:isolate'); | 5 #import('dart:isolate'); |
| 6 | 6 |
| 7 isolateMain(port) { | 7 isolateMain(port) { |
| 8 port.receive((msg, replyTo) { | 8 port.receive((msg, replyTo) { |
| 9 if (msg != 'check') { | 9 if (msg != 'check') { |
| 10 replyTo.send('wrong msg: $msg'); | 10 replyTo.send('wrong msg: $msg'); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 }); | 25 }); |
| 26 }); | 26 }); |
| 27 } | 27 } |
| 28 | 28 |
| 29 main() { | 29 main() { |
| 30 useHtmlConfiguration(); | 30 useHtmlConfiguration(); |
| 31 | 31 |
| 32 final iframe = new Element.tag('iframe'); | 32 final iframe = new Element.tag('iframe'); |
| 33 document.body.nodes.add(iframe); | 33 document.body.nodes.add(iframe); |
| 34 | 34 |
| 35 asyncTest('Simple DOM isolate test', 1, () { | 35 test('Simple DOM isolate test', () { |
| 36 spawnDomIsolate(iframe.contentWindow, 'isolateMain').then((sendPort) { | 36 spawnDomIsolate(iframe.contentWindow, 'isolateMain').then( |
| 37 sendPort.call('check').then((msg) { | 37 expectAsync1((sendPort) { |
| 38 Expect.equals('about:blank', msg); | 38 sendPort.call('check').then( |
| 39 callbackDone(); | 39 expectAsync1((msg) { |
| 40 }); | 40 Expect.equals('about:blank', msg); |
| 41 }); | 41 })); |
| 42 })); |
| 42 }); | 43 }); |
| 43 | 44 |
| 44 asyncTest('Nested DOM isolates test', 1, () { | 45 test('Nested DOM isolates test', () { |
| 45 spawnDomIsolate(iframe.contentWindow, 'isolateMainTrampoline').then((sendPor
t) { | 46 spawnDomIsolate(iframe.contentWindow, 'isolateMainTrampoline').then( |
| 46 sendPort.call('check').then((msg) { | 47 expectAsync1((sendPort) { |
| 47 Expect.equals('about:blank', msg); | 48 sendPort.call('check').then( |
| 48 callbackDone(); | 49 expectAsync1((msg) { |
| 49 }); | 50 Expect.equals('about:blank', msg); |
| 50 }); | 51 })); |
| 52 })); |
| 51 }); | 53 }); |
| 52 | 54 |
| 53 test('Null as target window', () { | 55 test('Null as target window', () { |
| 54 expectThrow(() => spawnDomIsolate(null, 'isolateMain')); | 56 expectThrow(() => spawnDomIsolate(null, 'isolateMain')); |
| 55 }); | 57 }); |
| 56 | 58 |
| 57 test('Not window as target window', () { | 59 test('Not window as target window', () { |
| 58 expectThrow(() => spawnDomIsolate(document, 'isolateMain')); | 60 expectThrow(() => spawnDomIsolate(document, 'isolateMain')); |
| 59 }); | 61 }); |
| 60 } | 62 } |
| OLD | NEW |