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

Unified Diff: ui/compositor/layer_owner_unittest.cc

Issue 1125283015: Update Layer::GetTargetColor to account for animation state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « ui/compositor/layer.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_owner_unittest.cc
diff --git a/ui/compositor/layer_owner_unittest.cc b/ui/compositor/layer_owner_unittest.cc
index e3a32208898cdb27734ffba3d5443b392cf3fab3..c81332402df47cc16f6d2e1876f4d5529c7779b1 100644
--- a/ui/compositor/layer_owner_unittest.cc
+++ b/ui/compositor/layer_owner_unittest.cc
@@ -101,6 +101,30 @@ TEST(LayerOwnerTest, RecreateLayerHonorsAnimationTargets) {
EXPECT_EQ(SK_ColorGREEN, owner.layer()->background_color());
}
+// Tests that when a LAYER_SOLID_COLOR which is not backed by a SolidColorLayer
+// that opaqueness and color targets are maintained when the
+// LayerOwner::RecreateLayers is called.
+TEST(LayerOwnerTest, RecreateLayerSolidColorWithChangedCCLayerHonorsTargets) {
+ SkColor transparent = SK_ColorTRANSPARENT;
+ LayerOwner owner;
+ Layer* layer = new Layer(LAYER_SOLID_COLOR);
+ owner.SetLayer(layer);
+ layer->SetFillsBoundsOpaquely(false);
+ layer->SetColor(transparent);
+ // Changing the backing layer takes LAYER_SOLID_COLOR off of the normal layer
+ // flow, need to ensure that set values are maintained.
+ layer->SwitchCCLayerForTest();
+
+ EXPECT_FALSE(layer->fills_bounds_opaquely());
+ EXPECT_EQ(transparent, layer->background_color());
+ EXPECT_EQ(transparent, layer->GetTargetColor());
+
+ scoped_ptr<Layer> old_layer(owner.RecreateLayer());
+ EXPECT_FALSE(owner.layer()->fills_bounds_opaquely());
+ EXPECT_EQ(transparent, owner.layer()->background_color());
+ EXPECT_EQ(transparent, owner.layer()->GetTargetColor());
+}
+
TEST(LayerOwnerTest, RecreateRootLayerWithNullCompositor) {
LayerOwner owner;
Layer* layer = new Layer;
« no previous file with comments | « ui/compositor/layer.cc ('k') | ui/compositor/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698