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 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override --steal-b
reakpoints | 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override --steal-b
reakpoints |
5 | 5 |
6 import 'package:observatory/service_io.dart'; | 6 import 'package:observatory/service_io.dart'; |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 var tests = [ | 24 var tests = [ |
25 | 25 |
26 // Add a breakpoint and wait for it to be reached. | 26 // Add a breakpoint and wait for it to be reached. |
27 (Isolate isolate) async { | 27 (Isolate isolate) async { |
28 await isolate.rootLibrary.load(); | 28 await isolate.rootLibrary.load(); |
29 | 29 |
30 // Set up a listener to wait for breakpoint events. | 30 // Set up a listener to wait for breakpoint events. |
31 Completer completer = new Completer(); | 31 Completer completer = new Completer(); |
32 var subscription; | 32 var subscription; |
33 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { | 33 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { |
34 if (event.eventType == ServiceEvent.kPauseBreakpoint) { | 34 if (event.kind == ServiceEvent.kPauseBreakpoint) { |
35 print('Isolate paused at breakpoint'); | 35 print('Isolate paused at breakpoint'); |
36 subscription.cancel(); | 36 subscription.cancel(); |
37 completer.complete(); | 37 completer.complete(); |
38 } | 38 } |
39 }); | 39 }); |
40 | 40 |
41 // Add the breakpoint. | 41 // Add the breakpoint. |
42 var script = isolate.rootLibrary.scripts[0]; | 42 var script = isolate.rootLibrary.scripts[0]; |
43 var result = await isolate.addBreakpoint(script, 14); | 43 var result = await isolate.addBreakpoint(script, 14); |
44 expect(result is Breakpoint, isTrue); | 44 expect(result is Breakpoint, isTrue); |
(...skipping 11 matching lines...) Expand all Loading... |
56 await script.load(); | 56 await script.load(); |
57 expect(script.name,endsWith('steal_breakpoint_test.dart')); | 57 expect(script.name,endsWith('steal_breakpoint_test.dart')); |
58 expect(script.tokenToLine(stack['frames'][0]['tokenPos']), equals(14)); | 58 expect(script.tokenToLine(stack['frames'][0]['tokenPos']), equals(14)); |
59 }, | 59 }, |
60 | 60 |
61 // Resume | 61 // Resume |
62 (Isolate isolate) async { | 62 (Isolate isolate) async { |
63 Completer completer = new Completer(); | 63 Completer completer = new Completer(); |
64 var subscription; | 64 var subscription; |
65 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { | 65 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { |
66 if (event.eventType == ServiceEvent.kResume) { | 66 if (event.kind == ServiceEvent.kResume) { |
67 print('Isolate resumed'); | 67 print('Isolate resumed'); |
68 subscription.cancel(); | 68 subscription.cancel(); |
69 completer.complete(); | 69 completer.complete(); |
70 } | 70 } |
71 }); | 71 }); |
72 isolate.resume(); | 72 isolate.resume(); |
73 await completer.future; | 73 await completer.future; |
74 }, | 74 }, |
75 | 75 |
76 ]; | 76 ]; |
77 | 77 |
78 main(args) => runIsolateTests(args, tests, testeeBefore: startTimer); | 78 main(args) => runIsolateTests(args, tests, testeeBefore: startTimer); |
OLD | NEW |