| OLD | NEW |
| 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/object_graph.dart'; | 6 import 'package:observatory/object_graph.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 24 matching lines...) Expand all Loading... |
| 35 int fooId; | 35 int fooId; |
| 36 | 36 |
| 37 var tests = [ | 37 var tests = [ |
| 38 | 38 |
| 39 (Isolate isolate) async { | 39 (Isolate isolate) async { |
| 40 Library lib = await isolate.rootLibrary.load(); | 40 Library lib = await isolate.rootLibrary.load(); |
| 41 expect(lib.classes.length, equals(1)); | 41 expect(lib.classes.length, equals(1)); |
| 42 Class fooClass = lib.classes.first; | 42 Class fooClass = lib.classes.first; |
| 43 fooId = fooClass.vmCid; | 43 fooId = fooClass.vmCid; |
| 44 | 44 |
| 45 HeapSnapshot snapshot = await isolate.fetchHeapSnapshot().last; | 45 HeapSnapshot snapshot = await isolate.fetchHeapSnapshot(false).last; |
| 46 ObjectGraph graph = snapshot.graph; | 46 ObjectGraph graph = snapshot.graph; |
| 47 | 47 |
| 48 expect(fooId, isNotNull); | 48 expect(fooId, isNotNull); |
| 49 Iterable<ObjectVertex> foos = graph.vertices.where( | 49 Iterable<ObjectVertex> foos = graph.vertices.where( |
| 50 (ObjectVertex obj) => obj.vmCid == fooId); | 50 (ObjectVertex obj) => obj.vmCid == fooId); |
| 51 expect(foos.length, equals(3)); | 51 expect(foos.length, equals(3)); |
| 52 expect(foos.where((obj) => obj.successors.length == 0).length, | 52 expect(foos.where((obj) => obj.successors.length == 0).length, |
| 53 equals(1)); | 53 equals(1)); |
| 54 expect(foos.where((obj) => obj.successors.length == 1).length, | 54 expect(foos.where((obj) => obj.successors.length == 1).length, |
| 55 equals(1)); | 55 equals(1)); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 expect(first.successors.length, | 89 expect(first.successors.length, |
| 90 equals(2 + second.successors.length)); | 90 equals(2 + second.successors.length)); |
| 91 // ... and specifically, that it retains exactly itself + the long one. | 91 // ... and specifically, that it retains exactly itself + the long one. |
| 92 expect(first.retainedSize, | 92 expect(first.retainedSize, |
| 93 equals(first.shallowSize + second.shallowSize)); | 93 equals(first.shallowSize + second.shallowSize)); |
| 94 }, | 94 }, |
| 95 | 95 |
| 96 ]; | 96 ]; |
| 97 | 97 |
| 98 main(args) => runIsolateTests(args, tests, testeeBefore: script); | 98 main(args) => runIsolateTests(args, tests, testeeBefore: script); |
| OLD | NEW |