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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 2873593002: Force use of and cache render surface. (Closed)
Patch Set: Rebased to resolve conflict. Created 3 years, 5 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') | 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 00efb17664aa36bf8115cd6466d5487ab0ba6e78..eac9e825152689da93efc4d8bb8ab8881774be57 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -735,6 +735,7 @@ TEST_F(LayerWithDelegateTest, Cloning) {
layer->SetLayerInverted(true);
const float temperature = 0.8f;
layer->SetLayerTemperature(temperature);
+ layer->SetCacheRenderSurface(true);
auto clone = layer->Clone();
@@ -744,6 +745,9 @@ TEST_F(LayerWithDelegateTest, Cloning) {
EXPECT_EQ(SK_ColorRED, clone->GetTargetColor());
EXPECT_TRUE(clone->layer_inverted());
EXPECT_FLOAT_EQ(temperature, clone->GetTargetTemperature());
+ // Cloning should not preserve cache_render_surface flag.
+ EXPECT_NE(layer->cc_layer_for_testing()->cache_render_surface(),
+ clone->cc_layer_for_testing()->cache_render_surface());
layer->SetTransform(gfx::Transform());
layer->SetColor(SK_ColorGREEN);
@@ -1997,6 +2001,23 @@ TEST_F(LayerWithRealCompositorTest, SwitchCCLayerSolidColorWhileAnimating) {
EXPECT_EQ(transparent, root->GetTargetColor());
}
+// Tests that when a layer with cache_render_surface flag has its CC layer
+// switched, that the cache_render_surface flag is maintained.
+TEST_F(LayerWithRealCompositorTest, SwitchCCLayerCacheRenderSurface) {
+ std::unique_ptr<Layer> root(CreateLayer(LAYER_TEXTURED));
+ std::unique_ptr<Layer> l1(CreateLayer(LAYER_TEXTURED));
+ GetCompositor()->SetRootLayer(root.get());
+ root->Add(l1.get());
+
+ l1->SetCacheRenderSurface(true);
+
+ // Change l1's cc::Layer.
+ l1->SwitchCCLayerForTest();
+
+ // Ensure that the cache_render_surface flag is maintained.
+ EXPECT_TRUE(l1->cc_layer_for_testing()->cache_render_surface());
+}
+
// Tests that the animators in the layer tree is added to the
// animator-collection when the root-layer is set to the compositor.
TEST_F(LayerWithDelegateTest, RootLayerAnimatorsInCompositor) {
« no previous file with comments | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698