| 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 | |
| 241 ServiceMap stack = await isolate.getStack(); | 237 ServiceMap stack = await isolate.getStack(); |
| 242 expect(stack.type, equals('Stack')); | 238 expect(stack.type, equals('Stack')); |
| 243 | 239 |
| 244 List<Frame> frames = stack['frames']; | 240 List<Frame> frames = stack['frames']; |
| 245 expect(frames.length, greaterThanOrEqualTo(1)); | 241 expect(frames.length, greaterThanOrEqualTo(1)); |
| 246 | 242 |
| 247 Frame top = frames[0]; | 243 Frame top = frames[0]; |
| 248 Script script = await top.location.script.load(); | 244 Script script = await top.location.script.load(); |
| 249 int actualLine = script.tokenToLine(top.location.tokenPos); | 245 int actualLine = script.tokenToLine(top.location.tokenPos); |
| 250 if (actualLine != line) { | 246 if (actualLine != line) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 368 |
| 373 Future<Instance> rootLibraryFieldValue(Isolate isolate, | 369 Future<Instance> rootLibraryFieldValue(Isolate isolate, |
| 374 String fieldName) async { | 370 String fieldName) async { |
| 375 Library rootLib = await isolate.rootLibrary.load(); | 371 Library rootLib = await isolate.rootLibrary.load(); |
| 376 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); | 372 Field field = rootLib.variables.singleWhere((v) => v.name == fieldName); |
| 377 await field.load(); | 373 await field.load(); |
| 378 Instance value = field.staticValue; | 374 Instance value = field.staticValue; |
| 379 await value.load(); | 375 await value.load(); |
| 380 return value; | 376 return value; |
| 381 } | 377 } |
| OLD | NEW |