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

Unified Diff: mojo/services/public/cpp/view_manager/tests/view_unittest.cc

Issue 782693004: Update mojo sdk to rev f6c8ec07c01deebc13178d516225fd12695c3dc2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hack mojo_system_impl gypi for android :| Created 6 years 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: 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 {

Powered by Google App Engine
This is Rietveld 408576698