OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #library("CountTest"); | 5 #library("CountTest"); |
6 #import('dart:isolate'); | 6 #import('dart:isolate'); |
7 #import('../../lib/unittest/unittest.dart'); | 7 #import('../../pkg/unittest/unittest.dart'); |
8 | 8 |
9 void countMessages() { | 9 void countMessages() { |
10 int count = 0; | 10 int count = 0; |
11 port.receive((int message, SendPort replyTo) { | 11 port.receive((int message, SendPort replyTo) { |
12 if (message == -1) { | 12 if (message == -1) { |
13 Expect.equals(10, count); | 13 Expect.equals(10, count); |
14 replyTo.send(-1, null); | 14 replyTo.send(-1, null); |
15 port.close(); | 15 port.close(); |
16 return; | 16 return; |
17 } | 17 } |
(...skipping 19 matching lines...) Expand all Loading... |
37 | 37 |
38 Expect.equals((count - 1) * 2, message); | 38 Expect.equals((count - 1) * 2, message); |
39 remote.send(count++, reply); | 39 remote.send(count++, reply); |
40 if (count == 10) { | 40 if (count == 10) { |
41 remote.send(-1, reply); | 41 remote.send(-1, reply); |
42 } | 42 } |
43 }, count: 11)); | 43 }, count: 11)); |
44 remote.send(count++, reply); | 44 remote.send(count++, reply); |
45 }); | 45 }); |
46 } | 46 } |
OLD | NEW |