Updates RootWindowController to delete the keyboard container before recreating the keyboard controller since the controller creates a new window in GetWindowContainer().
BUG=299787
Review URL: https://codereview.chromium.org/25105002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226324 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index 0753600..4155c1a9 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -594,5 +594,23 @@
}
}
+// Test for http://crbug.com/299787. RootWindowController should delete
+// the old container since the keyboard controller creates a new window in
+// GetWindowContainer().
+TEST_F(VirtualKeyboardRootWindowControllerTest,
+ DeleteOldContainerOnVirtualKeyboardInit) {
+ aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
+ aura::Window* keyboard_container = Shell::GetContainer(root_window,
+ internal::kShellWindowId_VirtualKeyboardContainer);
+ ASSERT_TRUE(keyboard_container);
+ // Track the keyboard container window.
+ aura::WindowTracker tracker;
+ tracker.Add(keyboard_container);
+ // Mock a login state change to reinitialize the keyboard.
+ ash::Shell::GetInstance()->OnLoginStateChanged(user::LOGGED_IN_OWNER);
+ // keyboard_container should no longer be present.
+ EXPECT_FALSE(tracker.Contains(keyboard_container));
+}
+
} // namespace test
} // namespace ash