OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/system_modal_container_layout_manager.h" | 5 #include "ash/wm/system_modal_container_layout_manager.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/test/aura_shell_test_base.h" | 9 #include "ash/test/aura_shell_test_base.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 EXPECT_TRUE(IsActiveWindow(t2)); | 134 EXPECT_TRUE(IsActiveWindow(t2)); |
135 | 135 |
136 // Both transients should be destroyed with parent. | 136 // Both transients should be destroyed with parent. |
137 parent.reset(); | 137 parent.reset(); |
138 EXPECT_TRUE(do1.destroyed()); | 138 EXPECT_TRUE(do1.destroyed()); |
139 EXPECT_TRUE(do2.destroyed()); | 139 EXPECT_TRUE(do2.destroyed()); |
140 } | 140 } |
141 | 141 |
142 // Tests that we can activate an unrelated window after a modal window is closed | 142 // Tests that we can activate an unrelated window after a modal window is closed |
143 // for a window. | 143 // for a window. |
144 // TODO(beng): This test is disabled pending a solution re: visibility & target | |
145 // visibility. | |
146 TEST_F(SystemModalContainerLayoutManagerTest, | 144 TEST_F(SystemModalContainerLayoutManagerTest, |
147 DISABLED_CanActivateAfterEndModalSession) { | 145 CanActivateAfterEndModalSession) { |
148 scoped_ptr<aura::Window> unrelated(TestWindow::OpenTestWindow(NULL, false)); | 146 scoped_ptr<aura::Window> unrelated(TestWindow::OpenTestWindow(NULL, false)); |
149 unrelated->SetBounds(gfx::Rect(100, 100, 50, 50)); | 147 unrelated->SetBounds(gfx::Rect(100, 100, 50, 50)); |
150 scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false)); | 148 scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false)); |
151 // parent should be active. | 149 // parent should be active. |
152 EXPECT_TRUE(IsActiveWindow(parent.get())); | 150 EXPECT_TRUE(IsActiveWindow(parent.get())); |
153 | 151 |
154 scoped_ptr<aura::Window> transient( | 152 scoped_ptr<aura::Window> transient( |
155 TestWindow::OpenTestWindow(parent.get(), true)); | 153 TestWindow::OpenTestWindow(parent.get(), true)); |
156 // t1 should now be active. | 154 // t1 should now be active. |
157 EXPECT_TRUE(IsActiveWindow(transient.get())); | 155 EXPECT_TRUE(IsActiveWindow(transient.get())); |
158 | 156 |
159 // Attempting to click the parent should result in no activation change. | 157 // Attempting to click the parent should result in no activation change. |
160 aura::test::EventGenerator e1(parent.get()); | 158 aura::test::EventGenerator e1(parent.get()); |
161 e1.ClickLeftButton(); | 159 e1.ClickLeftButton(); |
162 EXPECT_TRUE(IsActiveWindow(transient.get())); | 160 EXPECT_TRUE(IsActiveWindow(transient.get())); |
163 | 161 |
164 // Now close the transient. | 162 // Now close the transient. |
165 transient.reset(); | 163 transient.reset(); |
166 | 164 |
| 165 MessageLoopForUI::current()->RunAllPending(); |
| 166 |
167 // parent should now be active again. | 167 // parent should now be active again. |
168 EXPECT_TRUE(IsActiveWindow(parent.get())); | 168 EXPECT_TRUE(IsActiveWindow(parent.get())); |
169 | 169 |
170 // Attempting to click unrelated should activate it. | 170 // Attempting to click unrelated should activate it. |
171 aura::test::EventGenerator e2(unrelated.get()); | 171 aura::test::EventGenerator e2(unrelated.get()); |
172 e2.ClickLeftButton(); | 172 e2.ClickLeftButton(); |
173 EXPECT_TRUE(IsActiveWindow(unrelated.get())); | 173 EXPECT_TRUE(IsActiveWindow(unrelated.get())); |
174 } | 174 } |
175 | 175 |
176 } // namespace test | 176 } // namespace test |
177 } // namespace ash | 177 } // namespace ash |
OLD | NEW |