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

Side by Side Diff: tests/isolate/mint_maker_test.dart

Issue 10837070: Remove old isolate API and update all code in the repository to use (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 4 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/message_test.dart ('k') | tests/isolate/mixed2_test.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) 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 // Things that should be "auto-generated" are between AUTO START and 5 // Things that should be "auto-generated" are between AUTO START and
6 // AUTO END (or just AUTO if it's a single line). 6 // AUTO END (or just AUTO if it's a single line).
7 7
8 #library("MintMakerTest"); 8 #library("MintMakerTest");
9 #import("dart:isolate"); 9 #import("dart:isolate");
10 #import('../../lib/unittest/unittest.dart'); 10 #import('../../lib/unittest/unittest.dart');
11 11
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 157
158 SendPort purse_; 158 SendPort purse_;
159 } 159 }
160 // AUTO END 160 // AUTO END
161 161
162 162
163 // AUTO STATUS UNCLEAR! 163 // AUTO STATUS UNCLEAR!
164 164
165 class MintMakerWrapperIsolate extends Isolate { 165 mintMakerWrapper() {
166 MintMakerWrapperIsolate() : super() { } 166 port.receive((var message, SendPort replyTo) {
167 void main() { 167 Mint mint = new Mint();
168 this.port.receive((var message, SendPort replyTo) { 168 replyTo.send([ mint.port ], null);
169 Mint mint = new Mint(); 169 });
170 replyTo.send([ mint.port ], null);
171 });
172 }
173 } 170 }
174 171
175 class MintMakerWrapper { 172 class MintMakerWrapper {
176 MintMakerWrapper() { 173 MintMakerWrapper() {
177 port_ = new MintMakerWrapperIsolate().spawn(); 174 port_ = spawnFunction(mintMakerWrapper);
178 } 175 }
179 176
180 void makeMint(handleMint(MintWrapper mint)) { 177 void makeMint(handleMint(MintWrapper mint)) {
181 port_.then((SendPort port) { 178 port_.call(null).then((var message) {
182 port.call(null).then((var message) { 179 SendPort mint = message[0];
183 SendPort mint = message[0]; 180 handleMint(new MintWrapper(mint));
184 handleMint(new MintWrapper(mint));
185 });
186 }); 181 });
187 } 182 }
188 183
189 Future<SendPort> port_; 184 Future<SendPort> port_;
190 } 185 }
191 186
192 _checkBalance(PurseWrapper wrapper, expected) { 187 _checkBalance(PurseWrapper wrapper, expected) {
193 wrapper.queryBalance(expectAsync1((int balance) { 188 wrapper.queryBalance(expectAsync1((int balance) {
194 expect(balance, equals(expected)); 189 expect(balance, equals(expected));
195 })); 190 }));
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 sprouted...deposit(purse, 5); 252 sprouted...deposit(purse, 5);
258 Expect.equals(0 + 5, sprouted.queryBalance()); 253 Expect.equals(0 + 5, sprouted.queryBalance());
259 Expect.equals(100 - 5, purse.queryBalance()); 254 Expect.equals(100 - 5, purse.queryBalance());
260 255
261 sprouted...deposit(purse, 42); 256 sprouted...deposit(purse, 42);
262 Expect.equals(0 + 5 + 42, sprouted.queryBalance()); 257 Expect.equals(0 + 5 + 42, sprouted.queryBalance());
263 Expect.equals(100 - 5 - 42, purse.queryBalance()); 258 Expect.equals(100 - 5 - 42, purse.queryBalance());
264 } 259 }
265 */ 260 */
266 } 261 }
OLDNEW
« no previous file with comments | « tests/isolate/message_test.dart ('k') | tests/isolate/mixed2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698