| Index: ui/aura_shell/modal_container_layout_manager_unittest.cc
|
| ===================================================================
|
| --- ui/aura_shell/modal_container_layout_manager_unittest.cc (revision 114022)
|
| +++ ui/aura_shell/modal_container_layout_manager_unittest.cc (working copy)
|
| @@ -11,6 +11,7 @@
|
| #include "ui/aura_shell/shell.h"
|
| #include "ui/aura_shell/shell_window_ids.h"
|
| #include "ui/aura_shell/test/aura_shell_test_base.h"
|
| +#include "ui/aura_shell/window_util.h"
|
| #include "ui/views/widget/widget.h"
|
| #include "ui/views/widget/widget_delegate.h"
|
|
|
| @@ -81,7 +82,7 @@
|
|
|
| } // namespace
|
|
|
| -typedef aura_shell::test::AuraShellTestBase ModalContainerLayoutManagerTest;
|
| +typedef AuraShellTestBase ModalContainerLayoutManagerTest;
|
|
|
| TEST_F(ModalContainerLayoutManagerTest, NonModalTransient) {
|
| scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false));
|
| @@ -100,7 +101,7 @@
|
| TEST_F(ModalContainerLayoutManagerTest, ModalTransient) {
|
| scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false));
|
| // parent should be active.
|
| - EXPECT_EQ(parent.get(), aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(parent.get()));
|
|
|
| aura::Window* t1 = TestWindow::OpenTestWindow(parent.get(), true);
|
| TransientWindowObserver do1;
|
| @@ -110,19 +111,19 @@
|
| EXPECT_EQ(GetModalContainer(), t1->parent());
|
|
|
| // t1 should now be active.
|
| - EXPECT_EQ(t1, aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(t1));
|
|
|
| // Attempting to click the parent should result in no activation change.
|
| aura::test::EventGenerator e1(parent.get());
|
| e1.ClickLeftButton();
|
| - EXPECT_EQ(t1, aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(t1));
|
|
|
| // Now open another modal transient parented to the original modal transient.
|
| aura::Window* t2 = TestWindow::OpenTestWindow(t1, true);
|
| TransientWindowObserver do2;
|
| t2->AddObserver(&do2);
|
|
|
| - EXPECT_EQ(t2, aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(t2));
|
|
|
| EXPECT_EQ(t1, t2->transient_parent());
|
| EXPECT_EQ(GetModalContainer(), t2->parent());
|
| @@ -130,7 +131,7 @@
|
| // t2 should still be active, even after clicking on t1.
|
| aura::test::EventGenerator e2(t1);
|
| e2.ClickLeftButton();
|
| - EXPECT_EQ(t2, aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(t2));
|
|
|
| // Both transients should be destroyed with parent.
|
| parent.reset();
|
| @@ -145,28 +146,28 @@
|
| unrelated->SetBounds(gfx::Rect(100, 100, 50, 50));
|
| scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false));
|
| // parent should be active.
|
| - EXPECT_EQ(parent.get(), aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(parent.get()));
|
|
|
| scoped_ptr<aura::Window> transient(
|
| TestWindow::OpenTestWindow(parent.get(), true));
|
| // t1 should now be active.
|
| - EXPECT_EQ(transient.get(), aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(transient.get()));
|
|
|
| // Attempting to click the parent should result in no activation change.
|
| aura::test::EventGenerator e1(parent.get());
|
| e1.ClickLeftButton();
|
| - EXPECT_EQ(transient.get(), aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(transient.get()));
|
|
|
| // Now close the transient.
|
| transient.reset();
|
|
|
| // parent should now be active again.
|
| - EXPECT_EQ(parent.get(), aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(parent.get()));
|
|
|
| // Attempting to click unrelated should activate it.
|
| aura::test::EventGenerator e2(unrelated.get());
|
| e2.ClickLeftButton();
|
| - EXPECT_EQ(unrelated.get(), aura::RootWindow::GetInstance()->active_window());
|
| + EXPECT_TRUE(IsActiveWindow(unrelated.get()));
|
| }
|
|
|
| } // namespace test
|
|
|