| 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 library get_object_rpc_test; | 6 library get_object_rpc_test; |
| 7 | 7 |
| 8 import 'dart:typed_data'; | 8 import 'dart:typed_data'; |
| 9 import 'dart:convert' show BASE64; | 9 import 'dart:convert' show BASE64; |
| 10 import 'package:observatory/service_io.dart'; | 10 import 'package:observatory/service_io.dart'; |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 expect(e.message, | 767 expect(e.message, |
| 768 startsWith("getObject: invalid 'objectId' parameter: ")); | 768 startsWith("getObject: invalid 'objectId' parameter: ")); |
| 769 } | 769 } |
| 770 expect(caughtException, isTrue); | 770 expect(caughtException, isTrue); |
| 771 }, | 771 }, |
| 772 | 772 |
| 773 // field | 773 // field |
| 774 (Isolate isolate) async { | 774 (Isolate isolate) async { |
| 775 // Call eval to get a class id. | 775 // Call eval to get a class id. |
| 776 var evalResult = await eval(isolate, 'new _DummyClass()'); | 776 var evalResult = await eval(isolate, 'new _DummyClass()'); |
| 777 var id = "${evalResult['class']['id']}/fields/0"; | 777 var id = "${evalResult['class']['id']}/fields/dummyVar"; |
| 778 var params = { | 778 var params = { |
| 779 'objectId': id, | 779 'objectId': id, |
| 780 }; | 780 }; |
| 781 var result = await isolate.invokeRpcNoUpgrade('getObject', params); | 781 var result = await isolate.invokeRpcNoUpgrade('getObject', params); |
| 782 expect(result['type'], equals('Field')); | 782 expect(result['type'], equals('Field')); |
| 783 expect(result['id'], equals(id)); | 783 expect(result['id'], equals(id)); |
| 784 expect(result['name'], equals('dummyVar')); | 784 expect(result['name'], equals('dummyVar')); |
| 785 expect(result['const'], equals(false)); | 785 expect(result['const'], equals(false)); |
| 786 expect(result['static'], equals(true)); | 786 expect(result['static'], equals(true)); |
| 787 expect(result['final'], equals(false)); | 787 expect(result['final'], equals(false)); |
| 788 expect(result['location']['type'], equals('SourceLocation')); | 788 expect(result['location']['type'], equals('SourceLocation')); |
| 789 expect(result['staticValue']['valueAsString'], equals('11')); | 789 expect(result['staticValue']['valueAsString'], equals('11')); |
| 790 expect(result['_guardNullable'], isNotNull); | 790 expect(result['_guardNullable'], isNotNull); |
| 791 expect(result['_guardClass'], isNotNull); | 791 expect(result['_guardClass'], isNotNull); |
| 792 expect(result['_guardLength'], isNotNull); | 792 expect(result['_guardLength'], isNotNull); |
| 793 }, | 793 }, |
| 794 | 794 |
| 795 // invalid field. | 795 // invalid field. |
| 796 (Isolate isolate) async { | 796 (Isolate isolate) async { |
| 797 // Call eval to get a class id. | 797 // Call eval to get a class id. |
| 798 var evalResult = await eval(isolate, 'new _DummyClass()'); | 798 var evalResult = await eval(isolate, 'new _DummyClass()'); |
| 799 var id = "${evalResult['class']['id']}/fields/9999"; | 799 var id = "${evalResult['class']['id']}/fields/mythicalField"; |
| 800 var params = { | 800 var params = { |
| 801 'objectId': id, | 801 'objectId': id, |
| 802 }; | 802 }; |
| 803 bool caughtException; | 803 bool caughtException; |
| 804 try { | 804 try { |
| 805 await isolate.invokeRpcNoUpgrade('getObject', params); | 805 await isolate.invokeRpcNoUpgrade('getObject', params); |
| 806 expect(false, isTrue, reason:'Unreachable'); | 806 expect(false, isTrue, reason:'Unreachable'); |
| 807 } on ServerRpcException catch(e) { | 807 } on ServerRpcException catch(e) { |
| 808 caughtException = true; | 808 caughtException = true; |
| 809 expect(e.code, equals(ServerRpcException.kInvalidParams)); | 809 expect(e.code, equals(ServerRpcException.kInvalidParams)); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 caughtException = true; | 854 caughtException = true; |
| 855 expect(e.code, equals(ServerRpcException.kInvalidParams)); | 855 expect(e.code, equals(ServerRpcException.kInvalidParams)); |
| 856 expect(e.message, | 856 expect(e.message, |
| 857 "getObject: invalid 'objectId' parameter: code/0"); | 857 "getObject: invalid 'objectId' parameter: code/0"); |
| 858 } | 858 } |
| 859 expect(caughtException, isTrue); | 859 expect(caughtException, isTrue); |
| 860 }, | 860 }, |
| 861 ]; | 861 ]; |
| 862 | 862 |
| 863 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); | 863 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); |
| OLD | NEW |