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/heap_snapshot.dart'; | 6 import 'package:observatory/heap_snapshot.dart'; |
7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/object_graph.dart'; | 8 import 'package:observatory/object_graph.dart'; |
9 import 'package:observatory/service_io.dart'; | 9 import 'package:observatory/service_io.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 14 matching lines...) Expand all Loading... |
25 r = new Foo(); | 25 r = new Foo(); |
26 var a = new Foo(); | 26 var a = new Foo(); |
27 var b = new Foo(); | 27 var b = new Foo(); |
28 r.left = a; | 28 r.left = a; |
29 r.right = b; | 29 r.right = b; |
30 a.left = b; | 30 a.left = b; |
31 | 31 |
32 lst = new List(2); | 32 lst = new List(2); |
33 lst[0] = lst; // Self-loop. | 33 lst[0] = lst; // Self-loop. |
34 // Larger than any other fixed-size list in a fresh heap. | 34 // Larger than any other fixed-size list in a fresh heap. |
35 lst[1] = new List(123456); | 35 lst[1] = new List(1234569); |
36 } | 36 } |
37 | 37 |
38 int fooId; | 38 int fooId; |
39 | 39 |
40 var tests = [ | 40 var tests = [ |
41 (Isolate isolate) async { | 41 (Isolate isolate) async { |
42 Library lib = await isolate.rootLibrary.load(); | 42 Library lib = await isolate.rootLibrary.load(); |
43 expect(lib.classes.length, equals(1)); | 43 expect(lib.classes.length, equals(1)); |
44 Class fooClass = lib.classes.first; | 44 Class fooClass = lib.classes.first; |
45 fooId = fooClass.vmCid; | 45 fooId = fooClass.vmCid; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ObjectVertex first = lists[0]; | 89 ObjectVertex first = lists[0]; |
90 ObjectVertex second = lists[1]; | 90 ObjectVertex second = lists[1]; |
91 // Check that the short list retains more than the long list inside. | 91 // Check that the short list retains more than the long list inside. |
92 expect(first.successors.length, equals(2 + second.successors.length)); | 92 expect(first.successors.length, equals(2 + second.successors.length)); |
93 // ... and specifically, that it retains exactly itself + the long one. | 93 // ... and specifically, that it retains exactly itself + the long one. |
94 expect(first.retainedSize, equals(first.shallowSize + second.shallowSize)); | 94 expect(first.retainedSize, equals(first.shallowSize + second.shallowSize)); |
95 }, | 95 }, |
96 ]; | 96 ]; |
97 | 97 |
98 main(args) => runIsolateTests(args, tests, testeeBefore: script); | 98 main(args) => runIsolateTests(args, tests, testeeBefore: script); |
OLD | NEW |