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

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

Issue 2680303002: Kernel debugging; service tests (Closed)
Patch Set: Address comments Created 3 years, 9 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/service_test_common.dart
diff --git a/runtime/observatory/tests/service/service_test_common.dart b/runtime/observatory/tests/service/service_test_common.dart
index 44d82f221d89653e2296deb8f866a880b5c3804d..837d237c7ef50e270b374047754f1cb375298182 100644
--- a/runtime/observatory/tests/service/service_test_common.dart
+++ b/runtime/observatory/tests/service/service_test_common.dart
@@ -397,3 +397,45 @@ Future<Instance> rootLibraryFieldValue(Isolate isolate,
await value.load();
return value;
}
+
+IsolateTest runStepThroughProgramRecordingStops(List<String> recordStops) {
+ return (Isolate isolate) async {
+ Completer completer = new Completer();
+
+ await subscribeToStream(isolate.vm, VM.kDebugStream,
+ (ServiceEvent event) async {
+ if (event.kind == ServiceEvent.kPauseBreakpoint) {
+ await isolate.reload();
+ // We are paused: Step further.
+ Frame frame = isolate.topFrame;
+ recordStops.add(await frame.location.toUserString());
+ if (event.atAsyncSuspension) {
+ isolate.stepOverAsyncSuspension();
+ } else {
+ isolate.stepOver();
+ }
+ } else if (event.kind == ServiceEvent.kPauseExit) {
+ // We are at the exit: The test is done.
+ await cancelStreamSubscription(VM.kDebugStream);
+ completer.complete();
+ }
+ });
+ isolate.resume();
+ return completer.future;
+ };
+}
+
+IsolateTest checkRecordedStops(
+ List<String> recordStops, List<String> expectedStops) {
+ return (Isolate isolate) async {
+ int end = recordStops.length < expectedStops.length
+ ? recordStops.length
+ : expectedStops.length;
+ for (int i = 0; i < end; ++i) {
+ expect(recordStops[i], expectedStops[i]);
+ }
+
+ expect(recordStops.length >= expectedStops.length, true,
+ reason: "Expects at least ${expectedStops.length} breaks.");
+ };
+}
« no previous file with comments | « runtime/observatory/tests/service/service_kernel.status ('k') | runtime/observatory/tests/service/step_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698