| OLD | NEW |
| 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 // Test that we get a meaningful list of processes. | 5 // Test that we get a meaningful list of processes. |
| 6 | 6 |
| 7 // FletchDebuggerCommands=b resume,r,lp,c,lp,c | 7 // DartinoDebuggerCommands=b resume,r,lp,c,lp,c |
| 8 | 8 |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'dart:fletch'; | 10 import 'dart:dartino'; |
| 11 | 11 |
| 12 Port spawnPaused(Channel channel) { | 12 Port spawnPaused(Channel channel) { |
| 13 var port = new Port(channel); | 13 var port = new Port(channel); |
| 14 Process.spawnDetached(() { | 14 Process.spawnDetached(() { |
| 15 var c = new Channel(); | 15 var c = new Channel(); |
| 16 port.send(new Port(c)); | 16 port.send(new Port(c)); |
| 17 // TODO(zerny): Make this a CLI test since without the timer, the child | 17 // TODO(zerny): Make this a CLI test since without the timer, the child |
| 18 // process might not make it to the following receive. | 18 // process might not make it to the following receive. |
| 19 var echo = c.receive(); | 19 var echo = c.receive(); |
| 20 port.send(echo); | 20 port.send(echo); |
| 21 }); | 21 }); |
| 22 return channel.receive(); | 22 return channel.receive(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void resume(Channel channel, Port port) { | 25 void resume(Channel channel, Port port) { |
| 26 port.send(42); | 26 port.send(42); |
| 27 var result = channel.receive(); | 27 var result = channel.receive(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 main() { | 30 main() { |
| 31 Channel channel = new Channel(); | 31 Channel channel = new Channel(); |
| 32 Port p1 = spawnPaused(channel); | 32 Port p1 = spawnPaused(channel); |
| 33 Port p2 = spawnPaused(channel); | 33 Port p2 = spawnPaused(channel); |
| 34 Timer timer = new Timer(const Duration(seconds: 2), () { | 34 Timer timer = new Timer(const Duration(seconds: 2), () { |
| 35 resume(channel, p2); | 35 resume(channel, p2); |
| 36 resume(channel, p1); | 36 resume(channel, p1); |
| 37 }); | 37 }); |
| 38 } | 38 } |
| OLD | NEW |