| 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 --verbos
e_debug | 4 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override --verbos
e_debug |
| 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:developer'; | 9 import 'dart:developer'; |
| 10 | 10 |
| 11 foo() async { } | 11 foo() async { } |
| 12 | 12 |
| 13 doAsync(stop) async { | 13 doAsync(stop) async { |
| 14 if (stop) debugger(); | 14 if (stop) debugger(); |
| 15 await foo(); // Line 15. | 15 await foo(); // Line 15. |
| 16 await foo(); // Line 16. | 16 await foo(); // Line 16. |
| 17 await foo(); // Line 17. | 17 await foo(); // Line 17. |
| 18 return null; | 18 return null; |
| 19 } | 19 } |
| 20 | 20 |
| 21 testMain() { | 21 testMain() { |
| 22 // With two runs of doAsync floating around, async step should only cause | 22 // With two runs of doAsync floating around, async step should only cause |
| 23 // us to stop in the run we started in. | 23 // us to stop in the run we started in. |
| 24 doAsync(false); | 24 doAsync(false); |
| 25 doAsync(true); | 25 doAsync(true); |
| 26 } | 26 } |
| 27 | 27 |
| 28 | |
| 29 asyncStep(Isolate isolate) async { | 28 asyncStep(Isolate isolate) async { |
| 30 var event = isolate.pauseEvent; | 29 await isolate.reload(); // isolate.pauseEvent may be stale |
| 30 ServiceEvent event = isolate.pauseEvent; |
| 31 print("Pause event is $event"); | 31 print("Pause event is $event"); |
| 32 expect(event, isNotNull); | 32 expect(event, isNotNull); |
| 33 expect(event.kind, equals(ServiceEvent.kPauseBreakpoint)); |
| 33 | 34 |
| 34 // 1. Set breakpoint for the continuation and resume the isolate. | 35 // 1. Set breakpoint for the continuation and resume the isolate. |
| 35 Instance continuation = event.asyncContinuation; | 36 Instance continuation = event.asyncContinuation; |
| 36 print("Async continuation is $continuation"); | 37 print("Async continuation is $continuation"); |
| 37 if (continuation == null) { | 38 if (continuation == null) { |
| 38 print(await isolate.getStack()); | 39 print(await isolate.getStack()); |
| 39 } | 40 } |
| 40 expect(continuation.isClosure, isTrue); | 41 expect(continuation.isClosure, isTrue); |
| 41 | 42 |
| 42 var bpt = await isolate.addBreakOnActivation(continuation); | 43 var bpt = await isolate.addBreakOnActivation(continuation); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 hasStoppedAtBreakpoint, | 58 hasStoppedAtBreakpoint, |
| 58 stoppedAtLine(15), | 59 stoppedAtLine(15), |
| 59 asyncStep, | 60 asyncStep, |
| 60 stoppedAtLine(16), | 61 stoppedAtLine(16), |
| 61 asyncStep, | 62 asyncStep, |
| 62 stoppedAtLine(17), | 63 stoppedAtLine(17), |
| 63 resumeIsolate, | 64 resumeIsolate, |
| 64 ]; | 65 ]; |
| 65 | 66 |
| 66 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 67 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
| OLD | NEW |