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 test.runner.vm.isolate_test; | 5 library test.runner.vm.isolate_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:isolate'; | 8 import 'dart:isolate'; |
9 | 9 |
10 import '../../backend/live_test.dart'; | 10 import '../../backend/live_test.dart'; |
11 import '../../backend/live_test_controller.dart'; | 11 import '../../backend/live_test_controller.dart'; |
12 import '../../backend/metadata.dart'; | 12 import '../../backend/metadata.dart'; |
13 import '../../backend/state.dart'; | 13 import '../../backend/state.dart'; |
14 import '../../backend/suite.dart'; | 14 import '../../backend/suite.dart'; |
15 import '../../backend/test.dart'; | 15 import '../../backend/test.dart'; |
16 import '../../util/remote_exception.dart'; | 16 import '../../util/remote_exception.dart'; |
17 import '../../utils.dart'; | 17 import '../../utils.dart'; |
18 | 18 |
19 /// A test in another isolate. | 19 /// A test in another isolate. |
20 class IsolateTest extends Test { | 20 class IsolateTest implements Test { |
21 final String name; | 21 final String name; |
22 final Metadata metadata; | 22 final Metadata metadata; |
23 | 23 |
24 /// The port on which to communicate with the remote test. | 24 /// The port on which to communicate with the remote test. |
25 final SendPort _sendPort; | 25 final SendPort _sendPort; |
26 | 26 |
27 IsolateTest(this.name, this.metadata, this._sendPort); | 27 IsolateTest(this.name, this.metadata, this._sendPort); |
28 | 28 |
29 /// Loads a single runnable instance of this test. | 29 /// Loads a single runnable instance of this test. |
30 LiveTest load(Suite suite) { | 30 LiveTest load(Suite suite) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 var sendPort = await sendPortCompleter.future; | 79 var sendPort = await sendPortCompleter.future; |
80 sendPort.send({'command': 'close'}); | 80 sendPort.send({'command': 'close'}); |
81 await controller.completer.future; | 81 await controller.completer.future; |
82 receivePort.close(); | 82 receivePort.close(); |
83 }); | 83 }); |
84 }); | 84 }); |
85 return controller.liveTest; | 85 return controller.liveTest; |
86 } | 86 } |
87 | 87 |
88 Test change({String name, Metadata metadata}) { | 88 Test change({String name, Metadata metadata}) { |
| 89 if (name == name && metadata == this.metadata) return this; |
89 if (name == null) name = this.name; | 90 if (name == null) name = this.name; |
90 if (metadata == null) metadata = this.metadata; | 91 if (metadata == null) metadata = this.metadata; |
91 return new IsolateTest(name, metadata, _sendPort); | 92 return new IsolateTest(name, metadata, _sendPort); |
92 } | 93 } |
93 } | 94 } |
OLD | NEW |