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 library unittest.runner.vm.isolate_test; | 5 library unittest.runner.vm.isolate_test; |
6 | 6 |
7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
8 | 8 |
9 import '../../backend/live_test.dart'; | 9 import '../../backend/live_test.dart'; |
10 import '../../backend/live_test_controller.dart'; | 10 import '../../backend/live_test_controller.dart'; |
| 11 import '../../backend/metadata.dart'; |
11 import '../../backend/state.dart'; | 12 import '../../backend/state.dart'; |
12 import '../../backend/suite.dart'; | 13 import '../../backend/suite.dart'; |
13 import '../../backend/test.dart'; | 14 import '../../backend/test.dart'; |
14 import '../../util/remote_exception.dart'; | 15 import '../../util/remote_exception.dart'; |
15 | 16 |
16 /// A test in another isolate. | 17 /// A test in another isolate. |
17 class IsolateTest implements Test { | 18 class IsolateTest implements Test { |
18 final String name; | 19 final String name; |
| 20 final Metadata metadata; |
19 | 21 |
20 /// The port on which to communicate with the remote test. | 22 /// The port on which to communicate with the remote test. |
21 final SendPort _sendPort; | 23 final SendPort _sendPort; |
22 | 24 |
23 IsolateTest(this.name, this._sendPort); | 25 IsolateTest(this.name, this.metadata, this._sendPort); |
24 | 26 |
25 /// Loads a single runnable instance of this test. | 27 /// Loads a single runnable instance of this test. |
26 LiveTest load(Suite suite) { | 28 LiveTest load(Suite suite) { |
27 var receivePort; | 29 var receivePort; |
28 var controller; | 30 var controller; |
29 controller = new LiveTestController(suite, this, () { | 31 controller = new LiveTestController(suite, this, () { |
30 controller.setState(const State(Status.running, Result.success)); | 32 controller.setState(const State(Status.running, Result.success)); |
31 | 33 |
32 receivePort = new ReceivePort(); | 34 receivePort = new ReceivePort(); |
33 _sendPort.send({ | 35 _sendPort.send({ |
(...skipping 14 matching lines...) Expand all Loading... |
48 assert(message['type'] == 'complete'); | 50 assert(message['type'] == 'complete'); |
49 controller.completer.complete(); | 51 controller.completer.complete(); |
50 } | 52 } |
51 }); | 53 }); |
52 }, onClose: () { | 54 }, onClose: () { |
53 if (receivePort != null) receivePort.close(); | 55 if (receivePort != null) receivePort.close(); |
54 }); | 56 }); |
55 return controller.liveTest; | 57 return controller.liveTest; |
56 } | 58 } |
57 } | 59 } |
OLD | NEW |