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

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..ed77d7a61b8cde675930b5a41b68def142a1ce67 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 subscribedToStream(VM vm, String streamName, onEvent) async {
turnidge 2016/03/03 19:18:16 how do you feel about calling this subscribeToStre
Cutch 2016/03/03 19:43:25 Done.
+ 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;

Powered by Google App Engine
This is Rietveld 408576698