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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 25596002: aura: Use Layer::SetShowPaintedContent to stop showing external content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: layer-showpaintedcontent: nits Created 7 years, 3 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/views/view.h » ('j') | 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 fedd2991008f84fe840b6f3a75359ecb43180baf..a941d45553afb940b8a36157f8f19a6fe4986975 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -1344,6 +1344,33 @@ TEST_F(LayerWithDelegateTest, DelegatedLayer) {
gfx::Size(20, 20).ToString());
}
+TEST_F(LayerWithDelegateTest, ExternalContent) {
+ scoped_ptr<Layer> root(CreateNoTextureLayer(gfx::Rect(0, 0, 1000, 1000)));
+ scoped_ptr<Layer> child(CreateLayer(LAYER_TEXTURED));
+
+ child->SetBounds(gfx::Rect(0, 0, 10, 10));
+ child->SetVisible(true);
+ root->Add(child.get());
+
+ // The layer is already showing painted content, so the cc layer won't change.
+ scoped_refptr<cc::Layer> before = child->cc_layer();
+ child->SetShowPaintedContent();
+ EXPECT_TRUE(child->cc_layer());
+ EXPECT_EQ(before, child->cc_layer());
+
+ // Showing delegated content changes the underlying cc layer.
+ before = child->cc_layer();
+ child->SetDelegatedFrame(MakeFrameData(gfx::Size(10, 10)), gfx::Size(10, 10));
+ EXPECT_TRUE(child->cc_layer());
+ EXPECT_NE(before, child->cc_layer());
+
+ // Changing to painted content should change the underlying cc layer.
+ before = child->cc_layer();
+ child->SetShowPaintedContent();
+ EXPECT_TRUE(child->cc_layer());
+ EXPECT_NE(before, child->cc_layer());
+}
+
// Tests Layer::AddThreadedAnimation and Layer::RemoveThreadedAnimation.
TEST_F(LayerWithRealCompositorTest, AddRemoveThreadedAnimations) {
scoped_ptr<Layer> root(CreateLayer(LAYER_TEXTURED));
« no previous file with comments | « ui/compositor/layer.cc ('k') | ui/views/view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698