Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Unified Diff: lib/src/runner/loader.dart

Issue 1309493002: Add a hacky hook to override the loader behavior. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | pubspec.yaml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/loader.dart
diff --git a/lib/src/runner/loader.dart b/lib/src/runner/loader.dart
index 68f94d6f7fe031760200b3a01adfd584d5792030..e23aef3d7825b964f48a8d48abb959c1a1387b4b 100644
--- a/lib/src/runner/loader.dart
+++ b/lib/src/runner/loader.dart
@@ -29,8 +29,20 @@ import 'runner_suite.dart';
import 'vm/environment.dart';
import 'vm/isolate_test.dart';
+typedef Future<RunnerSuite> LoadVMFileHook(String path, Metadata metadata,
+ Configuration config);
+
/// A class for finding test files and loading them into a runnable form.
class Loader {
+ /// **Do not set or use this function without express permission from the test
+ /// package authors**.
+ ///
+ /// A function that overrides the loader's default behavior for loading test
+ /// suites on the Dart VM. This function takes the path to the file, the
+ /// file's metadata, and the test runner's configuration and returns a
+ /// [RunnerSuite] for that file.
+ static LoadVMFileHook loadVMFileHook;
Bob Nystrom 2015/08/20 22:04:47 Maybe put this in a separate scary-named library?
nweiz 2015/08/20 22:19:02 Done. Not attaching it to Loader will also make li
+
/// The test runner configuration.
final Configuration _config;
@@ -144,6 +156,12 @@ class Loader {
///
/// [metadata] is the suite-level metadata for the test.
Future<RunnerSuite> _loadVmFile(String path, Metadata metadata) async {
+ if (Loader.loadVMFileHook != null) {
+ var suite = await Loader.loadVMFileHook(path, metadata, _config);
+ _suites.add(suite);
+ return suite;
+ }
+
var receivePort = new ReceivePort();
var isolate;
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | pubspec.yaml » ('J')

Powered by Google App Engine
This is Rietveld 408576698