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

Unified Diff: cc/resources/picture_layer_tiling_unittest.cc

Issue 13582006: Prioritize tiles near the viewport in out-of-viewport layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep original behavior Created 7 years, 8 months 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/resources/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/picture_layer_tiling_unittest.cc
diff --git a/cc/resources/picture_layer_tiling_unittest.cc b/cc/resources/picture_layer_tiling_unittest.cc
index 91043e67b48006e13d72f42781c97fd55828fcdb..54ae2dc2a7b9a8022a47c5011dd69ccc977c7938 100644
--- a/cc/resources/picture_layer_tiling_unittest.cc
+++ b/cc/resources/picture_layer_tiling_unittest.cc
@@ -5,6 +5,7 @@
#include "cc/resources/picture_layer_tiling.h"
#include "cc/test/fake_picture_layer_tiling_client.h"
+#include "cc/test/geometry_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/rect_conversions.h"
#include "ui/gfx/size_conversions.h"
@@ -180,7 +181,7 @@ TEST(PictureLayerTilingTest, ExpandRectEqual) {
int64 target_area = 100 * 200;
gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
in, target_area, bounds);
- EXPECT_EQ(in.ToString(), out.ToString());
+ EXPECT_RECT_EQ(in, out);
}
TEST(PictureLayerTilingTest, ExpandRectSmaller) {
@@ -215,7 +216,7 @@ TEST(PictureLayerTilingTest, ExpandRectBoundedSmaller) {
int64 target_area = 200 * 200;
gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
in, target_area, bounds);
- EXPECT_EQ(bounds.ToString(), out.ToString());
+ EXPECT_RECT_EQ(bounds, out);
}
TEST(PictureLayerTilingTest, ExpandRectBoundedEqual) {
@@ -224,7 +225,7 @@ TEST(PictureLayerTilingTest, ExpandRectBoundedEqual) {
int64 target_area = 200 * 200;
gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
in, target_area, bounds);
- EXPECT_EQ(bounds.ToString(), out.ToString());
+ EXPECT_RECT_EQ(bounds, out);
}
TEST(PictureLayerTilingTest, ExpandRectBoundedSmallerStretchVertical) {
@@ -233,7 +234,7 @@ TEST(PictureLayerTilingTest, ExpandRectBoundedSmallerStretchVertical) {
int64 target_area = 200 * 200;
gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
in, target_area, bounds);
- EXPECT_EQ(bounds.ToString(), out.ToString());
+ EXPECT_RECT_EQ(bounds, out);
}
TEST(PictureLayerTilingTest, ExpandRectBoundedEqualStretchVertical) {
@@ -242,7 +243,7 @@ TEST(PictureLayerTilingTest, ExpandRectBoundedEqualStretchVertical) {
int64 target_area = 200 * 200;
gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
in, target_area, bounds);
- EXPECT_EQ(bounds.ToString(), out.ToString());
+ EXPECT_RECT_EQ(bounds, out);
}
TEST(PictureLayerTilingTest, ExpandRectBoundedSmallerStretchHorizontal) {
@@ -251,7 +252,7 @@ TEST(PictureLayerTilingTest, ExpandRectBoundedSmallerStretchHorizontal) {
int64 target_area = 200 * 200;
gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
in, target_area, bounds);
- EXPECT_EQ(bounds.ToString(), out.ToString());
+ EXPECT_RECT_EQ(bounds, out);
}
TEST(PictureLayerTilingTest, ExpandRectBoundedEqualStretchHorizontal) {
@@ -260,7 +261,7 @@ TEST(PictureLayerTilingTest, ExpandRectBoundedEqualStretchHorizontal) {
int64 target_area = 200 * 200;
gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
in, target_area, bounds);
- EXPECT_EQ(bounds.ToString(), out.ToString());
+ EXPECT_RECT_EQ(bounds, out);
danakj 2013/04/10 05:33:23 nit: please leave these as they were. ToString() g
Xianzhu 2013/04/10 16:19:55 EXPECT_RECT_EQ is provided to compare gfx::Rects.
danakj 2013/04/10 16:30:59 I agree, I've been using .ToString() in new code.
Xianzhu 2013/04/10 16:44:49 I'd like to bring this topic to the graphics-dev g
}
TEST(PictureLayerTilingTest, ExpandRectBoundedLeft) {
@@ -352,11 +353,20 @@ TEST(PictureLayerTilingTest, ExpandRectSquishedVertically) {
TEST(PictureLayerTilingTest, ExpandRectOutOfBounds) {
gfx::Rect in(40, 50, 100, 200);
gfx::Rect bounds(0, 0, 10, 10);
- int64 target_area = 400 * 400;
+ int64 target_area = 10 * 10;
danakj 2013/04/10 05:33:23 nit: instead of changing this to be so small, can
Xianzhu 2013/04/10 16:19:55 Done.
gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
in, target_area, bounds);
EXPECT_TRUE(out.IsEmpty());
}
+TEST(PictureLayerTilingTest, ExpandRectOutOfBoundsNonEmptyResult) {
+ gfx::Rect in(40, 50, 100, 100);
+ gfx::Rect bounds(0, 0, 10, 10);
danakj 2013/04/10 05:33:23 Can you have this bounds be large enough that the
Xianzhu 2013/04/10 16:19:55 Done. Now test both cases.
+ int64 target_area = 400 * 400;
+ gfx::Rect out = PictureLayerTiling::ExpandRectEquallyToAreaBoundedBy(
+ in, target_area, bounds);
+ EXPECT_RECT_EQ(bounds, out);
danakj 2013/04/10 05:33:23 nit: compare with EXPECT_EQ and .ToString()
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698