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

Unified Diff: cc/base/rtree_unittest.cc

Issue 2591533002: cc: Change RTree nodes container to be a vector (with reserve). (Closed)
Patch Set: compile fix Created 4 years 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
« no previous file with comments | « cc/base/rtree.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « cc/base/rtree.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698