Index: cc/resources/picture_pile_unittest.cc |
diff --git a/cc/resources/picture_pile_unittest.cc b/cc/resources/picture_pile_unittest.cc |
index 15cb3d31e3e7fc48630c6e3c673713bcecc8b21d..d58a8bc398656cd3181dcbc70e2e8949db9a231d 100644 |
--- a/cc/resources/picture_pile_unittest.cc |
+++ b/cc/resources/picture_pile_unittest.cc |
@@ -364,6 +364,66 @@ TEST_F(PicturePileTest, NoInvalidationValidViewport) { |
EXPECT_EQ(Region().ToString(), invalidation.ToString()); |
} |
+TEST_F(PicturePileTest, BigFullLayerInvalidation) { |
+ gfx::Size huge_layer_size(100000000, 100000000); |
+ gfx::Rect viewport(300000, 400000, 5000, 6000); |
+ |
+ // Resize the pile. |
+ Region invalidation; |
+ UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); |
+ |
+ // Invalidating a huge layer should be fast. |
+ base::TimeTicks start = base::TimeTicks::Now(); |
+ invalidation = gfx::Rect(huge_layer_size); |
+ UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); |
+ base::TimeTicks end = base::TimeTicks::Now(); |
+ base::TimeDelta length = end - start; |
+ // This is verrrry generous to avoid flake. |
+ EXPECT_LT(length.InSeconds(), 5); |
+} |
+ |
+TEST_F(PicturePileTest, BigFullLayerInvalidationWithResizeGrow) { |
+ gfx::Size huge_layer_size(100000000, 100000000); |
+ gfx::Rect viewport(300000, 400000, 5000, 6000); |
+ |
+ // Resize the pile. |
+ Region invalidation; |
+ UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); |
+ |
+ // Resize the pile even larger, while invalidating everything in the old size. |
+ // Invalidating the whole thing should be fast. |
+ base::TimeTicks start = base::TimeTicks::Now(); |
+ gfx::Size bigger_layer_size(huge_layer_size.width() * 2, |
+ huge_layer_size.height() * 2); |
+ invalidation = gfx::Rect(huge_layer_size); |
+ UpdateAndExpandInvalidation(&invalidation, bigger_layer_size, viewport); |
+ base::TimeTicks end = base::TimeTicks::Now(); |
+ base::TimeDelta length = end - start; |
+ // This is verrrry generous to avoid flake. |
+ EXPECT_LT(length.InSeconds(), 5); |
+} |
+ |
+TEST_F(PicturePileTest, BigFullLayerInvalidationWithResizeShrink) { |
+ gfx::Size huge_layer_size(100000000, 100000000); |
+ gfx::Rect viewport(300000, 400000, 5000, 6000); |
+ |
+ // Resize the pile. |
+ Region invalidation; |
+ UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); |
+ |
+ // Resize the pile smaller, while invalidating everything in the new size. |
+ // Invalidating the whole thing should be fast. |
+ base::TimeTicks start = base::TimeTicks::Now(); |
+ gfx::Size smaller_layer_size(huge_layer_size.width() - 1000, |
+ huge_layer_size.height() - 1000); |
+ invalidation = gfx::Rect(smaller_layer_size); |
+ UpdateAndExpandInvalidation(&invalidation, smaller_layer_size, viewport); |
+ base::TimeTicks end = base::TimeTicks::Now(); |
+ base::TimeDelta length = end - start; |
+ // This is verrrry generous to avoid flake. |
+ EXPECT_LT(length.InSeconds(), 5); |
enne (OOO)
2014/10/11 00:26:33
Are there correctness tests you can do here too, l
danakj
2014/10/11 00:30:22
Hmm ya I guess that'd be good. I did break some LT
|
+} |
+ |
TEST_F(PicturePileTest, InvalidationOutsideRecordingRect) { |
gfx::Size huge_layer_size(10000000, 20000000); |
gfx::Rect viewport(300000, 400000, 5000, 6000); |