Index: cc/base/rtree_unittest.cc |
diff --git a/cc/base/rtree_unittest.cc b/cc/base/rtree_unittest.cc |
index 83288832a9a6c6e27f4a4d72b328c1e15cbb32fa..7b13f352c035f717d714607a4f843576dde9b287 100644 |
--- a/cc/base/rtree_unittest.cc |
+++ b/cc/base/rtree_unittest.cc |
@@ -10,6 +10,20 @@ |
namespace cc { |
+TEST(RTreeTest, ReserveNodesDoesntDcheck) { |
+ // Make sure that anywhere between 0 and 1000 rects, our reserve math in rtree |
+ // is correct. (This test would DCHECK if broken either in |
+ // RTree::AllocateNodeAtLevel, indicating that the capacity calculation was |
+ // too small or in RTree::Build, indicating the capacity was too large). |
+ for (int i = 0; i < 1000; ++i) { |
+ std::vector<gfx::Rect> rects; |
+ for (int j = 0; j < i; ++j) |
+ rects.push_back(gfx::Rect(j, i, 1, 1)); |
+ RTree rtree; |
+ rtree.Build(rects); |
+ } |
+} |
+ |
TEST(RTreeTest, NoOverlap) { |
std::vector<gfx::Rect> rects; |
for (int y = 0; y < 50; ++y) { |