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; |