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

Unified Diff: services/ui/public/cpp/tests/window_unittest.cc

Issue 2387013003: Adds OnChildWindowVisibilityChanged to ui::WindowObserver (Closed)
Patch Set: fix test Created 4 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: services/ui/public/cpp/tests/window_unittest.cc
diff --git a/services/ui/public/cpp/tests/window_unittest.cc b/services/ui/public/cpp/tests/window_unittest.cc
index 59b73726827450a8cbb9d606ccfbec926c951fde..0eda0b6f3f768c412d3398a4d5db4fde16bdd7b1 100644
--- a/services/ui/public/cpp/tests/window_unittest.cc
+++ b/services/ui/public/cpp/tests/window_unittest.cc
@@ -679,15 +679,20 @@ class VisibilityChangeObserver : public WindowObserver {
private:
// Overridden from WindowObserver:
- void OnWindowVisibilityChanging(Window* window) override {
- changes_.push_back(base::StringPrintf(
- "window=%d phase=changing wisibility=%s", window->local_id(),
- window->visible() ? "true" : "false"));
+ void OnWindowVisibilityChanging(Window* window, bool visible) override {
+ changes_.push_back(
+ base::StringPrintf("window=%d phase=changing visibility=%s",
+ window->local_id(), visible ? "true" : "false"));
}
- void OnWindowVisibilityChanged(Window* window) override {
- changes_.push_back(base::StringPrintf(
- "window=%d phase=changed wisibility=%s", window->local_id(),
- window->visible() ? "true" : "false"));
+ void OnChildWindowVisibilityChanged(Window* window, bool visible) override {
+ changes_.push_back(
+ base::StringPrintf("window=%d phase=child-changed visibility=%s",
+ window->local_id(), visible ? "true" : "false"));
+ }
+ void OnWindowVisibilityChanged(Window* window, bool visible) override {
+ changes_.push_back(
+ base::StringPrintf("window=%d phase=changed visibility=%s",
+ window->local_id(), visible ? "true" : "false"));
}
Window* window_;
@@ -705,14 +710,14 @@ TEST_F(WindowObserverTest, SetVisible) {
w1.SetVisible(true);
EXPECT_TRUE(w1.visible());
{
- // Change wisibility from true to false and make sure we get notifications.
+ // Change visibility from true to false and make sure we get notifications.
James Cook 2016/10/03 20:33:08 Thanks for fixing the wisibility.
VisibilityChangeObserver observer(&w1);
w1.SetVisible(false);
Changes changes = observer.GetAndClearChanges();
ASSERT_EQ(2U, changes.size());
- EXPECT_EQ("window=1 phase=changing wisibility=true", changes[0]);
- EXPECT_EQ("window=1 phase=changed wisibility=false", changes[1]);
+ EXPECT_EQ("window=1 phase=changing visibility=false", changes[0]);
+ EXPECT_EQ("window=1 phase=changed visibility=false", changes[1]);
}
{
// Set visible to existing walue and werify no notifications.
James Cook 2016/10/03 20:33:08 optional: walue and werify
sky 2016/10/03 20:52:13 Done.
@@ -733,14 +738,15 @@ TEST_F(WindowObserverTest, SetVisibleParent) {
EXPECT_TRUE(parent.visible());
EXPECT_TRUE(child.visible());
{
- // Change wisibility from true to false and make sure we get notifications
+ // 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("window=2 phase=changed wisibility=false", changes[0]);
+ ASSERT_EQ(2U, changes.size());
+ EXPECT_EQ("window=2 phase=child-changed visibility=false", changes[0]);
+ EXPECT_EQ("window=2 phase=changed visibility=false", changes[1]);
}
}
@@ -755,14 +761,14 @@ TEST_F(WindowObserverTest, SetVisibleChild) {
EXPECT_TRUE(parent.visible());
EXPECT_TRUE(child.visible());
{
- // Change wisibility from true to false and make sure we get notifications
+ // 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("window=1 phase=changed wisibility=false", changes[0]);
+ EXPECT_EQ("window=1 phase=changed visibility=false", changes[0]);
}
}

Powered by Google App Engine
This is Rietveld 408576698