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.loader; | 5 library test.runner.loader; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 | 10 |
11 import 'package:analyzer/analyzer.dart'; | 11 import 'package:analyzer/analyzer.dart'; |
12 import 'package:path/path.dart' as p; | 12 import 'package:path/path.dart' as p; |
13 | 13 |
14 import '../backend/metadata.dart'; | 14 import '../backend/metadata.dart'; |
15 import '../backend/suite.dart'; | 15 import '../backend/suite.dart'; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 /// Load the test suite at [path] in a browser. | 113 /// Load the test suite at [path] in a browser. |
114 Future<Suite> _loadBrowserFile(String path) => | 114 Future<Suite> _loadBrowserFile(String path) => |
115 _browserServer.then((browserServer) => browserServer.loadSuite(path)); | 115 _browserServer.then((browserServer) => browserServer.loadSuite(path)); |
116 | 116 |
117 /// Load the test suite at [path] in VM isolate. | 117 /// Load the test suite at [path] in VM isolate. |
118 Future<Suite> _loadVmFile(String path) { | 118 Future<Suite> _loadVmFile(String path) { |
119 var packageRoot = packageRootFor(path, _packageRoot); | 119 var packageRoot = packageRootFor(path, _packageRoot); |
120 var receivePort = new ReceivePort(); | 120 var receivePort = new ReceivePort(); |
121 return runInIsolate(''' | 121 return runInIsolate(''' |
122 import "package:unittest/src/runner/vm/isolate_listener.dart"; | 122 import "package:test/src/runner/vm/isolate_listener.dart"; |
123 | 123 |
124 import "${p.toUri(p.absolute(path))}" as test; | 124 import "${p.toUri(p.absolute(path))}" as test; |
125 | 125 |
126 void main(_, Map message) { | 126 void main(_, Map message) { |
127 var sendPort = message['reply']; | 127 var sendPort = message['reply']; |
128 IsolateListener.start(sendPort, () => test.main); | 128 IsolateListener.start(sendPort, () => test.main); |
129 } | 129 } |
130 ''', { | 130 ''', { |
131 'reply': receivePort.sendPort | 131 'reply': receivePort.sendPort |
132 }, packageRoot: packageRoot) | 132 }, packageRoot: packageRoot) |
(...skipping 24 matching lines...) Expand all Loading... |
157 Future close() { | 157 Future close() { |
158 for (var isolate in _isolates) { | 158 for (var isolate in _isolates) { |
159 isolate.kill(); | 159 isolate.kill(); |
160 } | 160 } |
161 _isolates.clear(); | 161 _isolates.clear(); |
162 | 162 |
163 if (_browserServerCompleter == null) return new Future.value(); | 163 if (_browserServerCompleter == null) return new Future.value(); |
164 return _browserServer.then((browserServer) => browserServer.close()); | 164 return _browserServer.then((browserServer) => browserServer.close()); |
165 } | 165 } |
166 } | 166 } |
OLD | NEW |