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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 } | 125 } |
126 | 126 |
127 var controller = new StreamController(); | 127 var controller = new StreamController(); |
128 Future.forEach(_platforms, (platform) { | 128 Future.forEach(_platforms, (platform) { |
129 if (!metadata.testOn.evaluate(platform, os: currentOS)) { | 129 if (!metadata.testOn.evaluate(platform, os: currentOS)) { |
130 return new Future.value(); | 130 return new Future.value(); |
131 } | 131 } |
132 | 132 |
133 // Don't load a skipped suite. | 133 // Don't load a skipped suite. |
134 if (metadata.skip) { | 134 if (metadata.skip) { |
135 return new Future.value(new Suite([ | 135 controller.add(new Suite([ |
136 new LocalTest(path, metadata, () {}) | 136 new LocalTest(path, metadata, () {}) |
137 ], path: path, platform: platform.name, metadata: metadata)); | 137 ], path: path, platform: platform.name, metadata: metadata)); |
138 return new Future.value(); | |
kevmoo
2015/04/17 23:56:29
you can just return here – forEach handles null fi
nweiz
2015/04/18 00:07:39
Done. Future.wait makes me paranoid, because it do
| |
138 } | 139 } |
139 | 140 |
140 return new Future.sync(() { | 141 return new Future.sync(() { |
141 if (_pubServeUrl != null && !p.isWithin('test', path)) { | 142 if (_pubServeUrl != null && !p.isWithin('test', path)) { |
142 throw new LoadException(path, | 143 throw new LoadException(path, |
143 'When using "pub serve", all test files must be in test/.'); | 144 'When using "pub serve", all test files must be in test/.'); |
144 } | 145 } |
145 | 146 |
146 if (platform == TestPlatform.vm) return _loadVmFile(path, metadata); | 147 if (platform == TestPlatform.vm) return _loadVmFile(path, metadata); |
147 assert(platform.isBrowser); | 148 assert(platform.isBrowser); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 Future close() { | 239 Future close() { |
239 for (var isolate in _isolates) { | 240 for (var isolate in _isolates) { |
240 isolate.kill(); | 241 isolate.kill(); |
241 } | 242 } |
242 _isolates.clear(); | 243 _isolates.clear(); |
243 | 244 |
244 if (_browserServerCompleter == null) return new Future.value(); | 245 if (_browserServerCompleter == null) return new Future.value(); |
245 return _browserServer.then((browserServer) => browserServer.close()); | 246 return _browserServer.then((browserServer) => browserServer.close()); |
246 } | 247 } |
247 } | 248 } |
OLD | NEW |