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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // the VM's or dart2js's. | 120 // the VM's or dart2js's. |
121 metadata = new Metadata(); | 121 metadata = new Metadata(); |
122 } on FormatException catch (error, stackTrace) { | 122 } on FormatException catch (error, stackTrace) { |
123 return new Stream.fromFuture( | 123 return new Stream.fromFuture( |
124 new Future.error(new LoadException(path, error), stackTrace)); | 124 new Future.error(new LoadException(path, error), stackTrace)); |
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; | 130 return null; |
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 controller.add(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; | 138 return null; |
139 } | 139 } |
140 | 140 |
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); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 Future close() { | 239 Future close() { |
240 for (var isolate in _isolates) { | 240 for (var isolate in _isolates) { |
241 isolate.kill(); | 241 isolate.kill(); |
242 } | 242 } |
243 _isolates.clear(); | 243 _isolates.clear(); |
244 | 244 |
245 if (_browserServerCompleter == null) return new Future.value(); | 245 if (_browserServerCompleter == null) return new Future.value(); |
246 return _browserServer.then((browserServer) => browserServer.close()); | 246 return _browserServer.then((browserServer) => browserServer.close()); |
247 } | 247 } |
248 } | 248 } |
OLD | NEW |