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

Unified Diff: runtime/observatory/tests/service/object_graph_vm_test.dart

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/object_graph_vm_test.dart
diff --git a/runtime/observatory/tests/service/object_graph_vm_test.dart b/runtime/observatory/tests/service/object_graph_vm_test.dart
index 8b738cdb351662404eafadd4cb96ba4684d37f0b..eae16795a9de842ded7bc1ba8a71568d999e864f 100644
--- a/runtime/observatory/tests/service/object_graph_vm_test.dart
+++ b/runtime/observatory/tests/service/object_graph_vm_test.dart
@@ -14,7 +14,6 @@ class Foo {
Object left;
Object right;
}
-
Foo r;
List lst;
@@ -30,7 +29,7 @@ void script() {
a.left = b;
lst = new List(2);
- lst[0] = lst; // Self-loop.
+ lst[0] = lst; // Self-loop.
// Larger than any other fixed-size list in a fresh heap.
lst[1] = new List(123456);
}
@@ -38,61 +37,67 @@ void script() {
int fooId;
var tests = [
- (Isolate isolate) async {
- Library lib = await isolate.rootLibrary.load();
- expect(lib.classes.length, equals(1));
- Class fooClass = lib.classes.first;
- fooId = fooClass.vmCid;
-
- RawHeapSnapshot raw =
- await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.vm, false).last;
- HeapSnapshot snapshot = new HeapSnapshot();
- await snapshot.loadProgress(isolate, raw).last;
- ObjectGraph graph = snapshot.graph;
-
- expect(fooId, isNotNull);
- Iterable<ObjectVertex> foos =
- graph.vertices.where((ObjectVertex obj) => obj.vmCid == fooId);
- expect(foos.length, equals(3));
- expect(foos.where((obj) => obj.successors.length == 0).length, equals(1));
- expect(foos.where((obj) => obj.successors.length == 1).length, equals(1));
- expect(foos.where((obj) => obj.successors.length == 2).length, equals(1));
-
- ObjectVertex bVertex =
- foos.where((ObjectVertex obj) => obj.successors.length == 0).first;
- ObjectVertex aVertex =
- foos.where((ObjectVertex obj) => obj.successors.length == 1).first;
- ObjectVertex rVertex =
- foos.where((ObjectVertex obj) => obj.successors.length == 2).first;
-
- // TODO(koda): Check actual byte sizes.
-
- expect(aVertex.retainedSize, equals(aVertex.shallowSize));
- expect(bVertex.retainedSize, equals(bVertex.shallowSize));
- expect(
- rVertex.retainedSize,
- equals(
- aVertex.shallowSize + bVertex.shallowSize + rVertex.shallowSize));
-
- Library corelib =
- isolate.libraries.singleWhere((lib) => lib.uri == 'dart:core');
- await corelib.load();
- Class _List =
- corelib.classes.singleWhere((cls) => cls.vmName.startsWith('_List'));
- int kArrayCid = _List.vmCid;
- // startsWith to ignore the private mangling
- List<ObjectVertex> lists = new List.from(
- graph.vertices.where((ObjectVertex obj) => obj.vmCid == kArrayCid));
- expect(lists.length >= 2, isTrue);
- // Order by decreasing retained size.
- lists.sort((u, v) => v.retainedSize - u.retainedSize);
- ObjectVertex first = lists[0];
- ObjectVertex second = lists[1];
- // Check that the short list retains more than the long list inside.
- expect(first.successors.length, equals(2 + second.successors.length));
- // ... and specifically, that it retains exactly itself + the long one.
- expect(first.retainedSize, equals(first.shallowSize + second.shallowSize));
- },
+
+(Isolate isolate) async {
+ Library lib = await isolate.rootLibrary.load();
+ expect(lib.classes.length, equals(1));
+ Class fooClass = lib.classes.first;
+ fooId = fooClass.vmCid;
+
+ RawHeapSnapshot raw =
+ await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.vm, false).last;
+ HeapSnapshot snapshot = new HeapSnapshot();
+ await snapshot.loadProgress(isolate, raw).last;
+ ObjectGraph graph = snapshot.graph;
+
+ expect(fooId, isNotNull);
+ Iterable<ObjectVertex> foos = graph.vertices.where(
+ (ObjectVertex obj) => obj.vmCid == fooId);
+ expect(foos.length, equals(3));
+ expect(foos.where((obj) => obj.successors.length == 0).length,
+ equals(1));
+ expect(foos.where((obj) => obj.successors.length == 1).length,
+ equals(1));
+ expect(foos.where((obj) => obj.successors.length == 2).length,
+ equals(1));
+
+ ObjectVertex bVertex = foos.where(
+ (ObjectVertex obj) => obj.successors.length == 0).first;
+ ObjectVertex aVertex = foos.where(
+ (ObjectVertex obj) => obj.successors.length == 1).first;
+ ObjectVertex rVertex = foos.where(
+ (ObjectVertex obj) => obj.successors.length == 2).first;
+
+ // TODO(koda): Check actual byte sizes.
+
+ expect(aVertex.retainedSize, equals(aVertex.shallowSize));
+ expect(bVertex.retainedSize, equals(bVertex.shallowSize));
+ expect(rVertex.retainedSize, equals(aVertex.shallowSize +
+ bVertex.shallowSize +
+ rVertex.shallowSize));
+
+ Library corelib =
+ isolate.libraries.singleWhere((lib) => lib.uri == 'dart:core');
+ await corelib.load();
+ Class _List =
+ corelib.classes.singleWhere((cls) => cls.vmName.startsWith('_List'));
+ int kArrayCid = _List.vmCid;
+ // startsWith to ignore the private mangling
+ List<ObjectVertex> lists = new List.from(graph.vertices.where(
+ (ObjectVertex obj) => obj.vmCid == kArrayCid));
+ expect(lists.length >= 2, isTrue);
+ // Order by decreasing retained size.
+ lists.sort((u, v) => v.retainedSize - u.retainedSize);
+ ObjectVertex first = lists[0];
+ ObjectVertex second = lists[1];
+ // Check that the short list retains more than the long list inside.
+ expect(first.successors.length,
+ equals(2 + second.successors.length));
+ // ... and specifically, that it retains exactly itself + the long one.
+ expect(first.retainedSize,
+ equals(first.shallowSize + second.shallowSize));
+},
+
];
main(args) => runIsolateTests(args, tests, testeeBefore: script);

Powered by Google App Engine
This is Rietveld 408576698