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

Side by Side Diff: runtime/observatory/tests/service/test_helper.dart

Issue 1152283005: Revert "Add the streamListen and streamCancel rpcs to the vm service." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « runtime/observatory/tests/service/steal_breakpoint_test.dart ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override --checked 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override --checked
5 5
6 library test_helper; 6 library test_helper;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:convert'; 9 import 'dart:convert';
10 import 'dart:io'; 10 import 'dart:io';
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 131 }
132 } 132 }
133 133
134 134
135 // Cancel the subscription and complete the completer when finished processing 135 // Cancel the subscription and complete the completer when finished processing
136 // events. 136 // events.
137 typedef void ServiceEventHandler(ServiceEvent event, 137 typedef void ServiceEventHandler(ServiceEvent event,
138 StreamSubscription subscription, 138 StreamSubscription subscription,
139 Completer completer); 139 Completer completer);
140 140
141 Future processServiceEvents(VM vm, 141 Future processServiceEvents(VM vm, ServiceEventHandler handler) {
142 String streamId,
143 ServiceEventHandler handler) {
144 Completer completer = new Completer(); 142 Completer completer = new Completer();
145 var subscription; 143 var subscription;
146 subscription = vm.getEventStream(streamId).listen((ServiceEvent event) { 144 subscription = vm.events.stream.listen((ServiceEvent event) {
147 handler(event, subscription, completer); 145 handler(event, subscription, completer);
148 }); 146 });
149 return completer.future; 147 return completer.future;
150 } 148 }
151 149
152 150
153 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) { 151 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) {
154 if ((isolate.pauseEvent != null) && 152 if ((isolate.pauseEvent != null) &&
155 (isolate.pauseEvent.eventType == ServiceEvent.kPauseBreakpoint)) { 153 (isolate.pauseEvent.eventType == ServiceEvent.kPauseBreakpoint)) {
156 // Already waiting at a breakpoint. 154 // Already waiting at a breakpoint.
157 print('Breakpoint reached'); 155 print('Breakpoint reached');
158 return new Future.value(isolate); 156 return new Future.value(isolate);
159 } 157 }
160 158
161 // Set up a listener to wait for breakpoint events. 159 // Set up a listener to wait for breakpoint events.
162 Completer completer = new Completer(); 160 Completer completer = new Completer();
163 var subscription; 161 var subscription;
164 subscription = isolate.vm.debugEvents.listen((ServiceEvent event) { 162 subscription = isolate.vm.events.stream.listen((ServiceEvent event) {
165 if (event.eventType == ServiceEvent.kPauseBreakpoint) { 163 if (event.eventType == ServiceEvent.kPauseBreakpoint) {
166 print('Breakpoint reached'); 164 print('Breakpoint reached');
167 subscription.cancel(); 165 subscription.cancel();
168 completer.complete(isolate); 166 completer.complete(isolate);
169 } 167 }
170 }); 168 });
171 169
172 return completer.future; // Will complete when breakpoint hit. 170 return completer.future; // Will complete when breakpoint hit.
173 } 171 }
174 172
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 }, onError: (e, st) { 206 }, onError: (e, st) {
209 process.requestExit(); 207 process.requestExit();
210 if (!_isWebSocketDisconnect(e)) { 208 if (!_isWebSocketDisconnect(e)) {
211 print('Unexpected exception in service tests: $e $st'); 209 print('Unexpected exception in service tests: $e $st');
212 throw e; 210 throw e;
213 } 211 }
214 }); 212 });
215 }); 213 });
216 } 214 }
217 } 215 }
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/steal_breakpoint_test.dart ('k') | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698