Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: tests/isolate/src/StaticStateTest.dart

Issue 9652001: SendPort + ReceivePort changes: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/isolate/src/SpawnTest.dart ('k') | tests/isolate/src/TestFramework.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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("StaticStateTest"); 5 #library("StaticStateTest");
6 #import("dart:isolate"); 6 #import("dart:isolate");
7 #import("TestFramework.dart"); 7 #import("TestFramework.dart");
8 8
9 class TestIsolate extends Isolate { 9 class TestIsolate extends Isolate {
10 10
(...skipping 14 matching lines...) Expand all
25 static String state; 25 static String state;
26 26
27 } 27 }
28 28
29 void test(TestExpectation expect) { 29 void test(TestExpectation expect) {
30 Expect.equals(null, TestIsolate.state); 30 Expect.equals(null, TestIsolate.state);
31 TestIsolate.state = "foo"; 31 TestIsolate.state = "foo";
32 Expect.equals("foo", TestIsolate.state); 32 Expect.equals("foo", TestIsolate.state);
33 33
34 expect.completes(new TestIsolate().spawn()).then((SendPort remote) { 34 expect.completes(new TestIsolate().spawn()).then((SendPort remote) {
35 remote.call("bar").receive(expect.runs2((reply, replyTo) { 35 remote.call("bar").then(expect.runs1((reply) {
36 Expect.equals("foo", TestIsolate.state); 36 Expect.equals("foo", TestIsolate.state);
37 Expect.equals(null, reply); 37 Expect.equals(null, reply);
38 38
39 TestIsolate.state = "baz"; 39 TestIsolate.state = "baz";
40 remote.call("exit").receive(expect.runs2((reply, replyTo) { 40 remote.call("exit").then(expect.runs1((reply) {
41 Expect.equals("baz", TestIsolate.state); 41 Expect.equals("baz", TestIsolate.state);
42 Expect.equals("bar", reply); 42 Expect.equals("bar", reply);
43 expect.succeeded(); 43 expect.succeeded();
44 })); 44 }));
45 })); 45 }));
46 }); 46 });
47 } 47 }
48 48
49 void main() { 49 void main() {
50 runTests([test]); 50 runTests([test]);
51 } 51 }
OLDNEW
« no previous file with comments | « tests/isolate/src/SpawnTest.dart ('k') | tests/isolate/src/TestFramework.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698