| 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=--compile-all --error_on_bad_type --error_on_bad_override | 4 // VMOptions=--compile-all --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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 expect(result['heaps']['new']['type'], equals('HeapSpace')); | 53 expect(result['heaps']['new']['type'], equals('HeapSpace')); |
| 54 expect(result['heaps']['old']['type'], equals('HeapSpace')); | 54 expect(result['heaps']['old']['type'], equals('HeapSpace')); |
| 55 expect(result['members'].length, isPositive); | 55 expect(result['members'].length, isPositive); |
| 56 expect(result['members'][0]['type'], equals('ClassHeapStats')); | 56 expect(result['members'][0]['type'], equals('ClassHeapStats')); |
| 57 }, | 57 }, |
| 58 | 58 |
| 59 (Isolate isolate) async { | 59 (Isolate isolate) async { |
| 60 var params = { | 60 var params = { |
| 61 'reset' : 'banana', | 61 'reset' : 'banana', |
| 62 }; | 62 }; |
| 63 var result = await isolate.invokeRpcNoUpgrade( | 63 bool caughtException; |
| 64 '_getAllocationProfile', params); | 64 try { |
| 65 expect(result['type'], equals('Error')); | 65 await isolate.invokeRpcNoUpgrade('_getAllocationProfile', params); |
| 66 expect(result['message'], contains("invalid 'reset' parameter")); | 66 expect(false, isTrue, reason:'Unreachable'); |
| 67 } on ServerRpcException catch (e) { |
| 68 caughtException = true; |
| 69 expect(e.code, equals(ServerRpcException.kInvalidParams)); |
| 70 expect(e.data['details'], |
| 71 "_getAllocationProfile: invalid \'reset\' parameter: banana"); |
| 72 } |
| 73 expect(caughtException, isTrue); |
| 67 }, | 74 }, |
| 68 | 75 |
| 69 (Isolate isolate) async { | 76 (Isolate isolate) async { |
| 70 var params = { | 77 var params = { |
| 71 'gc' : 'banana', | 78 'gc' : 'banana', |
| 72 }; | 79 }; |
| 73 var result = await isolate.invokeRpcNoUpgrade( | 80 bool caughtException; |
| 74 '_getAllocationProfile', params); | 81 try { |
| 75 expect(result['type'], equals('Error')); | 82 await isolate.invokeRpcNoUpgrade( |
| 76 expect(result['message'], contains("invalid 'gc' parameter")); | 83 '_getAllocationProfile', params); |
| 84 expect(false, isTrue, reason:'Unreachable'); |
| 85 } on ServerRpcException catch (e) { |
| 86 caughtException = true; |
| 87 expect(e.code, equals(ServerRpcException.kInvalidParams)); |
| 88 expect(e.data['details'], |
| 89 "_getAllocationProfile: invalid \'gc\' parameter: banana"); |
| 90 } |
| 91 expect(caughtException, isTrue); |
| 77 }, | 92 }, |
| 78 ]; | 93 ]; |
| 79 | 94 |
| 80 main(args) async => runIsolateTests(args, tests); | 95 main(args) async => runIsolateTests(args, tests); |
| OLD | NEW |