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 library get_object_rpc_test; | 6 library get_object_rpc_test; |
7 | 7 |
8 import 'package:observatory/service_io.dart'; | 8 import 'package:observatory/service_io.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 expect(result['type'], equals('Instance')); | 93 expect(result['type'], equals('Instance')); |
94 expect(result['kind'], equals('List')); | 94 expect(result['kind'], equals('List')); |
95 expect(result['_vmType'], equals('GrowableObjectArray')); | 95 expect(result['_vmType'], equals('GrowableObjectArray')); |
96 expect(result['id'], startsWith('objects/')); | 96 expect(result['id'], startsWith('objects/')); |
97 expect(result['valueAsString'], isNull); | 97 expect(result['valueAsString'], isNull); |
98 expect(result['class']['type'], equals('@Class')); | 98 expect(result['class']['type'], equals('@Class')); |
99 expect(result['class']['name'], equals('_GrowableList')); | 99 expect(result['class']['name'], equals('_GrowableList')); |
100 expect(result['size'], isPositive); | 100 expect(result['size'], isPositive); |
101 expect(result['fields'], isEmpty); | 101 expect(result['fields'], isEmpty); |
102 expect(result['elements'].length, equals(3)); | 102 expect(result['elements'].length, equals(3)); |
103 expect(result['elements'][0]['index'], equals(0)); | 103 expect(result['elements'][0]['type'], equals('@Instance')); |
104 expect(result['elements'][0]['value']['type'], equals('@Instance')); | 104 expect(result['elements'][0]['kind'], equals('Int')); |
105 expect(result['elements'][0]['value']['kind'], equals('Int')); | 105 expect(result['elements'][0]['valueAsString'], equals('3')); |
106 expect(result['elements'][0]['value']['valueAsString'], equals('3')); | |
107 }, | 106 }, |
108 | 107 |
109 // A built-in Map. | 108 // A built-in Map. |
110 (Isolate isolate) async { | 109 (Isolate isolate) async { |
111 // Call eval to get a Dart map. | 110 // Call eval to get a Dart map. |
112 var evalResult = await eval(isolate, '{"x": 3, "y": 4}'); | 111 var evalResult = await eval(isolate, '{"x": 3, "y": 4}'); |
113 var params = { | 112 var params = { |
114 'objectId': evalResult['id'], | 113 'objectId': evalResult['id'], |
115 }; | 114 }; |
116 var result = await isolate.invokeRpcNoUpgrade('getObject', params); | 115 var result = await isolate.invokeRpcNoUpgrade('getObject', params); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 caughtException = true; | 451 caughtException = true; |
453 expect(e.code, equals(ServerRpcException.kInvalidParams)); | 452 expect(e.code, equals(ServerRpcException.kInvalidParams)); |
454 expect(e.message, | 453 expect(e.message, |
455 "getObject: invalid 'objectId' parameter: code/0"); | 454 "getObject: invalid 'objectId' parameter: code/0"); |
456 } | 455 } |
457 expect(caughtException, isTrue); | 456 expect(caughtException, isTrue); |
458 }, | 457 }, |
459 ]; | 458 ]; |
460 | 459 |
461 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); | 460 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); |
OLD | NEW |