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

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: Merge to trunk 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
« no previous file with comments | « ui/gfx/compositor/layer.cc ('k') | views/view_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/compositor/layer_unittest.cc
diff --git a/ui/gfx/compositor/layer_unittest.cc b/ui/gfx/compositor/layer_unittest.cc
index 0f14c9dde463c58975f8884a7810953326246aa9..0c839dd62823e8d55044575fe0ebc430487304e0 100644
--- a/ui/gfx/compositor/layer_unittest.cc
+++ b/ui/gfx/compositor/layer_unittest.cc
@@ -16,13 +16,15 @@ namespace ui {
namespace {
-// Use
+// There are three test classes in here that configure the Compositor and
+// Layer's slightly differently:
+// - LayerWithNullDelegateTest uses TestCompositor and NullLayerDelegate as the
+// LayerDelegate. This is typically the base class you want to use.
+// - LayerWithDelegateTest uses TestCompositor and does not set a LayerDelegate
+// on the delegates.
// - LayerWithRealCompositorTest when a real compositor is required for testing.
-// - Slow because they bring up a window.
-//
-// - LayerWithDelegateTest for testing functionality of the LayerDelegate.
-// - LayerWithNullDelegateTest for testing all other functionality.
-
+// - Slow because they bring up a window and run the real compositor. This
+// is typically not what you want.
class LayerWithRealCompositorTest : public testing::Test {
public:
LayerWithRealCompositorTest() {}
@@ -623,4 +625,42 @@ TEST_F(LayerWithNullDelegateTest, NoCompositor) {
EXPECT_EQ(NULL, l122->texture());
}
+// Various visibile/drawn assertions.
+TEST_F(LayerWithNullDelegateTest, 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
« no previous file with comments | « 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