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

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

Issue 2266343002: Converted Observatory heap-snapshot element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Added missing explanation text Created 4 years, 3 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
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/object_graph.dart'; 7 import 'package:observatory/object_graph.dart';
7 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
8 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
9 import 'test_helper.dart'; 10 import 'test_helper.dart';
10 11
11 class Foo { 12 class Foo {
12 Object left; 13 Object left;
13 Object right; 14 Object right;
14 } 15 }
15 Foo r; 16 Foo r;
(...skipping 19 matching lines...) Expand all
35 int fooId; 36 int fooId;
36 37
37 var tests = [ 38 var tests = [
38 39
39 (Isolate isolate) async { 40 (Isolate isolate) async {
40 Library lib = await isolate.rootLibrary.load(); 41 Library lib = await isolate.rootLibrary.load();
41 expect(lib.classes.length, equals(1)); 42 expect(lib.classes.length, equals(1));
42 Class fooClass = lib.classes.first; 43 Class fooClass = lib.classes.first;
43 fooId = fooClass.vmCid; 44 fooId = fooClass.vmCid;
44 45
45 HeapSnapshot snapshot = await isolate.fetchHeapSnapshot(false).last; 46 RawHeapSnapshot raw = await isolate.fetchHeapSnapshot(false).last;
47 HeapSnapshot snapshot = new HeapSnapshot();
48 await snapshot.loadProgress(isolate, raw).last;
46 ObjectGraph graph = snapshot.graph; 49 ObjectGraph graph = snapshot.graph;
47 50
48 expect(fooId, isNotNull); 51 expect(fooId, isNotNull);
49 Iterable<ObjectVertex> foos = graph.vertices.where( 52 Iterable<ObjectVertex> foos = graph.vertices.where(
50 (ObjectVertex obj) => obj.vmCid == fooId); 53 (ObjectVertex obj) => obj.vmCid == fooId);
51 expect(foos.length, equals(3)); 54 expect(foos.length, equals(3));
52 expect(foos.where((obj) => obj.successors.length == 0).length, 55 expect(foos.where((obj) => obj.successors.length == 0).length,
53 equals(1)); 56 equals(1));
54 expect(foos.where((obj) => obj.successors.length == 1).length, 57 expect(foos.where((obj) => obj.successors.length == 1).length,
55 equals(1)); 58 equals(1));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 expect(first.successors.length, 92 expect(first.successors.length,
90 equals(2 + second.successors.length)); 93 equals(2 + second.successors.length));
91 // ... and specifically, that it retains exactly itself + the long one. 94 // ... and specifically, that it retains exactly itself + the long one.
92 expect(first.retainedSize, 95 expect(first.retainedSize,
93 equals(first.shallowSize + second.shallowSize)); 96 equals(first.shallowSize + second.shallowSize));
94 }, 97 },
95 98
96 ]; 99 ];
97 100
98 main(args) => runIsolateTests(args, tests, testeeBefore: script); 101 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698