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

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

Issue 1765563002: Stream blocks of timeline events over the service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 872d994c547bdcc38032eab6ef9bdbe37ff4d638..108316c3030fb0f056c5157662ed0cc5d57fe347 100644
--- a/runtime/observatory/tests/service/service_test_common.dart
+++ b/runtime/observatory/tests/service/service_test_common.dart
@@ -11,6 +11,22 @@ import 'package:unittest/unittest.dart';
typedef Future IsolateTest(Isolate isolate);
typedef Future VMTest(VM vm);
+Map<String, StreamSubscription> streamSubscriptions = {};
+
+Future subscribeToStream(VM vm, String streamName, onEvent) async {
+ assert(streamSubscriptions[streamName] == null);
+
+ Stream stream = await vm.getEventStream(streamName);
+ StreamSubscription subscription = stream.listen(onEvent);
+ streamSubscriptions[streamName] = subscription;
+}
+
+Future cancelStreamSubscription(String streamName) async {
+ StreamSubscription subscription = streamSubscriptions[streamName];
+ subscription.cancel();
+ streamSubscriptions.remove(streamName);
+}
+
Future asyncStepOver(Isolate isolate) async {
final Completer pausedAtSyntheticBreakpoint = new Completer();
StreamSubscription subscription;
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/observatory/tests/service/vm_timeline_events_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698