Chromium Code Reviews| Index: lib/src/runner/plugin/hack_register_platform.dart |
| diff --git a/lib/src/runner/plugin/hack_register_platform.dart b/lib/src/runner/plugin/hack_register_platform.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ce2cfbf56dba545432f764e92ea6ea5eba4717ab |
| --- /dev/null |
| +++ b/lib/src/runner/plugin/hack_register_platform.dart |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +import 'dart:collection'; |
| + |
| +import '../../backend/test_platform.dart'; |
| +import '../../utils.dart'; |
| +import 'platform.dart'; |
| + |
| +/// The functions to use to load [_platformPlugins] in all loaders. |
| +/// |
| +/// **Do not access this outside the test package**. |
| +final platformCallbacks = |
| + new UnmodifiableMapView<TestPlatform, AsyncFunction>(_platformCallbacks); |
| +final _platformCallbacks = <TestPlatform, AsyncFunction>{}; |
| + |
| +/// **Do not call this function without express permission from the test package |
| +/// authors**. |
| +/// |
| +/// Registers a [PlatformPlugin] for [platforms]. |
| +/// |
| +/// This globally registers a plugin for all [Loader]s. When the runner first |
| +/// requests that a suite be loaded for one of the given platforms, this will |
| +/// call [getPlugin] to load the platform plugin. It may return either a |
| +/// [PlatformPlugin] or a [Future<PlatformPlugin>]. That plugin is then |
| +/// preserved and used to load all suites for all matching platforms. |
| +/// |
| +/// This overwrites the default plugins for those platforms. |
| +void registerPlatformPlugin(Iterable<TestPlatform> platforms, getPlugin()) { |
|
kevmoo
2016/02/23 22:54:50
Feels weird that getPlugin() doesn't take in an ar
nweiz
2016/02/24 00:21:22
What arg do you expect it to take in?
kevmoo
2016/02/24 00:28:54
The platform? – although I guess you can call this
|
| + for (var platform in platforms) { |
| + _platformCallbacks[platform] = getPlugin; |
| + } |
| +} |