| 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 // VMOptions=--error_on_bad_type --error_on_bad_override | 4 // VMOptions=--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 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
| 10 import 'dart:developer'; | 10 import 'dart:developer'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 expect(stack['frames'].length, greaterThanOrEqualTo(2)); | 56 expect(stack['frames'].length, greaterThanOrEqualTo(2)); |
| 57 expect(stack['frames'][0].function.name, equals('myFunction')); | 57 expect(stack['frames'][0].function.name, equals('myFunction')); |
| 58 expect(stack['frames'][0].function.dartOwner.name, equals('MyClass')); | 58 expect(stack['frames'][0].function.dartOwner.name, equals('MyClass')); |
| 59 | 59 |
| 60 var func = stack['frames'][0].function; | 60 var func = stack['frames'][0].function; |
| 61 expect(func.name, equals('myFunction')); | 61 expect(func.name, equals('myFunction')); |
| 62 await func.load(); | 62 await func.load(); |
| 63 | 63 |
| 64 var expectedRange = { | 64 var expectedRange = { |
| 65 'scriptIndex': 0, | 65 'scriptIndex': 0, |
| 66 'startPos': 38, | 66 'startPos': 39, |
| 67 'endPos': 87, | 67 'endPos': 88, |
| 68 'compiled': true, | 68 'compiled': true, |
| 69 'coverage': {'hits': [53, 71, 81], 'misses': [59]} | 69 'coverage': {'hits': [54, 72, 82], 'misses': [60]} |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // Full script | 72 // Full script |
| 73 var params = { 'reports' : ['Coverage'], | 73 var params = { 'reports' : ['Coverage'], |
| 74 'scriptId' : func.location.script.id }; | 74 'scriptId' : func.location.script.id }; |
| 75 var coverage = await isolate.invokeRpcNoUpgrade('getSourceReport', params); | 75 var coverage = await isolate.invokeRpcNoUpgrade('getSourceReport', params); |
| 76 expect(coverage['type'], equals('SourceReport')); | 76 expect(coverage['type'], equals('SourceReport')); |
| 77 expect(coverage['ranges'].length, 6); | 77 expect(coverage['ranges'].length, 6); |
| 78 expect(coverage['ranges'][0], equals(expectedRange)); | 78 expect(coverage['ranges'][0], equals(expectedRange)); |
| 79 expect(coverage['scripts'].length, 1); | 79 expect(coverage['scripts'].length, 1); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 expect(e.message, | 150 expect(e.message, |
| 151 "getSourceReport: the 'endTokenPos' parameter requires the " | 151 "getSourceReport: the 'endTokenPos' parameter requires the " |
| 152 "\'scriptId\' parameter"); | 152 "\'scriptId\' parameter"); |
| 153 } | 153 } |
| 154 expect(caughtException, isTrue); | 154 expect(caughtException, isTrue); |
| 155 }, | 155 }, |
| 156 | 156 |
| 157 ]; | 157 ]; |
| 158 | 158 |
| 159 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 159 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
| OLD | NEW |