| 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 | 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override |
| 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:async'; | 9 import 'dart:async'; |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 }); | 49 }); |
| 50 }); | 50 }); |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 // Evaluate against library, class, and instance. | 53 // Evaluate against library, class, and instance. |
| 54 (Isolate isolate) { | 54 (Isolate isolate) { |
| 55 return isolate.getStack().then((ServiceMap stack) { | 55 return isolate.getStack().then((ServiceMap stack) { |
| 56 // Make sure we are in the right place. | 56 // Make sure we are in the right place. |
| 57 expect(stack.type, equals('Stack')); | 57 expect(stack.type, equals('Stack')); |
| 58 expect(stack['frames'].length, greaterThanOrEqualTo(2)); | 58 expect(stack['frames'].length, greaterThanOrEqualTo(2)); |
| 59 expect(stack['frames'][0]['function'].name, equals('printValue')); | 59 expect(stack['frames'][0].function.name, equals('printValue')); |
| 60 expect(stack['frames'][0]['function'].dartOwner.name, equals('MyClass')); | 60 expect(stack['frames'][0].function.dartOwner.name, equals('MyClass')); |
| 61 | 61 |
| 62 var lib = isolate.rootLibrary; | 62 var lib = isolate.rootLibrary; |
| 63 var cls = stack['frames'][0]['function'].dartOwner; | 63 var cls = stack['frames'][0].function.dartOwner; |
| 64 var instance = stack['frames'][0]['vars'][0]['value']; | 64 var instance = stack['frames'][0].variables[0]['value']; |
| 65 | 65 |
| 66 List evals = []; | 66 List evals = []; |
| 67 evals.add(lib.evaluate('globalVar + 5').then((result) { | 67 evals.add(lib.evaluate('globalVar + 5').then((result) { |
| 68 print(result); | 68 print(result); |
| 69 expect(result.valueAsString, equals('105')); | 69 expect(result.valueAsString, equals('105')); |
| 70 })); | 70 })); |
| 71 evals.add(lib.evaluate('globalVar + staticVar + 5').then((result) { | 71 evals.add(lib.evaluate('globalVar + staticVar + 5').then((result) { |
| 72 expect(result.type, equals('Error')); | 72 expect(result.type, equals('Error')); |
| 73 })); | 73 })); |
| 74 evals.add(cls.evaluate('globalVar + staticVar + 5').then((result) { | 74 evals.add(cls.evaluate('globalVar + staticVar + 5').then((result) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 85 evals.add(instance.evaluate('this + frog').then((result) { | 85 evals.add(instance.evaluate('this + frog').then((result) { |
| 86 expect(result.type, equals('Error')); | 86 expect(result.type, equals('Error')); |
| 87 })); | 87 })); |
| 88 return Future.wait(evals); | 88 return Future.wait(evals); |
| 89 }); | 89 }); |
| 90 }, | 90 }, |
| 91 | 91 |
| 92 ]; | 92 ]; |
| 93 | 93 |
| 94 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 94 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
| OLD | NEW |