Index: runtime/vm/object_graph_test.cc |
=================================================================== |
--- runtime/vm/object_graph_test.cc (revision 36049) |
+++ runtime/vm/object_graph_test.cc (working copy) |
@@ -91,6 +91,24 @@ |
EXPECT_EQ(a_size + b_size + c_size + d_size, |
graph.SizeRetainedByInstance(a)); |
} |
+ { |
+ // Get hold of c again. |
+ b ^= a.At(0); |
+ c ^= b.At(0); |
+ b = Array::null(); |
+ Array& path = Array::Handle(Array::New(2, Heap::kNew)); |
+ ObjectGraph graph(isolate); |
+ // A retaining path should end like this: c <- b <- a <- ... |
+ // c itself is not included in the returned path and length. |
+ intptr_t length = graph.RetainingPath(&c, path); |
+ EXPECT_LE(2, length); |
+ Array& expected_b = Array::Handle(); |
+ expected_b ^= path.At(0); |
+ Array& expected_a = Array::Handle(); |
+ expected_a ^= path.At(1); |
+ EXPECT(expected_b.raw() == a.At(0)); |
+ EXPECT(expected_a.raw() == a.raw()); |
+ } |
Cutch
2014/05/20 17:39:12
What about a test that doesn't have a path?
Also,
koda
2014/05/20 20:37:49
Done.
|
} |
} // namespace dart |