| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 | 4 |
| 5 library service_test_common; | 5 library service_test_common; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'package:observatory/models.dart' as M; | 8 import 'package:observatory/models.dart' as M; |
| 9 import 'package:observatory/service_common.dart'; | 9 import 'package:observatory/service_common.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 return false; | 150 return false; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 Future<Isolate> hasPausedFor(Isolate isolate, String kind) { | 154 Future<Isolate> hasPausedFor(Isolate isolate, String kind) { |
| 155 // Set up a listener to wait for breakpoint events. | 155 // Set up a listener to wait for breakpoint events. |
| 156 Completer completer = new Completer(); | 156 Completer completer = new Completer(); |
| 157 isolate.vm.getEventStream(VM.kDebugStream).then((stream) { | 157 isolate.vm.getEventStream(VM.kDebugStream).then((stream) { |
| 158 var subscription; | 158 var subscription; |
| 159 subscription = stream.listen((ServiceEvent event) { | 159 subscription = stream.listen((ServiceEvent event) { |
| 160 if (event.kind == kind) { | 160 if ((isolate == event.isolate) && (event.kind == kind)) { |
| 161 if (completer != null) { | 161 if (completer != null) { |
| 162 // Reload to update isolate.pauseEvent. | 162 // Reload to update isolate.pauseEvent. |
| 163 print('Paused with $kind'); | 163 print('Paused with $kind'); |
| 164 subscription.cancel(); | 164 subscription.cancel(); |
| 165 completer.complete(isolate.reload()); | 165 completer.complete(isolate.reload()); |
| 166 completer = null; | 166 completer = null; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 }); | 169 }); |
| 170 | 170 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 Future<Instance> rootLibraryFieldValue(Isolate isolate, | 369 Future<Instance> rootLibraryFieldValue(Isolate isolate, |
| 370 String fieldName) async { | 370 String fieldName) async { |
| 371 Library rootLib = await isolate.rootLibrary.load(); | 371 Library rootLib = await isolate.rootLibrary.load(); |
| 372 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); | 372 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); |
| 373 await field.load(); | 373 await field.load(); |
| 374 Instance value = field.staticValue; | 374 Instance value = field.staticValue; |
| 375 await value.load(); | 375 await value.load(); |
| 376 return value; | 376 return value; |
| 377 } | 377 } |
| OLD | NEW |