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': 39, | 66 'startPos': ifKernel(489, 39), |
67 'endPos': 88, | 67 'endPos': ifKernel(633, 88), |
68 'compiled': true, | 68 'compiled': true, |
69 'coverage': {'hits': [54, 72, 82], 'misses': [60]} | 69 'coverage': { |
| 70 'hits': ifKernel([539, 590, 619], [54, 72, 82]), |
| 71 'misses': ifKernel([552], [60]) |
| 72 } |
70 }; | 73 }; |
71 | 74 |
72 // Full script | 75 // Full script |
73 var params = { 'reports' : ['Coverage'], | 76 var params = { 'reports' : ['Coverage'], |
74 'scriptId' : func.location.script.id }; | 77 'scriptId' : func.location.script.id }; |
75 var coverage = await isolate.invokeRpcNoUpgrade('getSourceReport', params); | 78 var coverage = await isolate.invokeRpcNoUpgrade('getSourceReport', params); |
76 expect(coverage['type'], equals('SourceReport')); | 79 expect(coverage['type'], equals('SourceReport')); |
77 expect(coverage['ranges'].length, 6); | 80 expect(coverage['ranges'].length, 6); |
78 expect(coverage['ranges'][0], equals(expectedRange)); | 81 expect(coverage['ranges'][0], equals(expectedRange)); |
79 expect(coverage['scripts'].length, 1); | 82 expect(coverage['scripts'].length, 1); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 expect(e.message, | 153 expect(e.message, |
151 "getSourceReport: the 'endTokenPos' parameter requires the " | 154 "getSourceReport: the 'endTokenPos' parameter requires the " |
152 "\'scriptId\' parameter"); | 155 "\'scriptId\' parameter"); |
153 } | 156 } |
154 expect(caughtException, isTrue); | 157 expect(caughtException, isTrue); |
155 }, | 158 }, |
156 | 159 |
157 ]; | 160 ]; |
158 | 161 |
159 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 162 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
OLD | NEW |