Index: mojo/services/public/cpp/view_manager/tests/view_unittest.cc |
diff --git a/mojo/services/public/cpp/view_manager/tests/view_unittest.cc b/mojo/services/public/cpp/view_manager/tests/view_unittest.cc |
index b0bd08b6b768d30d3789a73500f8528b88474c27..96b2d5cb906eb13819950bada23f67ddec9d6b4e 100644 |
--- a/mojo/services/public/cpp/view_manager/tests/view_unittest.cc |
+++ b/mojo/services/public/cpp/view_manager/tests/view_unittest.cc |
@@ -695,6 +695,46 @@ TEST_F(ViewObserverTest, SetVisible) { |
} |
} |
+TEST_F(ViewObserverTest, SetVisibleParent) { |
+ TestView parent; |
+ ViewPrivate(&parent).set_id(1); |
+ TestView child; |
+ ViewPrivate(&child).set_id(2); |
+ parent.AddChild(&child); |
+ EXPECT_TRUE(parent.visible()); |
+ EXPECT_TRUE(child.visible()); |
+ { |
+ // Change visibility from true to false and make sure we get notifications |
+ // on the parent. |
+ VisibilityChangeObserver observer(&parent); |
+ child.SetVisible(false); |
+ |
+ Changes changes = observer.GetAndClearChanges(); |
+ ASSERT_EQ(1U, changes.size()); |
+ EXPECT_EQ("view=0,2 phase=changed visibility=false", changes[0]); |
+ } |
+} |
+ |
+TEST_F(ViewObserverTest, SetVisibleChild) { |
+ TestView parent; |
+ ViewPrivate(&parent).set_id(1); |
+ TestView child; |
+ ViewPrivate(&child).set_id(2); |
+ parent.AddChild(&child); |
+ EXPECT_TRUE(parent.visible()); |
+ EXPECT_TRUE(child.visible()); |
+ { |
+ // Change visibility from true to false and make sure we get notifications |
+ // on the child. |
+ VisibilityChangeObserver observer(&child); |
+ parent.SetVisible(false); |
+ |
+ Changes changes = observer.GetAndClearChanges(); |
+ ASSERT_EQ(1U, changes.size()); |
+ EXPECT_EQ("view=0,1 phase=changed visibility=false", changes[0]); |
+ } |
+} |
+ |
namespace { |
class SharedPropertyChangeObserver : public ViewObserver { |