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

Unified Diff: runtime/observatory/tests/service/test_helper.dart

Issue 1128583002: Add hasStoppedAtBreakpoint (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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: runtime/observatory/tests/service/test_helper.dart
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index 5fd2344a826819de3e2a319ed3e9208a5ddd0ef4..fd639339c41e9fc74aa99ab03685e4c671d309bd 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -151,6 +151,28 @@ Future processServiceEvents(VM vm, ServiceEventHandler handler) {
}
+Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) {
+ if ((isolate.pauseEvent != null) &&
+ (isolate.pauseEvent.eventType == ServiceEvent.kPauseBreakpoint)) {
+ // Already waiting at a breakpoint.
+ print('Breakpoint reached');
+ return new Future.value(isolate);
+ }
+
+ // Set up a listener to wait for breakpoint events.
+ Completer completer = new Completer();
+ var subscription;
+ subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
+ if (event.eventType == ServiceEvent.kPauseBreakpoint) {
+ print('Breakpoint reached');
+ subscription.cancel();
+ completer.complete(isolate);
+ }
+ });
+
+ return completer.future; // Will complete when breakpoint hit.
+}
+
/// Runs [tests] in sequence, each of which should take an [Isolate] and
/// return a [Future]. Code for setting up state can run before and/or
/// concurrently with the tests. Uses [mainArgs] to determine whether
« no previous file with comments | « runtime/observatory/tests/service/get_stack_rpc_test.dart ('k') | tests/lib/mirrors/invocation_fuzz_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698