| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 --verbose_debug | 4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug |
| 5 | 5 |
| 6 import 'dart:developer'; | 6 import 'dart:developer'; |
| 7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
| 8 import 'package:observatory/service_io.dart'; | 8 import 'package:observatory/service_io.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 import 'service_test_common.dart'; | 10 import 'service_test_common.dart'; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 var tests = [ | 36 var tests = [ |
| 37 hasStoppedAtBreakpoint, | 37 hasStoppedAtBreakpoint, |
| 38 stoppedAtLine(LINE_A), | 38 stoppedAtLine(LINE_A), |
| 39 (Isolate isolate) async { | 39 (Isolate isolate) async { |
| 40 ServiceMap stack = await isolate.getStack(); | 40 ServiceMap stack = await isolate.getStack(); |
| 41 // No causal frames because we are in a completely synchronous stack. | 41 // No causal frames because we are in a completely synchronous stack. |
| 42 expect(stack['asyncCausalFrames'], isNotNull); | 42 expect(stack['asyncCausalFrames'], isNotNull); |
| 43 var asyncStack = stack['asyncCausalFrames']; | 43 var asyncStack = stack['asyncCausalFrames']; |
| 44 expect(asyncStack[0].toString(), contains('helper')); | 44 expect(asyncStack[0].toString(), contains('helper_async_body')); |
| 45 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); | 45 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); |
| 46 expect(asyncStack[2].toString(), contains('testMain')); | 46 expect(asyncStack[2].toString(), contains('helper')); |
| 47 }, | 47 }, |
| 48 resumeIsolate, | 48 resumeIsolate, |
| 49 hasStoppedAtBreakpoint, | 49 hasStoppedAtBreakpoint, |
| 50 stoppedAtLine(LINE_B), | 50 stoppedAtLine(LINE_B), |
| 51 | 51 |
| 52 (Isolate isolate) async { | 52 (Isolate isolate) async { |
| 53 ServiceMap stack = await isolate.getStack(); | 53 ServiceMap stack = await isolate.getStack(); |
| 54 // Has causal frames (we are inside an async function) | 54 // Has causal frames (we are inside an async function) |
| 55 expect(stack['asyncCausalFrames'], isNotNull); | 55 expect(stack['asyncCausalFrames'], isNotNull); |
| 56 var asyncStack = stack['asyncCausalFrames']; | 56 var asyncStack = stack['asyncCausalFrames']; |
| 57 expect(asyncStack[0].toString(), contains('foobar')); | 57 expect(asyncStack[0].toString(), contains('foobar_async_gen_body')); |
| 58 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); | 58 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); |
| 59 expect(asyncStack[2].toString(), contains('helper')); | 59 expect(asyncStack[2].toString(), contains('foobar')); |
| 60 expect(asyncStack[3].kind, equals(M.FrameKind.asyncSuspensionMarker)); | 60 expect(asyncStack[3].toString(), contains('helper_async_body')); |
| 61 expect(asyncStack[4].toString(), contains('testMain')); | 61 expect(asyncStack[4].kind, equals(M.FrameKind.asyncSuspensionMarker)); |
| 62 expect(asyncStack[5].toString(), contains('helper')); |
| 63 expect(asyncStack[6].toString(), contains('testMain')); |
| 62 }, | 64 }, |
| 63 | 65 |
| 64 resumeIsolate, | 66 resumeIsolate, |
| 65 hasStoppedAtBreakpoint, | 67 hasStoppedAtBreakpoint, |
| 66 stoppedAtLine(LINE_C), | 68 stoppedAtLine(LINE_C), |
| 67 | 69 |
| 68 (Isolate isolate) async { | 70 (Isolate isolate) async { |
| 69 ServiceMap stack = await isolate.getStack(); | 71 ServiceMap stack = await isolate.getStack(); |
| 70 // Has causal frames (we are inside a function called by an async function) | 72 // Has causal frames (we are inside a function called by an async function) |
| 71 expect(stack['asyncCausalFrames'], isNotNull); | 73 expect(stack['asyncCausalFrames'], isNotNull); |
| 72 var asyncStack = stack['asyncCausalFrames']; | 74 var asyncStack = stack['asyncCausalFrames']; |
| 73 expect(asyncStack[0].toString(), contains('foobar')); | 75 expect(asyncStack[0].toString(), contains('foobar_async_gen_body')); |
| 74 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); | 76 expect(asyncStack[1].kind, equals(M.FrameKind.asyncSuspensionMarker)); |
| 75 expect(asyncStack[2].toString(), contains('helper')); | 77 expect(asyncStack[2].toString(), contains('foobar')); |
| 76 expect(asyncStack[3].kind, equals(M.FrameKind.asyncSuspensionMarker)); | 78 expect(asyncStack[3].toString(), contains('helper_async_body')); |
| 77 expect(asyncStack[4].toString(), contains('testMain')); | 79 expect(asyncStack[4].kind, equals(M.FrameKind.asyncSuspensionMarker)); |
| 80 expect(asyncStack[5].toString(), contains('helper')); |
| 81 expect(asyncStack[6].toString(), contains('testMain')); |
| 78 }, | 82 }, |
| 79 ]; | 83 ]; |
| 80 | 84 |
| 81 main(args) => runIsolateTestsSynchronous(args, | 85 main(args) => runIsolateTestsSynchronous(args, |
| 82 tests, | 86 tests, |
| 83 testeeConcurrent: testMain); | 87 testeeConcurrent: testMain); |
| OLD | NEW |