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, | 47 expect(e.message, "getIsolate: invalid 'isolateId' parameter: badid"); |
48 "getIsolate: invalid 'isolateId' parameter: badid"); | |
49 } | 48 } |
50 expect(caughtException, isTrue); | 49 expect(caughtException, isTrue); |
51 }, | 50 }, |
52 | 51 |
53 // Plausible isolate id, not found. | 52 // Plausible isolate id, not found. |
54 (VM vm) async { | 53 (VM vm) async { |
55 var params = { | 54 var params = { |
56 'isolateId': 'isolates/9999999999', | 55 'isolateId': 'isolates/9999999999', |
57 }; | 56 }; |
58 var result = await vm.invokeRpcNoUpgrade('getIsolate', params); | 57 var result = await vm.invokeRpcNoUpgrade('getIsolate', params); |
59 expect(result['type'], equals('Sentinel')); | 58 expect(result['type'], equals('Sentinel')); |
60 expect(result['kind'], equals('Collected')); | 59 expect(result['kind'], equals('Collected')); |
61 expect(result['valueAsString'], equals('<collected>')); | 60 expect(result['valueAsString'], equals('<collected>')); |
62 }, | 61 }, |
63 ]; | 62 ]; |
64 | 63 |
65 main(args) async => runVMTests(args, tests); | 64 main(args) async => runVMTests(args, tests); |
OLD | NEW |