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

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

Issue 1641353002: Expand the JSON reporter to enable a progress bar. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 11 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
Index: lib/src/runner/engine.dart
diff --git a/lib/src/runner/engine.dart b/lib/src/runner/engine.dart
index b9a083b5b9e7ea7822517337dcfcd83f685666a1..b92168eb7973288dd1cd48618b61c76d0c57c041 100644
--- a/lib/src/runner/engine.dart
+++ b/lib/src/runner/engine.dart
@@ -95,6 +95,23 @@ class Engine {
Sink<RunnerSuite> get suiteSink => new DelegatingSink(_suiteController.sink);
final _suiteController = new StreamController<RunnerSuite>();
+ /// All the [RunnerSuite]s added to [suiteSink] so far.
+ ///
+ /// Note that if a [LoadSuite] is added, this will only contain that suite,
+ /// not the suite it loads.
+ Set<RunnerSuite> get addedSuites => new UnmodifiableSetView(_addedSuites);
+ final _addedSuites = new Set<RunnerSuite>();
+
+ /// A broadcast that emits each [RunnerSuite] as it's added to the engine via
+ /// [suiteSink].
+ ///
+ /// Note that if a [LoadSuite] is added, this will only return that suite, not
+ /// the suite it loads.
+ ///
+ /// This is guaranteed to fire after the suite is added to [addedSuites].
+ Stream<RunnerSuite> get onSuiteAdded => _onSuiteAddedController.stream;
+ final _onSuiteAddedController = new StreamController<RunnerSuite>.broadcast();
+
/// All the currently-known tests that have run, are running, or will run.
///
/// These are [LiveTest]s, representing the in-progress state of each test.
@@ -196,6 +213,9 @@ class Engine {
_runCalled = true;
_suiteController.stream.listen((suite) {
+ _addedSuites.add(suite);
+ _onSuiteAddedController.add(suite);
+
_group.add(new Future.sync(() async {
var loadResource = await _loadPool.request();
@@ -213,7 +233,10 @@ class Engine {
loadResource.allowRelease(() => suite.close());
});
}));
- }, onDone: _group.close);
+ }, onDone: () {
+ _onSuiteAddedController.close();
+ _group.close();
+ });
return success;
}
@@ -414,6 +437,7 @@ class Engine {
Future close() async {
_closed = true;
if (_closedBeforeDone != null) _closedBeforeDone = true;
+ _onSuiteAddedController.close();
_suiteController.close();
// Close the running tests first so that we're sure to wait for them to

Powered by Google App Engine
This is Rietveld 408576698