Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library package_isolate_test; | |
| 6 | |
| 7 import 'package:shared.dart'; | |
|
siva
2012/10/17 17:26:23
I think you should import this with a prefix and u
justinfagnani
2012/10/17 18:11:56
Done.
| |
| 8 import 'dart:isolate'; | |
| 9 import '../../../pkg/unittest/unittest.dart'; | |
| 10 | |
| 11 expectResponse() { | |
| 12 port.receive(expectAsync2((msg, r) { | |
| 13 expect('success', msg); | |
|
siva
2012/10/17 17:26:23
Maybe also have:
expect('success', <prefix>.output
justinfagnani
2012/10/17 18:11:56
It should be a different instance of the output va
| |
| 14 port.close(); | |
| 15 })); | |
| 16 } | |
| 17 | |
| 18 void main() { | |
| 19 test("package in spawnFunction()", () { | |
| 20 expectResponse(); | |
|
siva
2012/10/17 17:26:23
<prefix>.output = 'junk';
justinfagnani
2012/10/17 18:11:56
Done.
| |
| 21 var sendPort = spawnFunction(isolate_main); | |
| 22 sendPort.send("sendPort", port.toSendPort()); | |
| 23 }); | |
| 24 | |
| 25 test("package in spawnUri() of sibling file", () { | |
|
siva
2012/10/17 17:26:23
<prefix>.output = 'junk';
justinfagnani
2012/10/17 18:11:56
Done.
| |
| 26 expectResponse(); | |
| 27 var sendPort = spawnUri('sibling_isolate.dart'); | |
| 28 sendPort.send('sendPort', port.toSendPort()); | |
| 29 }); | |
| 30 | |
| 31 test("package in spawnUri() of file in folder", () { | |
| 32 expectResponse(); | |
| 33 var sendPort = spawnUri('test_folder/folder_isolate.dart'); | |
| 34 sendPort.send('sendPort', port.toSendPort()); | |
| 35 }); | |
| 36 } | |
| 37 | |
| 38 void isolate_main() { | |
| 39 output = 'success'; | |
| 40 port.receive((msg, replyTo) { | |
| 41 replyTo.send(output); | |
| 42 }); | |
| 43 } | |
| OLD | NEW |