Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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(); |
|
eub
2012/03/09 18:33:10
I'm missing why the port vs. keepalive distinction
Siggi Cherem (dart-lang)
2012/03/10 03:10:00
It happens that keepalive is a field that gets ass
| |
| 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 } |
| OLD | NEW |