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

Unified Diff: ui/gfx/compositor/layer_unittest.cc

Issue 8136005: Makes visbility inherited. That is, in order for a window to be (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Window now gets visibility from Layer. Created 9 years, 2 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
Index: ui/gfx/compositor/layer_unittest.cc
diff --git a/ui/gfx/compositor/layer_unittest.cc b/ui/gfx/compositor/layer_unittest.cc
index 0c479260865b38069974b81ed53f207805c3e144..b3ddaa0e32cf9a3b4eea85e57bdd3352e7bee593 100644
--- a/ui/gfx/compositor/layer_unittest.cc
+++ b/ui/gfx/compositor/layer_unittest.cc
@@ -476,5 +476,43 @@ TEST_F(LayerTest, NoCompositor) {
EXPECT_EQ(NULL, l122->texture());
}
+// Various visibile/drawn assertions.
+TEST_F(LayerTest, Visibility) {
+ scoped_ptr<Layer> l1(new Layer(NULL, Layer::LAYER_HAS_TEXTURE));
+ scoped_ptr<Layer> l2(new Layer(NULL, Layer::LAYER_HAS_TEXTURE));
+ scoped_ptr<Layer> l3(new Layer(NULL, Layer::LAYER_HAS_TEXTURE));
+ l1->Add(l2.get());
+ l2->Add(l3.get());
+
+ NullLayerDelegate delegate;
+ l1->set_delegate(&delegate);
+ l2->set_delegate(&delegate);
+ l3->set_delegate(&delegate);
+
+ // Layers should initially be drawn.
+ EXPECT_TRUE(l1->IsDrawn());
+ EXPECT_TRUE(l2->IsDrawn());
+ EXPECT_TRUE(l3->IsDrawn());
+
+ compositor()->SetRootLayer(l1.get());
+
+ Draw();
+
+ l1->SetVisible(false);
+ EXPECT_FALSE(l1->IsDrawn());
+ EXPECT_FALSE(l2->IsDrawn());
+ EXPECT_FALSE(l3->IsDrawn());
+
+ l3->SetVisible(false);
+ EXPECT_FALSE(l1->IsDrawn());
+ EXPECT_FALSE(l2->IsDrawn());
+ EXPECT_FALSE(l3->IsDrawn());
+
+ l1->SetVisible(true);
+ EXPECT_TRUE(l1->IsDrawn());
+ EXPECT_TRUE(l2->IsDrawn());
+ EXPECT_FALSE(l3->IsDrawn());
+}
+
} // namespace ui
« ui/aura/window.cc ('K') | « ui/gfx/compositor/layer.cc ('k') | views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698