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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 10832355: Prepare ui/compositor for WebLayer type change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« ui/compositor/layer.cc ('K') | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_unittest.cc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index 08623a79cbe7172aa67dca61262829ee71d1cbe8..a0c293fe16bac7e5e3a903c2ec0727618cca6519 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -696,9 +696,15 @@ TEST_F(LayerWithNullDelegateTest, Visibility) {
EXPECT_TRUE(l1->IsDrawn());
EXPECT_TRUE(l2->IsDrawn());
EXPECT_TRUE(l3->IsDrawn());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ EXPECT_EQ(1.f, l1->web_layer()->opacity());
+ EXPECT_EQ(1.f, l2->web_layer()->opacity());
+ EXPECT_EQ(1.f, l3->web_layer()->opacity());
+#else
EXPECT_EQ(1.f, l1->web_layer().opacity());
EXPECT_EQ(1.f, l2->web_layer().opacity());
EXPECT_EQ(1.f, l3->web_layer().opacity());
+#endif
compositor()->SetRootLayer(l1.get());
@@ -708,19 +714,31 @@ TEST_F(LayerWithNullDelegateTest, Visibility) {
EXPECT_FALSE(l1->IsDrawn());
EXPECT_FALSE(l2->IsDrawn());
EXPECT_FALSE(l3->IsDrawn());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ EXPECT_EQ(0.f, l1->web_layer()->opacity());
+#else
EXPECT_EQ(0.f, l1->web_layer().opacity());
+#endif
l3->SetVisible(false);
EXPECT_FALSE(l1->IsDrawn());
EXPECT_FALSE(l2->IsDrawn());
EXPECT_FALSE(l3->IsDrawn());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ EXPECT_EQ(0.f, l3->web_layer()->opacity());
+#else
EXPECT_EQ(0.f, l3->web_layer().opacity());
+#endif
l1->SetVisible(true);
EXPECT_TRUE(l1->IsDrawn());
EXPECT_TRUE(l2->IsDrawn());
EXPECT_FALSE(l3->IsDrawn());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ EXPECT_EQ(1.f, l1->web_layer()->opacity());
+#else
EXPECT_EQ(1.f, l1->web_layer().opacity());
+#endif
}
// Checks that stacking-related methods behave as advertised.
@@ -1128,9 +1146,17 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) {
EXPECT_EQ("10,20 200x220", root->bounds().ToString());
EXPECT_EQ("10,20 140x180", l1->bounds().ToString());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ gfx::Size size_in_pixel = root->web_layer()->bounds();
+#else
gfx::Size size_in_pixel = root->web_layer().bounds();
+#endif
EXPECT_EQ("200x220", size_in_pixel.ToString());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ size_in_pixel = l1->web_layer()->bounds();
+#else
size_in_pixel = l1->web_layer().bounds();
+#endif
EXPECT_EQ("140x180", size_in_pixel.ToString());
// No scale change, so no scale notification.
EXPECT_EQ(0.0f, root_delegate.device_scale_factor());
@@ -1145,9 +1171,17 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) {
EXPECT_EQ("10,20 200x220", root->bounds().ToString());
EXPECT_EQ("10,20 140x180", l1->bounds().ToString());
// Pixel size must have been scaled up.
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ size_in_pixel = root->web_layer()->bounds();
+#else
size_in_pixel = root->web_layer().bounds();
+#endif
EXPECT_EQ("400x440", size_in_pixel.ToString());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ size_in_pixel = l1->web_layer()->bounds();
+#else
size_in_pixel = l1->web_layer().bounds();
+#endif
EXPECT_EQ("280x360", size_in_pixel.ToString());
// New scale factor must have been notified.
EXPECT_EQ(2.0f, root_delegate.device_scale_factor());
@@ -1165,9 +1199,17 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleUpDown) {
EXPECT_EQ("10,20 200x220", root->bounds().ToString());
EXPECT_EQ("10,20 140x180", l1->bounds().ToString());
// Pixel size must have been scaled down.
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ size_in_pixel = root->web_layer()->bounds();
+#else
size_in_pixel = root->web_layer().bounds();
+#endif
EXPECT_EQ("200x220", size_in_pixel.ToString());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ size_in_pixel = l1->web_layer()->bounds();
+#else
size_in_pixel = l1->web_layer().bounds();
+#endif
EXPECT_EQ("140x180", size_in_pixel.ToString());
// New scale factor must have been notified.
EXPECT_EQ(1.0f, root_delegate.device_scale_factor());
@@ -1210,7 +1252,11 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleReparent) {
root->Add(l1.get());
EXPECT_EQ("10,20 140x180", l1->bounds().ToString());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ gfx::Size size_in_pixel = l1->web_layer()->bounds();
+#else
gfx::Size size_in_pixel = l1->web_layer().bounds();
+#endif
EXPECT_EQ("140x180", size_in_pixel.ToString());
EXPECT_EQ(0.0f, l1_delegate.device_scale_factor());
@@ -1225,13 +1271,21 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_ScaleReparent) {
GetCompositor()->SetScaleAndSize(2.0f, gfx::Size(500, 500));
// Sanity check on root and l1.
EXPECT_EQ("10,20 200x220", root->bounds().ToString());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ size_in_pixel = l1->web_layer()->bounds();
+#else
size_in_pixel = l1->web_layer().bounds();
+#endif
EXPECT_EQ("140x180", size_in_pixel.ToString());
root->Add(l1.get());
EXPECT_EQ("10,20 140x180", l1->bounds().ToString());
+#if defined(WEBLAYER_IS_PURE_VIRTUAL)
+ size_in_pixel = l1->web_layer()->bounds();
+#else
size_in_pixel = l1->web_layer().bounds();
+#endif
EXPECT_EQ("280x360", size_in_pixel.ToString());
EXPECT_EQ(2.0f, l1_delegate.device_scale_factor());
RunPendingMessages();
« ui/compositor/layer.cc ('K') | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698