OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug |
| 5 |
| 6 import 'dart:developer'; |
| 7 import 'package:observatory/service_io.dart'; |
| 8 import 'package:unittest/unittest.dart'; |
| 9 import 'service_test_common.dart'; |
| 10 import 'test_helper.dart'; |
| 11 |
| 12 const LINE_C = 18; |
| 13 const LINE_A = 23; |
| 14 const LINE_B = 29; |
| 15 |
| 16 foobar() { |
| 17 debugger(); |
| 18 print('foobar'); // LINE_C. |
| 19 } |
| 20 |
| 21 helper() async { |
| 22 debugger(); |
| 23 print('helper'); // LINE_A. |
| 24 foobar(); |
| 25 } |
| 26 |
| 27 testMain() { |
| 28 debugger(); |
| 29 helper(); // LINE_B. |
| 30 } |
| 31 |
| 32 var tests = [ |
| 33 hasStoppedAtBreakpoint, |
| 34 stoppedAtLine(LINE_B), |
| 35 (Isolate isolate) async { |
| 36 ServiceMap stack = await isolate.getStack(); |
| 37 // No causal frames because we are in a completely synchronous stack. |
| 38 expect(stack['asyncCausalFrames'], isNull); |
| 39 }, |
| 40 resumeIsolate, |
| 41 hasStoppedAtBreakpoint, |
| 42 stoppedAtLine(LINE_A), |
| 43 |
| 44 (Isolate isolate) async { |
| 45 ServiceMap stack = await isolate.getStack(); |
| 46 // Has causal frames (we are inside an async function) |
| 47 expect(stack['asyncCausalFrames'], isNotNull); |
| 48 }, |
| 49 |
| 50 resumeIsolate, |
| 51 hasStoppedAtBreakpoint, |
| 52 stoppedAtLine(LINE_C), |
| 53 |
| 54 (Isolate isolate) async { |
| 55 ServiceMap stack = await isolate.getStack(); |
| 56 // Has causal frames (we are inside a function called by an async function) |
| 57 expect(stack['asyncCausalFrames'], isNotNull); |
| 58 }, |
| 59 ]; |
| 60 |
| 61 main(args) => runIsolateTestsSynchronous(args, |
| 62 tests, |
| 63 testeeConcurrent: testMain); |
OLD | NEW |