Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: runtime/observatory/tests/service/get_object_rpc_test.dart

Issue 1150103005: Provide a logical view of VM-internal maps in Observatory. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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]['index'], equals(0));
104 expect(result['elements'][0]['value']['type'], equals('@Instance')); 104 expect(result['elements'][0]['value']['type'], equals('@Instance'));
105 expect(result['elements'][0]['value']['kind'], equals('Int')); 105 expect(result['elements'][0]['value']['kind'], equals('Int'));
106 expect(result['elements'][0]['value']['valueAsString'], equals('3')); 106 expect(result['elements'][0]['value']['valueAsString'], equals('3'));
107 }, 107 },
108 108
109 // A built-in Map.
110 (Isolate isolate) async {
111 // Call eval to get a Dart map.
112 var evalResult = await eval(isolate, '{"x": 3, "y": 4}');
113 var params = {
114 'objectId': evalResult['id'],
115 };
116 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
117 expect(result['type'], equals('Instance'));
118 expect(result['kind'], equals('Map'));
119 expect(result['_vmType'], equals('LinkedHashMap'));
120 expect(result['id'], startsWith('objects/'));
121 expect(result['valueAsString'], isNull);
122 expect(result['class']['type'], equals('@Class'));
123 expect(result['class']['name'], equals('_InternalLinkedHashMap'));
124 expect(result['size'], isPositive);
125 expect(result['fields'], isEmpty);
126 expect(result['associations'].length, equals(2));
127 expect(result['associations'][0]['key']['type'], equals('@Instance'));
128 expect(result['associations'][0]['key']['kind'], equals('String'));
129 expect(result['associations'][0]['key']['valueAsString'], equals('x'));
130 expect(result['associations'][0]['value']['type'], equals('@Instance'));
131 expect(result['associations'][0]['value']['kind'], equals('Int'));
132 expect(result['associations'][0]['value']['valueAsString'], equals('3'));
133 expect(result['associations'][1]['key']['type'], equals('@Instance'));
134 expect(result['associations'][1]['key']['kind'], equals('String'));
135 expect(result['associations'][1]['key']['valueAsString'], equals('y'));
136 expect(result['associations'][1]['value']['type'], equals('@Instance'));
137 expect(result['associations'][1]['value']['kind'], equals('Int'));
138 expect(result['associations'][1]['value']['valueAsString'], equals('4'));
139 },
140
109 // An expired object. 141 // An expired object.
110 (Isolate isolate) async { 142 (Isolate isolate) async {
111 var params = { 143 var params = {
112 'objectId': 'objects/99999999', 144 'objectId': 'objects/99999999',
113 }; 145 };
114 var result = await isolate.invokeRpcNoUpgrade('getObject', params); 146 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
115 expect(result['type'], equals('Sentinel')); 147 expect(result['type'], equals('Sentinel'));
116 expect(result['kind'], startsWith('Expired')); 148 expect(result['kind'], startsWith('Expired'));
117 expect(result['valueAsString'], equals('<expired>')); 149 expect(result['valueAsString'], equals('<expired>'));
118 expect(result['class'], isNull); 150 expect(result['class'], isNull);
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 caughtException = true; 454 caughtException = true;
423 expect(e.code, equals(ServerRpcException.kInvalidParams)); 455 expect(e.code, equals(ServerRpcException.kInvalidParams));
424 expect(e.message, 456 expect(e.message,
425 "getObject: invalid 'objectId' parameter: code/0"); 457 "getObject: invalid 'objectId' parameter: code/0");
426 } 458 }
427 expect(caughtException, isTrue); 459 expect(caughtException, isTrue);
428 }, 460 },
429 ]; 461 ];
430 462
431 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); 463 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup);
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698