| OLD | NEW |
| 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 | |
| 5 | 4 |
| 6 library test_helper; | 5 library test_helper; |
| 7 | 6 |
| 8 import 'dart:async'; | 7 import 'dart:async'; |
| 9 import 'dart:convert'; | 8 import 'dart:convert'; |
| 10 import 'dart:io'; | 9 import 'dart:io'; |
| 11 import 'package:observatory/service_io.dart'; | 10 import 'package:observatory/service_io.dart'; |
| 12 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 13 | 12 |
| 14 bool _isWebSocketDisconnect(e) { | 13 bool _isWebSocketDisconnect(e) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Set up a listener to wait for breakpoint events. | 159 // Set up a listener to wait for breakpoint events. |
| 161 Completer completer = new Completer(); | 160 Completer completer = new Completer(); |
| 162 isolate.vm.getEventStream(VM.kDebugStream).then((stream) { | 161 isolate.vm.getEventStream(VM.kDebugStream).then((stream) { |
| 163 var subscription; | 162 var subscription; |
| 164 subscription = stream.listen((ServiceEvent event) { | 163 subscription = stream.listen((ServiceEvent event) { |
| 165 print("Event: $event"); | 164 print("Event: $event"); |
| 166 if (event.kind == ServiceEvent.kPauseBreakpoint) { | 165 if (event.kind == ServiceEvent.kPauseBreakpoint) { |
| 167 print('Breakpoint reached'); | 166 print('Breakpoint reached'); |
| 168 subscription.cancel(); | 167 subscription.cancel(); |
| 169 if (completer != null) { | 168 if (completer != null) { |
| 170 completer.complete(isolate); | 169 // Reload to update isolate.pauseEvent. |
| 170 completer.complete(isolate.reload()); |
| 171 completer = null; | 171 completer = null; |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 }); | 174 }); |
| 175 | 175 |
| 176 // Pause may have happened before we subscribed. | 176 // Pause may have happened before we subscribed. |
| 177 isolate.reload().then((_) { | 177 isolate.reload().then((_) { |
| 178 if ((isolate.pauseEvent != null) && | 178 if ((isolate.pauseEvent != null) && |
| 179 (isolate.pauseEvent.kind == ServiceEvent.kPauseBreakpoint)) { | 179 (isolate.pauseEvent.kind == ServiceEvent.kPauseBreakpoint)) { |
| 180 // Already waiting at a breakpoint. | 180 // Already waiting at a breakpoint. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 }, onError: (e, st) { | 312 }, onError: (e, st) { |
| 313 process.requestExit(); | 313 process.requestExit(); |
| 314 if (!_isWebSocketDisconnect(e)) { | 314 if (!_isWebSocketDisconnect(e)) { |
| 315 print('Unexpected exception in service tests: $e $st'); | 315 print('Unexpected exception in service tests: $e $st'); |
| 316 throw e; | 316 throw e; |
| 317 } | 317 } |
| 318 }); | 318 }); |
| 319 }); | 319 }); |
| 320 } | 320 } |
| 321 } | 321 } |
| OLD | NEW |