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

Unified Diff: lib/src/runner/browser/iframe_test.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.dart ('k') | lib/src/runner/console.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/browser/iframe_test.dart
diff --git a/lib/src/runner/browser/iframe_test.dart b/lib/src/runner/browser/iframe_test.dart
index 8711dddc6e49b5009fa52a3ab91a14ece933ff67..6077dde7091a493e937338e7fd42cb4c28d2777c 100644
--- a/lib/src/runner/browser/iframe_test.dart
+++ b/lib/src/runner/browser/iframe_test.dart
@@ -13,6 +13,7 @@ import '../../backend/state.dart';
import '../../backend/suite.dart';
import '../../backend/test.dart';
import '../../backend/test_platform.dart';
+import '../../utils.dart';
import '../../util/multi_channel.dart';
import '../../util/remote_exception.dart';
import '../../util/stack_trace_mapper.dart';
@@ -63,13 +64,27 @@ class IframeTest extends Test {
assert(message['type'] == 'complete');
controller.completer.complete();
}
+ }, onDone: () {
+ // When the test channel closes—presumably becuase the browser
+ // closed—mark the test as complete no matter what.
+ if (controller.completer.isCompleted) return;
+ controller.completer.complete();
});
}, () {
- // Ignore all future messages from the test and complete it immediately.
- // We don't need to tell it to run its tear-down because there's nothing a
- // browser test needs to clean up on the file system anyway.
- testChannel.sink.close();
- if (!controller.completer.isCompleted) controller.completer.complete();
+ // If the test has finished running, just disconnect the channel.
+ if (controller.completer.isCompleted) {
+ testChannel.sink.close();
+ return;
+ }
+
+ invoke(() async {
+ // If the test is still running, send it a message telling it to shut
+ // down ASAP. This causes the [Invoker] to eagerly throw exceptions
+ // whenever the test touches it.
+ testChannel.sink.add({'command': 'close'});
+ await controller.completer.future;
+ testChannel.sink.close();
+ });
}, groups: groups);
return controller.liveTest;
}
« no previous file with comments | « lib/src/runner.dart ('k') | lib/src/runner/console.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698