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

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

Issue 8478014: convert isolate TestFramework from Promise Future (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix typos Created 9 years, 1 month 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 | « no previous file | tests/isolate/src/PromiseBasedTest.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 // Dart test program for testing that heavy and light isolates can be mixed. 5 // Dart test program for testing that heavy and light isolates can be mixed.
6 6
7 #library('Mixed2Test'); 7 #library('Mixed2Test');
8 #import('TestFramework.dart'); 8 #import('TestFramework.dart');
9 9
10 // We want to send a message from the main-isolate to a chain of different 10 // We want to send a message from the main-isolate to a chain of different
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 this.port.receive((msg, replyTo) { 100 this.port.receive((msg, replyTo) {
101 pong.then((SendPort pongPort) { 101 pong.then((SendPort pongPort) {
102 pongPort.send(msg + 30, replyTo); 102 pongPort.send(msg + 30, replyTo);
103 this.port.close(); 103 this.port.close();
104 }); 104 });
105 }); 105 });
106 } 106 }
107 } 107 }
108 108
109 void test(TestExpectation expect) { 109 void test(TestExpectation expect) {
110 Promise<SendPort> heavy1 = expect.completes(new HeavyIsolate1().spawn()); 110 Future<SendPort> heavy1 = expect.completes(new HeavyIsolate1().spawn());
111 Promise<SendPort> heavy2 = expect.completes(new HeavyIsolate2().spawn()); 111 Future<SendPort> heavy2 = expect.completes(new HeavyIsolate2().spawn());
112 Promise<SendPort> heavy3 = expect.completes(new HeavyIsolate3().spawn()); 112 Future<SendPort> heavy3 = expect.completes(new HeavyIsolate3().spawn());
113 113
114 heavy2.then(expect.runs1((SendPort heavy2Port) { 114 heavy2.then(expect.runs1((SendPort heavy2Port) {
115 heavy3.then(expect.runs1((SendPort heavy3Port) { 115 heavy3.then(expect.runs1((SendPort heavy3Port) {
116 heavy2Port.call(heavy3Port).receive(expect.runs2((h2l1Port, ignored) { 116 heavy2Port.call(heavy3Port).receive(expect.runs2((h2l1Port, ignored) {
117 heavy1.then(expect.runs1((SendPort heavy1Port) { 117 heavy1.then(expect.runs1((SendPort heavy1Port) {
118 heavy1Port.send(h2l1Port, null); 118 heavy1Port.send(h2l1Port, null);
119 // --------------- 119 // ---------------
120 // Setup complete. 120 // Setup complete.
121 // Start the chain-message. 121 // Start the chain-message.
122 heavy1Port.call(1).receive(expect.runs2((result, ignored) { 122 heavy1Port.call(1).receive(expect.runs2((result, ignored) {
123 Expect.equals(6531, result); 123 Expect.equals(6531, result);
124 expect.succeeded(); 124 expect.succeeded();
125 })); 125 }));
126 })); 126 }));
127 })); 127 }));
128 })); 128 }));
129 })); 129 }));
130 } 130 }
131 131
132 main() { 132 main() {
133 runTests([test]); 133 runTests([test]);
134 } 134 }
OLDNEW
« no previous file with comments | « no previous file | tests/isolate/src/PromiseBasedTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698