| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:developer'; | 6 import 'dart:developer'; |
| 7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
| 10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
| 11 | 11 |
| 12 testFunction() async { | 12 testFunction() async { |
| 13 var x = 3; | 13 var x = 3; |
| 14 var y = 4; | 14 var y = 4; |
| 15 debugger(); | 15 debugger(); |
| 16 var z = await new Future(() => x + y); | 16 var z = await new Future(() => x + y); |
| 17 debugger(); | 17 debugger(); |
| 18 return z; | 18 return z; |
| 19 } | 19 } |
| 20 | 20 |
| 21 var tests = [ | 21 var tests = [ |
| 22 hasStoppedAtBreakpoint, | |
| 23 (Isolate isolate) async { | |
| 24 // Make sure we are in the right place. | |
| 25 var stack = await isolate.getStack(); | |
| 26 var topFrame = 0; | |
| 27 expect(stack.type, equals('Stack')); | |
| 28 expect(await stack['frames'][topFrame].location.getLine(), 16); | |
| 29 | 22 |
| 30 var result = await isolate.evalFrame(topFrame, "x"); | 23 hasStoppedAtBreakpoint, |
| 31 print(result); | |
| 32 expect(result.valueAsString, equals("3")); | |
| 33 }, | |
| 34 resumeIsolate, | |
| 35 hasStoppedAtBreakpoint, | |
| 36 (Isolate isolate) async { | |
| 37 // Make sure we are in the right place. | |
| 38 var stack = await isolate.getStack(); | |
| 39 var topFrame = 0; | |
| 40 expect(stack.type, equals('Stack')); | |
| 41 expect(await stack['frames'][topFrame].location.getLine(), 18); | |
| 42 | 24 |
| 43 var result = await isolate.evalFrame(topFrame, "z"); | 25 (Isolate isolate) async { |
| 44 print(result); | 26 // Make sure we are in the right place. |
| 45 expect(result.valueAsString, equals("7")); | 27 var stack = await isolate.getStack(); |
| 46 }, | 28 var topFrame = 0; |
| 47 resumeIsolate, | 29 expect(stack.type, equals('Stack')); |
| 30 expect(await stack['frames'][topFrame].location.getLine(), 16); |
| 31 |
| 32 var result = await isolate.evalFrame(topFrame, "x"); |
| 33 print(result); |
| 34 expect(result.valueAsString, equals("3")); |
| 35 }, |
| 36 |
| 37 resumeIsolate, |
| 38 |
| 39 hasStoppedAtBreakpoint, |
| 40 |
| 41 (Isolate isolate) async { |
| 42 // Make sure we are in the right place. |
| 43 var stack = await isolate.getStack(); |
| 44 var topFrame = 0; |
| 45 expect(stack.type, equals('Stack')); |
| 46 expect(await stack['frames'][topFrame].location.getLine(), 18); |
| 47 |
| 48 var result = await isolate.evalFrame(topFrame, "z"); |
| 49 print(result); |
| 50 expect(result.valueAsString, equals("7")); |
| 51 }, |
| 52 |
| 53 resumeIsolate, |
| 54 |
| 48 ]; | 55 ]; |
| 49 | 56 |
| 50 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 57 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
| OLD | NEW |