| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:io'; | 6 import 'dart:io'; |
| 7 | 7 |
| 8 import 'package:analyzer/analyzer.dart' hide Configuration; | 8 import 'package:analyzer/analyzer.dart' hide Configuration; |
| 9 import 'package:async/async.dart'; | 9 import 'package:async/async.dart'; |
| 10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 import 'plugin/hack_register_platform.dart'; | 23 import 'plugin/hack_register_platform.dart'; |
| 24 import 'plugin/platform.dart'; | 24 import 'plugin/platform.dart'; |
| 25 import 'runner_suite.dart'; | 25 import 'runner_suite.dart'; |
| 26 import 'vm/platform.dart'; | 26 import 'vm/platform.dart'; |
| 27 | 27 |
| 28 /// A class for finding test files and loading them into a runnable form. | 28 /// A class for finding test files and loading them into a runnable form. |
| 29 class Loader { | 29 class Loader { |
| 30 /// The test runner configuration. | 30 /// The test runner configuration. |
| 31 final Configuration _config; | 31 final Configuration _config; |
| 32 | 32 |
| 33 /// The root directory that will be served for browser tests. | |
| 34 final String _root; | |
| 35 | |
| 36 /// All suites that have been created by the loader. | 33 /// All suites that have been created by the loader. |
| 37 final _suites = new Set<RunnerSuite>(); | 34 final _suites = new Set<RunnerSuite>(); |
| 38 | 35 |
| 39 /// Memoizers for platform plugins, indexed by the platforms they support. | 36 /// Memoizers for platform plugins, indexed by the platforms they support. |
| 40 final _platformPlugins = <TestPlatform, AsyncMemoizer<PlatformPlugin>>{}; | 37 final _platformPlugins = <TestPlatform, AsyncMemoizer<PlatformPlugin>>{}; |
| 41 | 38 |
| 42 /// The functions to use to load [_platformPlugins]. | 39 /// The functions to use to load [_platformPlugins]. |
| 43 /// | 40 /// |
| 44 /// These are passed to the plugins' async memoizers when a plugin is needed. | 41 /// These are passed to the plugins' async memoizers when a plugin is needed. |
| 45 final _platformCallbacks = <TestPlatform, AsyncFunction>{}; | 42 final _platformCallbacks = <TestPlatform, AsyncFunction>{}; |
| 46 | 43 |
| 47 /// Creates a new loader that loads tests on platforms defined in [_config]. | 44 /// Creates a new loader that loads tests on platforms defined in [_config]. |
| 48 /// | 45 /// |
| 49 /// [root] is the root directory that will be served for browser tests. It | 46 /// [root] is the root directory that will be served for browser tests. It |
| 50 /// defaults to the working directory. | 47 /// defaults to the working directory. |
| 51 Loader(this._config, {String root}) | 48 Loader(this._config, {String root}) { |
| 52 : _root = root == null ? p.current : root { | |
| 53 registerPlatformPlugin([TestPlatform.vm], () => new VMPlatform(_config)); | 49 registerPlatformPlugin([TestPlatform.vm], () => new VMPlatform(_config)); |
| 54 registerPlatformPlugin([ | 50 registerPlatformPlugin([ |
| 55 TestPlatform.dartium, | 51 TestPlatform.dartium, |
| 56 TestPlatform.contentShell, | 52 TestPlatform.contentShell, |
| 57 TestPlatform.chrome, | 53 TestPlatform.chrome, |
| 58 TestPlatform.phantomJS, | 54 TestPlatform.phantomJS, |
| 59 TestPlatform.firefox, | 55 TestPlatform.firefox, |
| 60 TestPlatform.safari, | 56 TestPlatform.safari, |
| 61 TestPlatform.internetExplorer | 57 TestPlatform.internetExplorer |
| 62 ], () => BrowserPlatform.start(_config, root: root)); | 58 ], () => BrowserPlatform.start(_config, root: root)); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 })), | 177 })), |
| 182 Future.wait(_suites.map((suite) => suite.close())) | 178 Future.wait(_suites.map((suite) => suite.close())) |
| 183 ]); | 179 ]); |
| 184 | 180 |
| 185 _platformPlugins.clear(); | 181 _platformPlugins.clear(); |
| 186 _platformCallbacks.clear(); | 182 _platformCallbacks.clear(); |
| 187 _suites.clear(); | 183 _suites.clear(); |
| 188 }); | 184 }); |
| 189 final _closeMemo = new AsyncMemoizer(); | 185 final _closeMemo = new AsyncMemoizer(); |
| 190 } | 186 } |
| OLD | NEW |