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

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

Issue 1561073003: Support re-running tests while debugging. (Closed) Base URL: git@github.com:dart-lang/test@debugger-wip
Patch Set: Code review changes 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
« no previous file with comments | « lib/src/runner/debugger.dart ('k') | lib/src/runner/loader.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/engine.dart
diff --git a/lib/src/runner/engine.dart b/lib/src/runner/engine.dart
index bddf8785259ffc1a71a593edf65cde53a4bdad07..c88ff1025f510f8bda1723a313b372aed51d041d 100644
--- a/lib/src/runner/engine.dart
+++ b/lib/src/runner/engine.dart
@@ -138,6 +138,12 @@ class Engine {
/// This includes load tests, `setUpAll`, and `tearDownAll`.
final _hidden = new Set<LiveTest>();
+ /// The set of tests that have been marked for restarting.
+ ///
+ /// This is always a subset of [active]. Once a test in here has finished
+ /// running, it's run again.
+ final _restarted = new Set<LiveTest>();
+
/// The tests from [LoadSuite]s that are still running, in the order they
/// began running.
///
@@ -324,6 +330,29 @@ class Engine {
// non-microtask events.
await new Future.microtask(liveTest.run);
await new Future(() {});
+
+ if (!_restarted.contains(liveTest)) return;
+ await _runLiveTest(liveTest.copy(), countSuccess: countSuccess);
+ _restarted.remove(liveTest);
+ }
+
+ /// Closes [liveTest] and tells the engine to re-run it once it's done
+ /// running.
+ ///
+ /// Returns the same future as [LiveTest.close].
+ Future restartTest(LiveTest liveTest) async {
+ if (_activeLoadTests.contains(liveTest)) {
+ throw new ArgumentError("Can't restart a load test.");
+ }
+
+ if (!_active.contains(liveTest)) {
+ throw new StateError("Can't restart inactive test "
+ "\"${liveTest.test.name}\".");
+ }
+
+ _restarted.add(liveTest);
+ _active.remove(liveTest);
+ await liveTest.close();
}
/// Adds listeners for [suite].
« no previous file with comments | « lib/src/runner/debugger.dart ('k') | lib/src/runner/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698