| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 Future<Isolate> hasStoppedAtExit(Isolate isolate) { | 201 Future<Isolate> hasStoppedAtExit(Isolate isolate) { |
| 202 return hasPausedFor(isolate, ServiceEvent.kPauseExit); | 202 return hasPausedFor(isolate, ServiceEvent.kPauseExit); |
| 203 } | 203 } |
| 204 | 204 |
| 205 Future<Isolate> hasPausedAtStart(Isolate isolate) { | 205 Future<Isolate> hasPausedAtStart(Isolate isolate) { |
| 206 return hasPausedFor(isolate, ServiceEvent.kPauseStart); | 206 return hasPausedFor(isolate, ServiceEvent.kPauseStart); |
| 207 } | 207 } |
| 208 | 208 |
| 209 Future<Isolate> markDartColonLibrariesDebuggable(Isolate isolate) async { |
| 210 await isolate.reload(); |
| 211 for (Library lib in isolate.libraries) { |
| 212 await lib.load(); |
| 213 if (lib.uri.startsWith('dart:') && |
| 214 !lib.uri.startsWith('dart:_')) { |
| 215 var setDebugParams = { |
| 216 'libraryId': lib.id, |
| 217 'isDebuggable': true, |
| 218 }; |
| 219 Map<String, dynamic> result = |
| 220 await isolate.invokeRpcNoUpgrade('setLibraryDebuggable', |
| 221 setDebugParams); |
| 222 } |
| 223 } |
| 224 return isolate; |
| 225 } |
| 226 |
| 209 IsolateTest reloadSources([bool pause = false]) { | 227 IsolateTest reloadSources([bool pause = false]) { |
| 210 return (Isolate isolate) async { | 228 return (Isolate isolate) async { |
| 211 Map<String, dynamic> params = <String, dynamic>{ }; | 229 Map<String, dynamic> params = <String, dynamic>{ }; |
| 212 if (pause == true) { | 230 if (pause == true) { |
| 213 params['pause'] = pause; | 231 params['pause'] = pause; |
| 214 } | 232 } |
| 215 return isolate.invokeRpc('reloadSources', params); | 233 return isolate.invokeRpc('reloadSources', params); |
| 216 }; | 234 }; |
| 217 } | 235 } |
| 218 | 236 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 390 |
| 373 Future<Instance> rootLibraryFieldValue(Isolate isolate, | 391 Future<Instance> rootLibraryFieldValue(Isolate isolate, |
| 374 String fieldName) async { | 392 String fieldName) async { |
| 375 Library rootLib = await isolate.rootLibrary.load(); | 393 Library rootLib = await isolate.rootLibrary.load(); |
| 376 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); | 394 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); |
| 377 await field.load(); | 395 await field.load(); |
| 378 Instance value = field.staticValue; | 396 Instance value = field.staticValue; |
| 379 await value.load(); | 397 await value.load(); |
| 380 return value; | 398 return value; |
| 381 } | 399 } |
| OLD | NEW |