| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'package:observatory/service_io.dart'; | 5 import 'package:observatory/service_io.dart'; |
| 6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 7 import 'test_helper.dart'; | 7 import 'test_helper.dart'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 void testFunction() { | 10 void testFunction() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 expect(events[0].eventType, equals('BreakpointResolved')); | 50 expect(events[0].eventType, equals('BreakpointResolved')); |
| 51 expect(events[1].eventType, equals('BreakpointReached')); | 51 expect(events[1].eventType, equals('BreakpointReached')); |
| 52 print('Breakpoint reached'); | 52 print('Breakpoint reached'); |
| 53 completer.complete(); | 53 completer.complete(); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 }); | 56 }); |
| 57 | 57 |
| 58 // Add the breakpoint. | 58 // Add the breakpoint. |
| 59 var script = isolate.rootLib.scripts[0]; | 59 var script = isolate.rootLib.scripts[0]; |
| 60 return isolate.addBreakpoint(script, 14).then((ServiceObject bpt) { | 60 return isolate.addBreakpoint(script, 14).then((result) { |
| 61 expect(bpt is ServiceMap, isTrue); | 61 expect(result is Breakpoint, isTrue); |
| 62 ServiceMap m = bpt; | 62 Breakpoint bpt = result; |
| 63 expect(m.type, equals('Breakpoint')); | 63 expect(bpt.type, equals('Breakpoint')); |
| 64 expect(m['location']['script'].id, equals(script.id)); | 64 expect(bpt.script.id, equals(script.id)); |
| 65 expect(m['location']['tokenPos'], equals(51)); | 65 expect(bpt.tokenPos, equals(51)); |
| 66 expect(isolate.breakpoints.length, equals(1)); | 66 expect(isolate.breakpoints.length, equals(1)); |
| 67 return completer.future; // Wait for breakpoint events. | 67 return completer.future; // Wait for breakpoint events. |
| 68 }); | 68 }); |
| 69 }); | 69 }); |
| 70 }, | 70 }, |
| 71 | 71 |
| 72 // Get the stack trace | 72 // Get the stack trace |
| 73 (Isolate isolate) { | 73 (Isolate isolate) { |
| 74 return isolate.getStack().then((ServiceMap stack) { | 74 return isolate.getStack().then((ServiceMap stack) { |
| 75 expect(stack.type, equals('Stack')); | 75 expect(stack.type, equals('Stack')); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 expect(isolate.breakpoints.length, equals(1)); | 110 expect(isolate.breakpoints.length, equals(1)); |
| 111 var bpt = isolate.breakpoints[0]; | 111 var bpt = isolate.breakpoints[0]; |
| 112 return isolate.removeBreakpoint(bpt).then((_) { | 112 return isolate.removeBreakpoint(bpt).then((_) { |
| 113 expect(isolate.breakpoints.length, equals(0)); | 113 expect(isolate.breakpoints.length, equals(0)); |
| 114 }); | 114 }); |
| 115 }, | 115 }, |
| 116 | 116 |
| 117 ]; | 117 ]; |
| 118 | 118 |
| 119 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 119 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
| OLD | NEW |