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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 print("Breakpoint is $bpt"); | 227 print("Breakpoint is $bpt"); |
228 expect(bpt, isNotNull); | 228 expect(bpt, isNotNull); |
229 expect(bpt is Breakpoint, isTrue); | 229 expect(bpt is Breakpoint, isTrue); |
230 }; | 230 }; |
231 } | 231 } |
232 | 232 |
233 IsolateTest stoppedAtLine(int line) { | 233 IsolateTest stoppedAtLine(int line) { |
234 return (Isolate isolate) async { | 234 return (Isolate isolate) async { |
235 print("Checking we are at line $line"); | 235 print("Checking we are at line $line"); |
236 | 236 |
| 237 // Make sure that the isolate has stopped. |
| 238 isolate.reload(); |
| 239 expect(isolate.pauseEvent is! M.ResumeEvent, isTrue); |
| 240 |
237 ServiceMap stack = await isolate.getStack(); | 241 ServiceMap stack = await isolate.getStack(); |
238 expect(stack.type, equals('Stack')); | 242 expect(stack.type, equals('Stack')); |
239 | 243 |
240 List<Frame> frames = stack['frames']; | 244 List<Frame> frames = stack['frames']; |
241 expect(frames.length, greaterThanOrEqualTo(1)); | 245 expect(frames.length, greaterThanOrEqualTo(1)); |
242 | 246 |
243 Frame top = frames[0]; | 247 Frame top = frames[0]; |
244 Script script = await top.location.script.load(); | 248 Script script = await top.location.script.load(); |
245 int actualLine = script.tokenToLine(top.location.tokenPos); | 249 int actualLine = script.tokenToLine(top.location.tokenPos); |
246 if (actualLine != line) { | 250 if (actualLine != line) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 372 |
369 Future<Instance> rootLibraryFieldValue(Isolate isolate, | 373 Future<Instance> rootLibraryFieldValue(Isolate isolate, |
370 String fieldName) async { | 374 String fieldName) async { |
371 Library rootLib = await isolate.rootLibrary.load(); | 375 Library rootLib = await isolate.rootLibrary.load(); |
372 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); | 376 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); |
373 await field.load(); | 377 await field.load(); |
374 Instance value = field.staticValue; | 378 Instance value = field.staticValue; |
375 await value.load(); | 379 await value.load(); |
376 return value; | 380 return value; |
377 } | 381 } |
OLD | NEW |