| 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=--compile-all --error_on_bad_type --error_on_bad_override | 4 // VMOptions=--compile-all --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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 (ObjectVertex obj) => obj.successors.length == 2).first; | 64 (ObjectVertex obj) => obj.successors.length == 2).first; |
| 65 | 65 |
| 66 // TODO(koda): Check actual byte sizes. | 66 // TODO(koda): Check actual byte sizes. |
| 67 | 67 |
| 68 expect(aVertex.retainedSize, equals(aVertex.shallowSize)); | 68 expect(aVertex.retainedSize, equals(aVertex.shallowSize)); |
| 69 expect(bVertex.retainedSize, equals(bVertex.shallowSize)); | 69 expect(bVertex.retainedSize, equals(bVertex.shallowSize)); |
| 70 expect(rVertex.retainedSize, equals(aVertex.shallowSize + | 70 expect(rVertex.retainedSize, equals(aVertex.shallowSize + |
| 71 bVertex.shallowSize + | 71 bVertex.shallowSize + |
| 72 rVertex.shallowSize)); | 72 rVertex.shallowSize)); |
| 73 | 73 |
| 74 const int fixedSizeListCid = 61; | 74 const int fixedSizeListCid = 62; |
| 75 List<ObjectVertex> lists = new List.from(graph.vertices.where( | 75 List<ObjectVertex> lists = new List.from(graph.vertices.where( |
| 76 (ObjectVertex obj) => obj.vmCid == fixedSizeListCid)); | 76 (ObjectVertex obj) => obj.vmCid == fixedSizeListCid)); |
| 77 expect(lists.length >= 2, isTrue); | 77 expect(lists.length >= 2, isTrue); |
| 78 // Order by decreasing retained size. | 78 // Order by decreasing retained size. |
| 79 lists.sort((u, v) => v.retainedSize - u.retainedSize); | 79 lists.sort((u, v) => v.retainedSize - u.retainedSize); |
| 80 ObjectVertex first = lists[0]; | 80 ObjectVertex first = lists[0]; |
| 81 ObjectVertex second = lists[1]; | 81 ObjectVertex second = lists[1]; |
| 82 // Check that the short list retains more than the long list inside. | 82 // Check that the short list retains more than the long list inside. |
| 83 expect(first.successors.length, | 83 expect(first.successors.length, |
| 84 equals(2 + second.successors.length)); | 84 equals(2 + second.successors.length)); |
| 85 // ... and specifically, that it retains exactly itself + the long one. | 85 // ... and specifically, that it retains exactly itself + the long one. |
| 86 expect(first.retainedSize, | 86 expect(first.retainedSize, |
| 87 equals(first.shallowSize + second.shallowSize)); | 87 equals(first.shallowSize + second.shallowSize)); |
| 88 }, | 88 }, |
| 89 | 89 |
| 90 ]; | 90 ]; |
| 91 | 91 |
| 92 main(args) => runIsolateTests(args, tests, testeeBefore: script); | 92 main(args) => runIsolateTests(args, tests, testeeBefore: script); |
| OLD | NEW |