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

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

Issue 1865553003: vm-service: Answer fields from superclass to subclass in declaration order (layout order). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: reverse abc Created 4 years, 8 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 | « no previous file | runtime/vm/object_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4 // VMOptions=--error_on_bad_type --error_on_bad_override
5
6 library get_object_rpc_test;
7
8 import 'dart:typed_data';
9 import 'package:observatory/service_io.dart';
10 import 'package:unittest/unittest.dart';
11 import 'test_helper.dart';
12
13 class Super {
14 var z = 1;
15 var y = 2;
16 }
17 class Sub extends Super {
18 var y = 3;
19 var x = 4;
20 }
21
22 eval(Isolate isolate, String expression) async {
23 Map params = {
24 'targetId': isolate.rootLibrary.id,
25 'expression': expression,
26 };
27 return await isolate.invokeRpcNoUpgrade('evaluate', params);
28 }
29
30 var tests = [
31 (Isolate isolate) async {
32 // Call eval to get a Dart list.
33 var evalResult = await eval(isolate, 'new Sub()');
34 var params = {
35 'objectId': evalResult['id'],
36 };
37 var result = await isolate.invokeRpcNoUpgrade('getObject', params);
38 print(result);
39 expect(result['type'], equals('Instance'));
40 expect(result['kind'], equals('PlainInstance'));
41 expect(result['class']['name'], equals('Sub'));
42 expect(result['size'], isPositive);
43 expect(result['fields'][0]['decl']['name'], 'z');
44 expect(result['fields'][0]['value']['valueAsString'], '1');
45 expect(result['fields'][1]['decl']['name'], 'y');
46 expect(result['fields'][1]['value']['valueAsString'], '2');
47 expect(result['fields'][2]['decl']['name'], 'y');
48 expect(result['fields'][2]['value']['valueAsString'], '3');
49 expect(result['fields'][3]['decl']['name'], 'x');
50 expect(result['fields'][3]['value']['valueAsString'], '4');
51 },
52 ];
53
54 main(args) async => runIsolateTests(args, tests);
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698