Chromium Code Reviews| 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 | |
|
siva
2017/02/08 18:46:29
ditto comment.
| |
| 12 const LINE_A = 25; | |
| 13 const LINE_B = 18; | |
| 14 const LINE_C = 20; | |
| 15 | |
| 16 foobar() async* { | |
| 17 debugger(); | |
| 18 yield 1; // LINE_B. | |
| 19 debugger(); | |
| 20 yield 2; // LINE_C. | |
| 21 } | |
| 22 | |
| 23 helper() async { | |
| 24 debugger(); | |
| 25 print('helper'); // LINE_A. | |
| 26 await for (var i in foobar()) { | |
| 27 print('helper $i'); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 testMain() { | |
| 32 helper(); | |
| 33 } | |
| 34 | |
| 35 var tests = [ | |
| 36 hasStoppedAtBreakpoint, | |
| 37 stoppedAtLine(LINE_A), | |
| 38 (Isolate isolate) async { | |
| 39 ServiceMap stack = await isolate.getStack(); | |
| 40 // No causal frames because we are in a completely synchronous stack. | |
| 41 expect(stack['asyncCausalFrames'], isNotNull); | |
| 42 }, | |
| 43 resumeIsolate, | |
| 44 hasStoppedAtBreakpoint, | |
| 45 stoppedAtLine(LINE_B), | |
| 46 | |
| 47 (Isolate isolate) async { | |
| 48 ServiceMap stack = await isolate.getStack(); | |
| 49 // Has causal frames (we are inside an async function) | |
| 50 expect(stack['asyncCausalFrames'], isNotNull); | |
| 51 }, | |
| 52 | |
| 53 resumeIsolate, | |
| 54 hasStoppedAtBreakpoint, | |
| 55 stoppedAtLine(LINE_C), | |
| 56 | |
| 57 (Isolate isolate) async { | |
| 58 ServiceMap stack = await isolate.getStack(); | |
| 59 // Has causal frames (we are inside a function called by an async function) | |
| 60 expect(stack['asyncCausalFrames'], isNotNull); | |
| 61 }, | |
| 62 ]; | |
| 63 | |
| 64 main(args) => runIsolateTestsSynchronous(args, | |
| 65 tests, | |
| 66 testeeConcurrent: testMain); | |
| OLD | NEW |