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 import 'package:expect/expect.dart'; | 11 import 'package:expect/expect.dart'; |
12 | 12 |
13 Port spawnPaused(Channel channel, Channel monitor) { | 13 Port spawnPaused(Channel channel, Channel monitor) { |
14 var port = new Port(channel); | 14 var port = new Port(channel); |
15 Process.spawnDetached(() { | 15 Process.spawnDetached(() { |
16 var c = new Channel(); | 16 var c = new Channel(); |
17 port.send(new Port(c)); | 17 port.send(new Port(c)); |
18 var echo = c.receive(); // B1 | 18 var echo = c.receive(); // B1 |
19 port.send(echo); | 19 port.send(echo); |
20 }, | 20 }, |
(...skipping 12 matching lines...) Expand all Loading... |
33 Port p1 = spawnPaused(channel, monitor); | 33 Port p1 = spawnPaused(channel, monitor); |
34 Port p2 = spawnPaused(channel, monitor); | 34 Port p2 = spawnPaused(channel, monitor); |
35 // Give the children time to block at B1. | 35 // Give the children time to block at B1. |
36 Timer timer = new Timer(const Duration(seconds: 2), () { | 36 Timer timer = new Timer(const Duration(seconds: 2), () { |
37 resume(channel, p2); | 37 resume(channel, p2); |
38 Expect.equals(DeathReason.Terminated, monitor.receive().reason); | 38 Expect.equals(DeathReason.Terminated, monitor.receive().reason); |
39 resume(channel, p1); | 39 resume(channel, p1); |
40 Expect.equals(DeathReason.Terminated, monitor.receive().reason); | 40 Expect.equals(DeathReason.Terminated, monitor.receive().reason); |
41 }); | 41 }); |
42 } | 42 } |
OLD | NEW |