Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: lib/src/runner/vm/isolate_test.dart

Issue 1685363002: Add a platform plugin infrastructure. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/runner/vm/isolate_listener.dart ('k') | lib/src/runner/vm/platform.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/vm/isolate_test.dart
diff --git a/lib/src/runner/vm/isolate_test.dart b/lib/src/runner/vm/isolate_test.dart
deleted file mode 100644
index c0aae7fff1e88606110c0527df8b6559a4f89ca4..0000000000000000000000000000000000000000
--- a/lib/src/runner/vm/isolate_test.dart
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-import 'dart:isolate';
-
-import '../../backend/group.dart';
-import '../../backend/live_test.dart';
-import '../../backend/live_test_controller.dart';
-import '../../backend/metadata.dart';
-import '../../backend/operating_system.dart';
-import '../../backend/state.dart';
-import '../../backend/suite.dart';
-import '../../backend/test.dart';
-import '../../backend/test_platform.dart';
-import '../../util/remote_exception.dart';
-import '../../utils.dart';
-
-/// A test in another isolate.
-class IsolateTest extends Test {
- final String name;
- final Metadata metadata;
-
- /// The port on which to communicate with the remote test.
- final SendPort _sendPort;
-
- IsolateTest(this.name, this.metadata, this._sendPort);
-
- LiveTest load(Suite suite, {Iterable<Group> groups}) {
- var controller;
-
- // We get a new send port for communicating with the live test, since
- // [_sendPort] is only for communicating with the non-live test. This will
- // be non-null once the test starts running.
- var sendPortCompleter;
-
- var receivePort;
- controller = new LiveTestController(suite, this, () {
- controller.setState(const State(Status.running, Result.success));
-
- sendPortCompleter = new Completer();
- receivePort = new ReceivePort();
- _sendPort.send({
- 'command': 'run',
- 'reply': receivePort.sendPort
- });
-
- receivePort.listen((message) {
- if (message['type'] == 'started') {
- sendPortCompleter.complete(message['reply']);
- } else if (message['type'] == 'error') {
- var asyncError = RemoteException.deserialize(message['error']);
- controller.addError(asyncError.error, asyncError.stackTrace);
- } else if (message['type'] == 'state-change') {
- controller.setState(
- new State(
- new Status.parse(message['status']),
- new Result.parse(message['result'])));
- } else if (message['type'] == 'print') {
- controller.print(message['line']);
- } else {
- assert(message['type'] == 'complete');
- controller.completer.complete();
- }
- });
- }, () {
- // If the test has finished running, just disconnect the receive port. The
- // Dart process won't terminate if there are any live receive ports open.
- if (controller.completer.isCompleted) {
- receivePort.close();
- return;
- }
-
- invoke(() async {
- // If the test is still running, send it a message telling it to shut
- // down ASAP. This causes the [Invoker] to eagerly throw exceptions
- // whenever the test touches it.
- var sendPort = await sendPortCompleter.future;
- sendPort.send({'command': 'close'});
- await controller.completer.future;
- receivePort.close();
- });
- }, groups: groups);
- return controller.liveTest;
- }
-
- Test forPlatform(TestPlatform platform, {OperatingSystem os}) {
- if (!metadata.testOn.evaluate(platform, os: os)) return null;
- return new IsolateTest(
- name, metadata.forPlatform(platform, os: os), _sendPort);
- }
-}
« no previous file with comments | « lib/src/runner/vm/isolate_listener.dart ('k') | lib/src/runner/vm/platform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698