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

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

Issue 2502283003: Add a version of heap snapshots that use only fields and stack frames as roots and only include ins… (Closed)
Patch Set: . Created 4 years 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 import 'package:observatory/heap_snapshot.dart'; 6 import 'package:observatory/heap_snapshot.dart';
7 import 'package:observatory/models.dart' as M;
7 import 'package:observatory/object_graph.dart'; 8 import 'package:observatory/object_graph.dart';
8 import 'package:observatory/service_io.dart'; 9 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
10 import 'test_helper.dart'; 11 import 'test_helper.dart';
11 12
12 class Foo { 13 class Foo {
13 Object left; 14 Object left;
14 Object right; 15 Object right;
15 } 16 }
16 Foo r; 17 Foo r;
(...skipping 19 matching lines...) Expand all
36 int fooId; 37 int fooId;
37 38
38 var tests = [ 39 var tests = [
39 40
40 (Isolate isolate) async { 41 (Isolate isolate) async {
41 Library lib = await isolate.rootLibrary.load(); 42 Library lib = await isolate.rootLibrary.load();
42 expect(lib.classes.length, equals(1)); 43 expect(lib.classes.length, equals(1));
43 Class fooClass = lib.classes.first; 44 Class fooClass = lib.classes.first;
44 fooId = fooClass.vmCid; 45 fooId = fooClass.vmCid;
45 46
46 RawHeapSnapshot raw = await isolate.fetchHeapSnapshot(false).last; 47 RawHeapSnapshot raw =
48 await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last;
47 HeapSnapshot snapshot = new HeapSnapshot(); 49 HeapSnapshot snapshot = new HeapSnapshot();
48 await snapshot.loadProgress(isolate, raw).last; 50 await snapshot.loadProgress(isolate, raw).last;
49 ObjectGraph graph = snapshot.graph; 51 ObjectGraph graph = snapshot.graph;
50 52
51 expect(fooId, isNotNull); 53 expect(fooId, isNotNull);
52 Iterable<ObjectVertex> foos = graph.vertices.where( 54 Iterable<ObjectVertex> foos = graph.vertices.where(
53 (ObjectVertex obj) => obj.vmCid == fooId); 55 (ObjectVertex obj) => obj.vmCid == fooId);
54 expect(foos.length, equals(3)); 56 expect(foos.length, equals(3));
55 expect(foos.where((obj) => obj.successors.length == 0).length, 57 expect(foos.where((obj) => obj.successors.length == 0).length,
56 equals(1)); 58 equals(1));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 expect(first.successors.length, 94 expect(first.successors.length,
93 equals(2 + second.successors.length)); 95 equals(2 + second.successors.length));
94 // ... and specifically, that it retains exactly itself + the long one. 96 // ... and specifically, that it retains exactly itself + the long one.
95 expect(first.retainedSize, 97 expect(first.retainedSize,
96 equals(first.shallowSize + second.shallowSize)); 98 equals(first.shallowSize + second.shallowSize));
97 }, 99 },
98 100
99 ]; 101 ];
100 102
101 main(args) => runIsolateTests(args, tests, testeeBefore: script); 103 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698