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; |
11 | 11 |
12 import '../backend/group.dart'; | 12 import '../backend/group.dart'; |
13 import '../backend/metadata.dart'; | 13 import '../backend/metadata.dart'; |
14 import '../backend/test_platform.dart'; | 14 import '../backend/test_platform.dart'; |
15 import '../util/io.dart'; | 15 import '../util/io.dart'; |
16 import '../utils.dart'; | 16 import '../utils.dart'; |
17 import 'browser/platform.dart'; | 17 import 'browser/platform.dart'; |
18 import 'configuration.dart'; | 18 import 'configuration.dart'; |
19 import 'load_exception.dart'; | 19 import 'load_exception.dart'; |
20 import 'load_suite.dart'; | 20 import 'load_suite.dart'; |
21 import 'parse_metadata.dart'; | 21 import 'parse_metadata.dart'; |
22 import 'plugin/environment.dart'; | 22 import 'plugin/environment.dart'; |
| 23 import 'plugin/hack_register_platform.dart'; |
23 import 'plugin/platform.dart'; | 24 import 'plugin/platform.dart'; |
24 import 'runner_suite.dart'; | 25 import 'runner_suite.dart'; |
25 import 'vm/platform.dart'; | 26 import 'vm/platform.dart'; |
26 | 27 |
27 /// 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. |
28 class Loader { | 29 class Loader { |
29 /// The test runner configuration. | 30 /// The test runner configuration. |
30 final Configuration _config; | 31 final Configuration _config; |
31 | 32 |
32 /// The root directory that will be served for browser tests. | 33 /// The root directory that will be served for browser tests. |
(...skipping 19 matching lines...) Expand all Loading... |
52 registerPlatformPlugin([TestPlatform.vm], () => new VMPlatform(_config)); | 53 registerPlatformPlugin([TestPlatform.vm], () => new VMPlatform(_config)); |
53 registerPlatformPlugin([ | 54 registerPlatformPlugin([ |
54 TestPlatform.dartium, | 55 TestPlatform.dartium, |
55 TestPlatform.contentShell, | 56 TestPlatform.contentShell, |
56 TestPlatform.chrome, | 57 TestPlatform.chrome, |
57 TestPlatform.phantomJS, | 58 TestPlatform.phantomJS, |
58 TestPlatform.firefox, | 59 TestPlatform.firefox, |
59 TestPlatform.safari, | 60 TestPlatform.safari, |
60 TestPlatform.internetExplorer | 61 TestPlatform.internetExplorer |
61 ], () => BrowserPlatform.start(_config, root: root)); | 62 ], () => BrowserPlatform.start(_config, root: root)); |
| 63 |
| 64 platformCallbacks.forEach((platform, plugin) { |
| 65 registerPlatformPlugin([platform], plugin); |
| 66 }); |
62 } | 67 } |
63 | 68 |
64 /// Registers a [PlatformPlugin] for [platforms]. | 69 /// Registers a [PlatformPlugin] for [platforms]. |
65 /// | 70 /// |
66 /// When the runner first requests that a suite be loaded for one of the given | 71 /// When the runner first requests that a suite be loaded for one of the given |
67 /// platforms, this will call [getPlugin] to load the platform plugin. It may | 72 /// platforms, this will call [getPlugin] to load the platform plugin. It may |
68 /// return either a [PlatformPlugin] or a [Future<PlatformPlugin>]. That | 73 /// return either a [PlatformPlugin] or a [Future<PlatformPlugin>]. That |
69 /// plugin is then preserved and used to load all suites for all matching | 74 /// plugin is then preserved and used to load all suites for all matching |
70 /// platforms. | 75 /// platforms. |
71 /// | 76 /// |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 })), | 181 })), |
177 Future.wait(_suites.map((suite) => suite.close())) | 182 Future.wait(_suites.map((suite) => suite.close())) |
178 ]); | 183 ]); |
179 | 184 |
180 _platformPlugins.clear(); | 185 _platformPlugins.clear(); |
181 _platformCallbacks.clear(); | 186 _platformCallbacks.clear(); |
182 _suites.clear(); | 187 _suites.clear(); |
183 }); | 188 }); |
184 final _closeMemo = new AsyncMemoizer(); | 189 final _closeMemo = new AsyncMemoizer(); |
185 } | 190 } |
OLD | NEW |