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

Unified Diff: ash/wm/system_modal_container_layout_manager_unittest.cc

Issue 2098183002: Make system modal check more strict (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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: ash/wm/system_modal_container_layout_manager_unittest.cc
diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc
index c8c5b4890ec198e4df37e2fd733b318f891e3168..55f7cc811166a4b9ed200317020ca024864aa666 100644
--- a/ash/wm/system_modal_container_layout_manager_unittest.cc
+++ b/ash/wm/system_modal_container_layout_manager_unittest.cc
@@ -676,6 +676,31 @@ TEST_F(SystemModalContainerLayoutManagerTest, UpdateModalType) {
EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen());
}
+TEST_F(SystemModalContainerLayoutManagerTest, VisibilityChange) {
+ // Create a modal window.
+ std::unique_ptr<aura::Window> parent(OpenToplevelTestWindow(false));
+ std::unique_ptr<aura::Window> modal_window(
+ OpenTestWindowWithParent(parent.get(), true));
+ parent->Show();
+ modal_window->Show();
James Cook 2016/06/27 00:33:43 optional: Maybe test it prior to modal_window->Sho
oshima 2016/06/27 02:26:07 Done. (turns out the function was calling show, so
+ EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen());
+ EXPECT_TRUE(Shell::GetPrimaryRootWindowController()
James Cook 2016/06/27 00:33:43 optional nit: Cache pointer to SystemModalLayoutMa
oshima 2016/06/27 02:26:07 Done.
+ ->GetSystemModalLayoutManager(modal_window.get())
+ ->has_modal_background());
+
+ modal_window->Hide();
+ EXPECT_FALSE(WmShell::Get()->IsSystemModalWindowOpen());
+ EXPECT_FALSE(Shell::GetPrimaryRootWindowController()
+ ->GetSystemModalLayoutManager(modal_window.get())
+ ->has_modal_background());
+
+ modal_window->Show();
+ EXPECT_TRUE(WmShell::Get()->IsSystemModalWindowOpen());
+ EXPECT_TRUE(Shell::GetPrimaryRootWindowController()
+ ->GetSystemModalLayoutManager(modal_window.get())
+ ->has_modal_background());
+}
+
namespace {
class InputTestDelegate : public aura::test::TestWindowDelegate {

Powered by Google App Engine
This is Rietveld 408576698