| 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 --verbose_debug | 4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug |
| 5 | 5 |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:developer'; | 7 import 'dart:developer'; |
| 8 | 8 |
| 9 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
| 10 import 'service_test_common.dart'; | 10 import 'service_test_common.dart'; |
| 11 | 11 |
| 12 import 'package:observatory/models.dart' as M; | 12 import 'package:observatory/models.dart' as M; |
| 13 import 'package:observatory/service_io.dart'; | 13 import 'package:observatory/service_io.dart'; |
| 14 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
| 15 | 15 |
| 16 const int LINE_A = 22; | 16 const int LINE_A = 22; |
| 17 const int LINE_B = 24; | 17 const int LINE_B = 24; |
| 18 | 18 |
| 19 // This tests the asyncStepOver command. | 19 // This tests the asyncStepOver command. |
| 20 asyncFunction() async { | 20 asyncFunction() async { |
| 21 debugger(); | 21 debugger(); |
| 22 print('a'); // LINE_A | 22 print('a'); // LINE_A |
| 23 await new Future.delayed(new Duration(seconds: 2)); | 23 await new Future.delayed(new Duration(seconds: 2)); |
| 24 print('b'); // LINE_B | 24 print('b'); // LINE_B |
| 25 } | 25 } |
| 26 | 26 |
| 27 testMain() { | 27 testMain() { |
| 28 asyncFunction(); | 28 asyncFunction(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 var tests = [ | 31 var tests = [ |
| 32 hasStoppedAtBreakpoint, | 32 hasStoppedAtBreakpoint, |
| 33 stoppedAtLine(LINE_A), | 33 stoppedAtLine(LINE_A), |
| 34 stepOver, // At new Duration(). | 34 stepOver, // At new Duration(). |
| 35 stepOver, // At new Future.delayed(). | 35 stepOver, // At new Future.delayed(). |
| 36 stepOver, // At async. | 36 stepOver, // At async. |
| 37 // Check that we are at the async statement | 37 // Check that we are at the async statement |
| 38 (Isolate isolate) async { | 38 (Isolate isolate) async { |
| 39 expect(M.isAtAsyncSuspension(isolate.pauseEvent), isTrue); | 39 expect(M.isAtAsyncSuspension(isolate.pauseEvent), isTrue); |
| 40 }, | 40 }, |
| 41 asyncStepOver, | 41 asyncStepOver, |
| 42 stoppedAtLine(LINE_B), | 42 stoppedAtLine(LINE_B), |
| 43 resumeIsolate, | 43 resumeIsolate, |
| 44 ]; | 44 ]; |
| 45 | 45 |
| 46 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 46 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
| OLD | NEW |