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

Side by Side Diff: tests/isolate/src/TestFramework.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/StaticStateTest.dart ('k') | tests/language/src/TypedMessageTest.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("TestFramework"); 5 #library("TestFramework");
6 #import("dart:coreimpl"); 6 #import("dart:coreimpl");
7 #import("dart:isolate"); 7 #import("dart:isolate");
8 8
9 9
10 typedef void AsynchronousTestFunction(TestExpectation check); 10 typedef void AsynchronousTestFunction(TestExpectation check);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 }); 242 });
243 } 243 }
244 244
245 void tearDown() { 245 void tearDown() {
246 removeRunning(); 246 removeRunning();
247 } 247 }
248 248
249 void addRunning(TestResult result) { 249 void addRunning(TestResult result) {
250 if (running++ == 0) { 250 if (running++ == 0) {
251 keepalive = new ReceivePort.singleShot(); 251 final port = new ReceivePort();
252 keepalive.receive((message, replyTo) { 252 port.receive((message, replyTo) {
253 port.close();
253 result.runner.done(result); 254 result.runner.done(result);
254 }); 255 });
256 keepalive = port;
255 } 257 }
256 } 258 }
257 259
258 void removeRunning() { 260 void removeRunning() {
259 if (--running == 0) { 261 if (--running == 0) {
260 keepalive.toSendPort().send(null, null); 262 keepalive.toSendPort().send(null, null);
261 keepalive = null; 263 keepalive = null;
262 } 264 }
263 } 265 }
264 266
265 // AsynchronousTestCase.run() calls variable test, not function performTest. 267 // AsynchronousTestCase.run() calls variable test, not function performTest.
266 void performTest() { 268 void performTest() {
267 Expect.fail('performTest called in AsynchronousTestCase'); 269 Expect.fail('performTest called in AsynchronousTestCase');
268 } 270 }
269 271
270 AsynchronousTestFunction test; 272 AsynchronousTestFunction test;
271 273
272 static int running = 0; 274 static int running = 0;
273 static ReceivePort keepalive = null; 275 static ReceivePort keepalive = null;
274 276
275 } 277 }
OLDNEW
« no previous file with comments | « tests/isolate/src/StaticStateTest.dart ('k') | tests/language/src/TypedMessageTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698