| 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 | 17 |
| 18 /// A test in another isolate. | 18 /// A test in another isolate. |
| 19 class IsolateTest implements Test { | 19 class IsolateTest extends Test { |
| 20 final String name; | 20 final String name; |
| 21 final Metadata metadata; | 21 final Metadata metadata; |
| 22 | 22 |
| 23 /// The port on which to communicate with the remote test. | 23 /// The port on which to communicate with the remote test. |
| 24 final SendPort _sendPort; | 24 final SendPort _sendPort; |
| 25 | 25 |
| 26 IsolateTest(this.name, this.metadata, this._sendPort); | 26 IsolateTest(this.name, this.metadata, this._sendPort); |
| 27 | 27 |
| 28 /// Loads a single runnable instance of this test. | 28 /// Loads a single runnable instance of this test. |
| 29 LiveTest load(Suite suite) { | 29 LiveTest load(Suite suite) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // If the test is still running, send it a message telling it to shut down | 74 // If the test is still running, send it a message telling it to shut down |
| 75 // ASAP. This causes the [Invoker] to eagerly throw exceptions whenever | 75 // ASAP. This causes the [Invoker] to eagerly throw exceptions whenever |
| 76 // the test touches it. | 76 // the test touches it. |
| 77 sendPortCompleter.future.then((sendPort) { | 77 sendPortCompleter.future.then((sendPort) { |
| 78 sendPort.send({'command': 'close'}); | 78 sendPort.send({'command': 'close'}); |
| 79 return controller.completer.future; | 79 return controller.completer.future; |
| 80 }).then((_) => receivePort.close()); | 80 }).then((_) => receivePort.close()); |
| 81 }); | 81 }); |
| 82 return controller.liveTest; | 82 return controller.liveTest; |
| 83 } | 83 } |
| 84 |
| 85 Test change({String name, Metadata metadata}) { |
| 86 if (name == null) name = this.name; |
| 87 if (metadata == null) metadata = this.metadata; |
| 88 return new IsolateTest(name, metadata, _sendPort); |
| 89 } |
| 84 } | 90 } |
| OLD | NEW |