Index: runtime/observatory/tests/service/step_test.dart |
diff --git a/runtime/observatory/tests/service/step_test.dart b/runtime/observatory/tests/service/step_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..47009dc490aba26ec85107030121a4faa2f76809 |
--- /dev/null |
+++ b/runtime/observatory/tests/service/step_test.dart |
@@ -0,0 +1,38 @@ |
+import 'dart:async'; |
+import 'test_helper.dart'; |
+import 'service_test_common.dart'; |
+import 'package:observatory/service_io.dart'; |
+import 'package:unittest/unittest.dart'; |
+ |
+const int LINE_A = 10; |
+ |
+code() { |
+ var x = {}; // LINE_A |
+} |
+ |
+Future<Isolate> stepThroughProgram(Isolate isolate) async { |
+ Completer completer = new Completer(); |
+ int pauseEventsSeen = 0; |
+ |
+ await subscribeToStream(isolate.vm, VM.kDebugStream, |
+ (ServiceEvent event) async { |
+ if (event.kind == ServiceEvent.kPauseBreakpoint) { |
+ // We are paused: Step further. |
+ pauseEventsSeen++; |
+ isolate.stepInto(); |
+ } else if (event.kind == ServiceEvent.kPauseExit) { |
+ // We are at the exit: The test is done. |
+ expect(pauseEventsSeen > 20, true, |
+ reason: "Saw only $pauseEventsSeen pause events."); |
+ await cancelStreamSubscription(VM.kDebugStream); |
+ completer.complete(); |
+ } |
+ }); |
+ isolate.resume(); |
+ return completer.future; |
+} |
+ |
+var tests = [hasPausedAtStart, setBreakpointAtLine(LINE_A), stepThroughProgram]; |
+ |
+main(args) => runIsolateTestsSynchronous(args, tests, |
+ testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |