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.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 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return new Future.sync(() { | 141 return new Future.sync(() { |
142 if (_pubServeUrl != null && !p.isWithin('test', path)) { | 142 if (_pubServeUrl != null && !p.isWithin('test', path)) { |
143 throw new LoadException(path, | 143 throw new LoadException(path, |
144 'When using "pub serve", all test files must be in test/.'); | 144 'When using "pub serve", all test files must be in test/.'); |
145 } | 145 } |
146 | 146 |
147 if (platform == TestPlatform.vm) return _loadVmFile(path, metadata); | 147 if (platform == TestPlatform.vm) return _loadVmFile(path, metadata); |
148 assert(platform.isBrowser); | 148 assert(platform.isBrowser); |
149 return _loadBrowserFile(path, platform, metadata); | 149 return _loadBrowserFile(path, platform, metadata); |
150 }).then((suite) { | 150 }).then((suite) { |
151 if (suite == null) return; | 151 if (suite != null) controller.add(suite); |
152 | |
153 controller.add(suite.filter(platform, os: currentOS)); | |
154 }).catchError(controller.addError); | 152 }).catchError(controller.addError); |
155 }).then((_) => controller.close()); | 153 }).then((_) => controller.close()); |
156 | 154 |
157 return controller.stream; | 155 return controller.stream; |
158 } | 156 } |
159 | 157 |
160 /// Load the test suite at [path] in [platform]. | 158 /// Load the test suite at [path] in [platform]. |
161 /// | 159 /// |
162 /// [metadata] is the suite-level metadata for the test. | 160 /// [metadata] is the suite-level metadata for the test. |
163 Future<Suite> _loadBrowserFile(String path, TestPlatform platform, | 161 Future<Suite> _loadBrowserFile(String path, TestPlatform platform, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 Future close() { | 237 Future close() { |
240 for (var isolate in _isolates) { | 238 for (var isolate in _isolates) { |
241 isolate.kill(); | 239 isolate.kill(); |
242 } | 240 } |
243 _isolates.clear(); | 241 _isolates.clear(); |
244 | 242 |
245 if (_browserServerCompleter == null) return new Future.value(); | 243 if (_browserServerCompleter == null) return new Future.value(); |
246 return _browserServer.then((browserServer) => browserServer.close()); | 244 return _browserServer.then((browserServer) => browserServer.close()); |
247 } | 245 } |
248 } | 246 } |
OLD | NEW |