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=--error_on_bad_type --error_on_bad_override | 4 // VMOptions=--error_on_bad_type --error_on_bad_override |
5 | 5 |
6 import 'dart:developer'; | 6 import 'dart:developer'; |
7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 testeeDo() { | 29 testeeDo() { |
30 debugger(); | 30 debugger(); |
31 | 31 |
32 doAsync(1).then((_) { | 32 doAsync(1).then((_) { |
33 doAsyncStar(1).listen((_) {}); | 33 doAsyncStar(1).listen((_) {}); |
34 }); | 34 }); |
35 } | 35 } |
36 | 36 |
37 | |
38 checkAsyncVarDescriptors(Isolate isolate) async { | 37 checkAsyncVarDescriptors(Isolate isolate) async { |
39 ServiceMap stack = await isolate.getStack(); | 38 ServiceMap stack = await isolate.getStack(); |
40 expect(stack.type, equals('Stack')); | 39 expect(stack.type, equals('Stack')); |
41 expect(stack['frames'].length, greaterThanOrEqualTo(1)); | 40 expect(stack['frames'].length, greaterThanOrEqualTo(1)); |
42 Frame frame = stack['frames'][0]; | 41 Frame frame = stack['frames'][0]; |
43 var vars = frame.variables.map((v) => v['name']).join(' '); | 42 var vars = frame.variables.map((v) => v['name']).join(' '); |
44 expect(vars, equals('param1 local1')); // no :async_op et al | 43 expect(vars, equals('param1 local1')); // no :async_op et al |
45 } | 44 } |
46 | 45 |
47 | |
48 checkAsyncStarVarDescriptors(Isolate isolate) async { | 46 checkAsyncStarVarDescriptors(Isolate isolate) async { |
49 ServiceMap stack = await isolate.getStack(); | 47 ServiceMap stack = await isolate.getStack(); |
50 expect(stack.type, equals('Stack')); | 48 expect(stack.type, equals('Stack')); |
51 expect(stack['frames'].length, greaterThanOrEqualTo(1)); | 49 expect(stack['frames'].length, greaterThanOrEqualTo(1)); |
52 Frame frame = stack['frames'][0]; | 50 Frame frame = stack['frames'][0]; |
53 var vars = frame.variables.map((v) => v['name']).join(' '); | 51 var vars = frame.variables.map((v) => v['name']).join(' '); |
54 expect(vars, equals('param2 local2')); // no :async_op et al | 52 expect(vars, equals('param2 local2')); // no :async_op et al |
55 } | 53 } |
56 | 54 |
57 | |
58 var tests = [ | 55 var tests = [ |
59 hasStoppedAtBreakpoint, // debugger() | 56 hasStoppedAtBreakpoint, // debugger() |
60 setBreakpointAtLine(LINE_A), | 57 setBreakpointAtLine(LINE_A), |
61 setBreakpointAtLine(LINE_B), | 58 setBreakpointAtLine(LINE_B), |
62 resumeIsolate, | 59 resumeIsolate, |
63 | 60 |
64 hasStoppedAtBreakpoint, | 61 hasStoppedAtBreakpoint, |
65 stoppedAtLine(LINE_A), | 62 stoppedAtLine(LINE_A), |
66 checkAsyncVarDescriptors, | 63 checkAsyncVarDescriptors, |
67 resumeIsolate, | 64 resumeIsolate, |
68 | 65 |
69 hasStoppedAtBreakpoint, | 66 hasStoppedAtBreakpoint, |
70 stoppedAtLine(LINE_B), | 67 stoppedAtLine(LINE_B), |
71 checkAsyncStarVarDescriptors, | 68 checkAsyncStarVarDescriptors, |
72 resumeIsolate, | 69 resumeIsolate, |
73 ]; | 70 ]; |
74 | 71 |
75 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo); | 72 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo); |
OLD | NEW |