OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
7 | 7 |
8 import 'package:unittest/src/invoker.dart'; | 8 import 'package:unittest/src/invoker.dart'; |
| 9 import 'package:unittest/src/io.dart'; |
9 import 'package:unittest/src/isolate_test.dart'; | 10 import 'package:unittest/src/isolate_test.dart'; |
10 import 'package:unittest/src/live_test.dart'; | 11 import 'package:unittest/src/live_test.dart'; |
11 import 'package:unittest/src/remote_exception.dart'; | 12 import 'package:unittest/src/remote_exception.dart'; |
12 import 'package:unittest/src/state.dart'; | 13 import 'package:unittest/src/state.dart'; |
13 import 'package:unittest/src/suite.dart'; | 14 import 'package:unittest/src/suite.dart'; |
14 import 'package:unittest/src/vm_listener.dart'; | 15 import 'package:unittest/src/vm_listener.dart'; |
15 import 'package:unittest/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
16 | 17 |
17 import 'utils.dart'; | 18 import 'utils.dart'; |
18 | 19 |
19 /// An isolate that's been spun up for the current test. | 20 /// An isolate that's been spun up for the current test. |
20 /// | 21 /// |
21 /// This is tracked so that it can be killed once the test is done. | 22 /// This is tracked so that it can be killed once the test is done. |
22 Isolate _isolate; | 23 Isolate _isolate; |
23 | 24 |
24 /// A live test that's running for the current test. | 25 /// A live test that's running for the current test. |
25 /// | 26 /// |
26 /// This is tracked so that it can be closed once the test is done. | 27 /// This is tracked so that it can be closed once the test is done. |
27 LiveTest _liveTest; | 28 LiveTest _liveTest; |
28 | 29 |
29 void main() { | 30 void main() { |
30 tearDown(() { | 31 tearDown(() { |
31 if (_isolate != null) _isolate.kill(Isolate.IMMEDIATE); | 32 if (_isolate != null && supportsIsolateKill) { |
| 33 _isolate.kill(Isolate.IMMEDIATE); |
| 34 } |
32 _isolate = null; | 35 _isolate = null; |
33 | 36 |
34 if (_liveTest != null) _liveTest.close(); | 37 if (_liveTest != null) _liveTest.close(); |
35 _liveTest = null; | 38 _liveTest = null; |
36 }); | 39 }); |
37 | 40 |
38 test("sends a list of available tests on startup", () { | 41 test("sends a list of available tests on startup", () { |
39 return _spawnIsolate(_successfulTests).then((receivePort) { | 42 return _spawnIsolate(_successfulTests).then((receivePort) { |
40 return receivePort.first; | 43 return receivePort.first; |
41 }).then((response) { | 44 }).then((response) { |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 VmListener.start(sendPort, () => () { | 369 VmListener.start(sendPort, () => () { |
367 test("multiple errors", () { | 370 test("multiple errors", () { |
368 Invoker.current.addOutstandingCallback(); | 371 Invoker.current.addOutstandingCallback(); |
369 new Future(() => throw "one"); | 372 new Future(() => throw "one"); |
370 new Future(() => throw "two"); | 373 new Future(() => throw "two"); |
371 new Future(() => throw "three"); | 374 new Future(() => throw "three"); |
372 new Future(() => throw "four"); | 375 new Future(() => throw "four"); |
373 }); | 376 }); |
374 }); | 377 }); |
375 } | 378 } |
OLD | NEW |