Chromium Code Reviews| 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=--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/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 h.x = e; h.y = k; | 51 h.x = e; h.y = k; |
| 52 i.x = k; | 52 i.x = k; |
| 53 j.x = i; | 53 j.x = i; |
| 54 k.x = i; k.y = r; | 54 k.x = i; k.y = r; |
| 55 l.x = h; | 55 l.x = h; |
| 56 } | 56 } |
| 57 | 57 |
| 58 var tests = [ | 58 var tests = [ |
| 59 (Isolate isolate) async { | 59 (Isolate isolate) async { |
| 60 final rootLib = await isolate.rootLibrary.load(); | 60 final rootLib = await isolate.rootLibrary.load(); |
| 61 final raw = await isolate.fetchHeapSnapshot(false).last; | 61 final raw = await isolate.fetchHeapSnapshot("VM", false).last; |
|
Cutch
2016/11/18 20:40:31
HeapSnapshotRoots.VM
| |
| 62 final snapshot = new HeapSnapshot(); | 62 final snapshot = new HeapSnapshot(); |
| 63 await snapshot.loadProgress(isolate, raw).last; | 63 await snapshot.loadProgress(isolate, raw).last; |
| 64 | 64 |
| 65 node(String className) { | 65 node(String className) { |
| 66 var cls = rootLib.classes.singleWhere((cls) => cls.name == className); | 66 var cls = rootLib.classes.singleWhere((cls) => cls.name == className); |
| 67 return snapshot.graph.vertices.singleWhere((v) => v.vmCid == cls.vmCid); | 67 return snapshot.graph.vertices.singleWhere((v) => v.vmCid == cls.vmCid); |
| 68 } | 68 } |
| 69 | 69 |
| 70 expect(node('I').dominator, equals(node('R'))); | 70 expect(node('I').dominator, equals(node('R'))); |
| 71 expect(node('K').dominator, equals(node('R'))); | 71 expect(node('K').dominator, equals(node('R'))); |
| 72 expect(node('C').dominator, equals(node('R'))); | 72 expect(node('C').dominator, equals(node('R'))); |
| 73 expect(node('H').dominator, equals(node('R'))); | 73 expect(node('H').dominator, equals(node('R'))); |
| 74 expect(node('E').dominator, equals(node('R'))); | 74 expect(node('E').dominator, equals(node('R'))); |
| 75 expect(node('A').dominator, equals(node('R'))); | 75 expect(node('A').dominator, equals(node('R'))); |
| 76 expect(node('D').dominator, equals(node('R'))); | 76 expect(node('D').dominator, equals(node('R'))); |
| 77 expect(node('B').dominator, equals(node('R'))); | 77 expect(node('B').dominator, equals(node('R'))); |
| 78 | 78 |
| 79 expect(node('F').dominator, equals(node('C'))); | 79 expect(node('F').dominator, equals(node('C'))); |
| 80 expect(node('G').dominator, equals(node('C'))); | 80 expect(node('G').dominator, equals(node('C'))); |
| 81 expect(node('J').dominator, equals(node('G'))); | 81 expect(node('J').dominator, equals(node('G'))); |
| 82 expect(node('L').dominator, equals(node('D'))); | 82 expect(node('L').dominator, equals(node('D'))); |
| 83 | 83 |
| 84 expect(node('R'), isNotNull); // The field. | 84 expect(node('R'), isNotNull); // The field. |
| 85 }, | 85 }, |
| 86 ]; | 86 ]; |
| 87 | 87 |
| 88 main(args) => runIsolateTests(args, tests, testeeBefore: buildGraph); | 88 main(args) => runIsolateTests(args, tests, testeeBefore: buildGraph); |
| OLD | NEW |