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

Unified Diff: cc/picture_layer_tiling_unittest.cc

Issue 11414238: implement the logic to set tile priorities based on current matrix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
« cc/picture_layer_tiling.cc ('K') | « cc/picture_layer_tiling_set.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/picture_layer_tiling_unittest.cc
diff --git a/cc/picture_layer_tiling_unittest.cc b/cc/picture_layer_tiling_unittest.cc
index 03bd9aadb19d29f4e3b66b937cebed9e34fbda57..2e45af960348eba6d1c662b34999c534ec89bf42 100644
--- a/cc/picture_layer_tiling_unittest.cc
+++ b/cc/picture_layer_tiling_unittest.cc
@@ -64,6 +64,23 @@ class PictureLayerTilingIteratorTest : public testing::Test {
DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest);
};
+class PictureLayerTilingTest : public testing::Test {
+ public:
+ PictureLayerTilingTest() {
+ tiling_ = PictureLayerTiling::Create(0, gfx::Size(0, 0));
+ }
+
+ void VerifyTimeForBoundsToIntersect(gfx::Rect previous,
+ gfx::Rect current,
+ gfx::Rect target,
+ double time) {
+ EXPECT_EQ(tiling_->TimeForBoundsToIntersect(previous, current, 1, target),
+ time);
+ }
+ protected:
+ scoped_ptr<PictureLayerTiling> tiling_;
+};
+
TEST_F(PictureLayerTilingIteratorTest, IteratorCoversLayerBoundsNoScale) {
Initialize(gfx::Size(100, 100), 1, gfx::Size(1099, 801));
VerifyTilesExactlyCoverRect(1, gfx::Rect());
@@ -118,4 +135,42 @@ TEST_F(PictureLayerTilingIteratorTest, IteratorCoversLayerBoundsBothScale) {
VerifyTilesExactlyCoverRect(scale, gfx::Rect(2014, 1579, 867, 1033));
}
+TEST_F(PictureLayerTilingTest, TimeForBoundsToIntersectWithScroll) {
+ gfx::Rect target(0, 0, 800, 600);
+ gfx::Rect current(100, 100, 100, 100);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-200, 0, 100, 100), current, target, 0);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-100, 0, 100, 100), current, target, 0);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(400, 400, 100, 100), current, target, 0);
+
+ current = gfx::Rect(-300, -300, 100, 100);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(0, 0, 100, 100), current, target, 1000);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-200, -200, 100, 100), current, target, 1000);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-400, -400, 100, 100), current, target, 2);
+}
+
+TEST_F(PictureLayerTilingTest, TimeForBoundsToIntersectWithScale) {
+ gfx::Rect target(0, 0, 800, 600);
+ gfx::Rect current(100, 100, 100, 100);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-200, 0, 200, 200), current, target, 0);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-100, 0, 50, 50), current, target, 0);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(400, 400, 400, 400), current, target, 0);
+
+ current = gfx::Rect(-300, -300, 100, 100);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-400, -400, 300, 300), current, target, 1000);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-275, -275, 50, 50), current, target, 8);
+ VerifyTimeForBoundsToIntersect(
+ gfx::Rect(-450, -450, 50, 50), current, target, 1);
+}
+
} // namespace cc
« cc/picture_layer_tiling.cc ('K') | « cc/picture_layer_tiling_set.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698