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

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

Issue 1241683005: Support piping log data over the service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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/test_helper.dart
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index 53520c443187ced1eb7e3ab8e7109bdc86e84c42..0ec5345bda01ea50eaff98a4d5b17d699e131373 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -237,6 +237,29 @@ Future<Isolate> resumeIsolate(Isolate isolate) {
}
+Future streamEvent(Isolate isolate, stream, onEvent) async {
+ Completer completer = new Completer();
+ var sub;
+ sub = await isolate.vm.listenEventStream(
+ stream,
+ (ServiceEvent event) {
+ var r = onEvent(event);
+ if (r is! Future) {
+ r = new Future.value(r);
+ }
+ r.then((x) => sub.cancel().then((_) {
+ completer.complete();
+ }));
+ });
+ await isolate.resume();
+ return completer.future;
+}
+
+IsolateTest isolateStreamEvent(stream, onEvent) {
rmacnak 2015/07/21 00:20:15 This name doesn't suggest it resumes the isolate.
Cutch 2015/07/21 14:51:44 Done.
+ return (Isolate isolate) async => streamEvent(isolate, stream, onEvent);
+}
+
+
Future<Class> getClassFromRootLib(Isolate isolate, String className) async {
Library rootLib = await isolate.rootLibrary.load();
for (var i = 0; i < rootLib.classes.length; i++) {

Powered by Google App Engine
This is Rietveld 408576698