| 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/service_common.dart'; | 8 import 'package:observatory/service_common.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) { | 135 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) { |
| 136 return hasPausedFor(isolate, ServiceEvent.kPauseBreakpoint); | 136 return hasPausedFor(isolate, ServiceEvent.kPauseBreakpoint); |
| 137 } | 137 } |
| 138 | 138 |
| 139 Future<Isolate> hasStoppedWithUnhandledException(Isolate isolate) { | 139 Future<Isolate> hasStoppedWithUnhandledException(Isolate isolate) { |
| 140 return hasPausedFor(isolate, ServiceEvent.kPauseException); | 140 return hasPausedFor(isolate, ServiceEvent.kPauseException); |
| 141 } | 141 } |
| 142 | 142 |
| 143 Future<Isolate> hasStoppedAtExit(Isolate isolate) { |
| 144 return hasPausedFor(isolate, ServiceEvent.kPauseExit); |
| 145 } |
| 146 |
| 143 Future<Isolate> hasPausedAtStart(Isolate isolate) { | 147 Future<Isolate> hasPausedAtStart(Isolate isolate) { |
| 144 return hasPausedFor(isolate, ServiceEvent.kPauseStart); | 148 return hasPausedFor(isolate, ServiceEvent.kPauseStart); |
| 145 } | 149 } |
| 146 | 150 |
| 147 // Currying is your friend. | 151 // Currying is your friend. |
| 148 IsolateTest setBreakpointAtLine(int line) { | 152 IsolateTest setBreakpointAtLine(int line) { |
| 149 return (Isolate isolate) async { | 153 return (Isolate isolate) async { |
| 150 print("Setting breakpoint for line $line"); | 154 print("Setting breakpoint for line $line"); |
| 151 Library lib = await isolate.rootLibrary.load(); | 155 Library lib = await isolate.rootLibrary.load(); |
| 152 Script script = lib.scripts.single; | 156 Script script = lib.scripts.single; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 247 |
| 244 Future<Instance> rootLibraryFieldValue(Isolate isolate, | 248 Future<Instance> rootLibraryFieldValue(Isolate isolate, |
| 245 String fieldName) async { | 249 String fieldName) async { |
| 246 Library rootLib = await isolate.rootLibrary.load(); | 250 Library rootLib = await isolate.rootLibrary.load(); |
| 247 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); | 251 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); |
| 248 await field.load(); | 252 await field.load(); |
| 249 Instance value = field.staticValue; | 253 Instance value = field.staticValue; |
| 250 await value.load(); | 254 await value.load(); |
| 251 return value; | 255 return value; |
| 252 } | 256 } |
| OLD | NEW |