| 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 |
| 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/invoker.dart'; |
| 14 import '../backend/metadata.dart'; | 15 import '../backend/metadata.dart'; |
| 15 import '../backend/suite.dart'; | 16 import '../backend/suite.dart'; |
| 16 import '../backend/test_platform.dart'; | 17 import '../backend/test_platform.dart'; |
| 17 import '../util/dart.dart'; | 18 import '../util/dart.dart'; |
| 18 import '../util/io.dart'; | 19 import '../util/io.dart'; |
| 19 import '../util/isolate_wrapper.dart'; | 20 import '../util/isolate_wrapper.dart'; |
| 20 import '../util/remote_exception.dart'; | 21 import '../util/remote_exception.dart'; |
| 21 import '../utils.dart'; | 22 import '../utils.dart'; |
| 22 import 'browser/server.dart'; | 23 import 'browser/server.dart'; |
| 23 import 'load_exception.dart'; | 24 import 'load_exception.dart'; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return new Stream.fromFuture( | 123 return new Stream.fromFuture( |
| 123 new Future.error(new LoadException(path, error), stackTrace)); | 124 new Future.error(new LoadException(path, error), stackTrace)); |
| 124 } | 125 } |
| 125 | 126 |
| 126 var controller = new StreamController(); | 127 var controller = new StreamController(); |
| 127 Future.forEach(_platforms, (platform) { | 128 Future.forEach(_platforms, (platform) { |
| 128 if (!metadata.testOn.evaluate(platform, os: currentOS)) { | 129 if (!metadata.testOn.evaluate(platform, os: currentOS)) { |
| 129 return new Future.value(); | 130 return new Future.value(); |
| 130 } | 131 } |
| 131 | 132 |
| 133 // Don't load a skipped suite. |
| 134 if (metadata.skip) { |
| 135 return new Future.value(new Suite([ |
| 136 new LocalTest(path, metadata, () {}) |
| 137 ], path: path, platform: platform.name, metadata: metadata)); |
| 138 } |
| 139 |
| 132 return new Future.sync(() { | 140 return new Future.sync(() { |
| 133 if (_pubServeUrl != null && !p.isWithin('test', path)) { | 141 if (_pubServeUrl != null && !p.isWithin('test', path)) { |
| 134 throw new LoadException(path, | 142 throw new LoadException(path, |
| 135 'When using "pub serve", all test files must be in test/.'); | 143 'When using "pub serve", all test files must be in test/.'); |
| 136 } | 144 } |
| 137 | 145 |
| 138 if (platform == TestPlatform.vm) return _loadVmFile(path, metadata); | 146 if (platform == TestPlatform.vm) return _loadVmFile(path, metadata); |
| 139 assert(platform.isBrowser); | 147 assert(platform.isBrowser); |
| 140 return _loadBrowserFile(path, platform, metadata); | 148 return _loadBrowserFile(path, platform, metadata); |
| 141 }).then((suite) { | 149 }).then((suite) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 Future close() { | 238 Future close() { |
| 231 for (var isolate in _isolates) { | 239 for (var isolate in _isolates) { |
| 232 isolate.kill(); | 240 isolate.kill(); |
| 233 } | 241 } |
| 234 _isolates.clear(); | 242 _isolates.clear(); |
| 235 | 243 |
| 236 if (_browserServerCompleter == null) return new Future.value(); | 244 if (_browserServerCompleter == null) return new Future.value(); |
| 237 return _browserServer.then((browserServer) => browserServer.close()); | 245 return _browserServer.then((browserServer) => browserServer.close()); |
| 238 } | 246 } |
| 239 } | 247 } |
| OLD | NEW |