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 'dart:developer'; | 9 import 'dart:developer'; |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 endsWith('get_source_report_test.dart')); | 103 endsWith('get_source_report_test.dart')); |
104 | 104 |
105 // Full isolate | 105 // Full isolate |
106 params = { 'reports' : ['Coverage'] }; | 106 params = { 'reports' : ['Coverage'] }; |
107 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); | 107 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); |
108 expect(coverage['type'], equals('SourceReport')); | 108 expect(coverage['type'], equals('SourceReport')); |
109 expect(coverage['ranges'].length, greaterThan(1)); | 109 expect(coverage['ranges'].length, greaterThan(1)); |
110 expect(coverage['scripts'].length, greaterThan(1)); | 110 expect(coverage['scripts'].length, greaterThan(1)); |
111 | 111 |
112 // Multiple reports (make sure enum list parameter parsing works). | 112 // Multiple reports (make sure enum list parameter parsing works). |
113 params = { 'reports' : ['CallSites', 'Coverage'], | 113 params = { 'reports' : ['CallSites', 'Coverage', 'PossibleBreakpoints'], |
114 'scriptId' : func.location.script.id, | 114 'scriptId' : func.location.script.id, |
115 'tokenPos' : func.location.tokenPos, | 115 'tokenPos' : func.location.tokenPos, |
116 'endTokenPos' : func.location.endTokenPos }; | 116 'endTokenPos' : func.location.endTokenPos }; |
117 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); | 117 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); |
118 expect(coverage['type'], equals('SourceReport')); | 118 expect(coverage['type'], equals('SourceReport')); |
119 expect(coverage['ranges'].length, 1); | 119 expect(coverage['ranges'].length, 1); |
120 var range = coverage['ranges'][0]; | 120 var range = coverage['ranges'][0]; |
121 expect(range.containsKey('callSites'), isTrue); | 121 expect(range.containsKey('callSites'), isTrue); |
122 expect(range.containsKey('coverage'), isTrue); | 122 expect(range.containsKey('coverage'), isTrue); |
| 123 expect(range.containsKey('possibleBreakpoints'), isTrue); |
123 | 124 |
124 // missing scriptId with tokenPos. | 125 // missing scriptId with tokenPos. |
125 bool caughtException = false; | 126 bool caughtException = false; |
126 try { | 127 try { |
127 params = { 'reports' : ['Coverage'], | 128 params = { 'reports' : ['Coverage'], |
128 'tokenPos' : func.location.tokenPos }; | 129 'tokenPos' : func.location.tokenPos }; |
129 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); | 130 coverage = await isolate.invokeRpcNoUpgrade('_getSourceReport', params); |
130 } on ServerRpcException catch(e) { | 131 } on ServerRpcException catch(e) { |
131 caughtException = true; | 132 caughtException = true; |
132 expect(e.code, equals(ServerRpcException.kInvalidParams)); | 133 expect(e.code, equals(ServerRpcException.kInvalidParams)); |
(...skipping 15 matching lines...) Expand all Loading... |
148 expect(e.message, | 149 expect(e.message, |
149 "_getSourceReport: the 'endTokenPos' parameter requires the " | 150 "_getSourceReport: the 'endTokenPos' parameter requires the " |
150 "\'scriptId\' parameter"); | 151 "\'scriptId\' parameter"); |
151 } | 152 } |
152 expect(caughtException, isTrue); | 153 expect(caughtException, isTrue); |
153 }, | 154 }, |
154 | 155 |
155 ]; | 156 ]; |
156 | 157 |
157 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 158 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
OLD | NEW |