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=--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 | 8 |
9 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 expect(result['_heaps']['old']['type'], equals('HeapSpace')); | 33 expect(result['_heaps']['old']['type'], equals('HeapSpace')); |
34 }, | 34 }, |
35 | 35 |
36 (VM vm) async { | 36 (VM vm) async { |
37 var params = { | 37 var params = { |
38 'isolateId': 'badid', | 38 'isolateId': 'badid', |
39 }; | 39 }; |
40 bool caughtException; | 40 bool caughtException; |
41 try { | 41 try { |
42 await vm.invokeRpcNoUpgrade('getIsolate', params); | 42 await vm.invokeRpcNoUpgrade('getIsolate', params); |
43 expect(false, isTrue, reason: 'Unreachable'); | 43 expect(false, isTrue, reason:'Unreachable'); |
44 } on ServerRpcException catch (e) { | 44 } on ServerRpcException catch(e) { |
45 caughtException = true; | 45 caughtException = true; |
46 expect(e.code, equals(ServerRpcException.kInvalidParams)); | 46 expect(e.code, equals(ServerRpcException.kInvalidParams)); |
47 expect(e.message, "getIsolate: invalid 'isolateId' parameter: badid"); | 47 expect(e.message, |
| 48 "getIsolate: invalid 'isolateId' parameter: badid"); |
48 } | 49 } |
49 expect(caughtException, isTrue); | 50 expect(caughtException, isTrue); |
50 }, | 51 }, |
51 | 52 |
52 // Plausible isolate id, not found. | 53 // Plausible isolate id, not found. |
53 (VM vm) async { | 54 (VM vm) async { |
54 var params = { | 55 var params = { |
55 'isolateId': 'isolates/9999999999', | 56 'isolateId': 'isolates/9999999999', |
56 }; | 57 }; |
57 var result = await vm.invokeRpcNoUpgrade('getIsolate', params); | 58 var result = await vm.invokeRpcNoUpgrade('getIsolate', params); |
58 expect(result['type'], equals('Sentinel')); | 59 expect(result['type'], equals('Sentinel')); |
59 expect(result['kind'], equals('Collected')); | 60 expect(result['kind'], equals('Collected')); |
60 expect(result['valueAsString'], equals('<collected>')); | 61 expect(result['valueAsString'], equals('<collected>')); |
61 }, | 62 }, |
62 ]; | 63 ]; |
63 | 64 |
64 main(args) async => runVMTests(args, tests); | 65 main(args) async => runVMTests(args, tests); |
OLD | NEW |