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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 EXPECT_TRUE(IsActiveWindow(t2)); | 161 EXPECT_TRUE(IsActiveWindow(t2)); |
162 | 162 |
163 // Both transients should be destroyed with parent. | 163 // Both transients should be destroyed with parent. |
164 parent.reset(); | 164 parent.reset(); |
165 EXPECT_TRUE(do1.destroyed()); | 165 EXPECT_TRUE(do1.destroyed()); |
166 EXPECT_TRUE(do2.destroyed()); | 166 EXPECT_TRUE(do2.destroyed()); |
167 } | 167 } |
168 | 168 |
169 // Tests that we can activate an unrelated window after a modal window is closed | 169 // Tests that we can activate an unrelated window after a modal window is closed |
170 // for a window. | 170 // for a window. |
171 // TODO(beng): This test is disabled pending a solution re: visibility & target | |
172 // visibility. | |
173 TEST_F(SystemModalContainerLayoutManagerTest, | 171 TEST_F(SystemModalContainerLayoutManagerTest, |
174 DISABLED_CanActivateAfterEndModalSession) { | 172 CanActivateAfterEndModalSession) { |
175 scoped_ptr<aura::Window> unrelated(TestWindow::OpenTestWindow(NULL, false)); | 173 scoped_ptr<aura::Window> unrelated(TestWindow::OpenTestWindow(NULL, false)); |
176 unrelated->SetBounds(gfx::Rect(100, 100, 50, 50)); | 174 unrelated->SetBounds(gfx::Rect(100, 100, 50, 50)); |
177 scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false)); | 175 scoped_ptr<aura::Window> parent(TestWindow::OpenTestWindow(NULL, false)); |
178 // parent should be active. | 176 // parent should be active. |
179 EXPECT_TRUE(IsActiveWindow(parent.get())); | 177 EXPECT_TRUE(IsActiveWindow(parent.get())); |
180 | 178 |
181 scoped_ptr<aura::Window> transient( | 179 scoped_ptr<aura::Window> transient( |
182 TestWindow::OpenTestWindow(parent.get(), true)); | 180 TestWindow::OpenTestWindow(parent.get(), true)); |
183 // t1 should now be active. | 181 // t1 should now be active. |
184 EXPECT_TRUE(IsActiveWindow(transient.get())); | 182 EXPECT_TRUE(IsActiveWindow(transient.get())); |
185 | 183 |
186 // Attempting to click the parent should result in no activation change. | 184 // Attempting to click the parent should result in no activation change. |
187 aura::test::EventGenerator e1(parent.get()); | 185 aura::test::EventGenerator e1(parent.get()); |
188 e1.ClickLeftButton(); | 186 e1.ClickLeftButton(); |
189 EXPECT_TRUE(IsActiveWindow(transient.get())); | 187 EXPECT_TRUE(IsActiveWindow(transient.get())); |
190 | 188 |
191 // Now close the transient. | 189 // Now close the transient. |
192 transient.reset(); | 190 transient.reset(); |
193 | 191 |
| 192 MessageLoopForUI::current()->RunAllPending(); |
| 193 |
194 // parent should now be active again. | 194 // parent should now be active again. |
195 EXPECT_TRUE(IsActiveWindow(parent.get())); | 195 EXPECT_TRUE(IsActiveWindow(parent.get())); |
196 | 196 |
197 // Attempting to click unrelated should activate it. | 197 // Attempting to click unrelated should activate it. |
198 aura::test::EventGenerator e2(unrelated.get()); | 198 aura::test::EventGenerator e2(unrelated.get()); |
199 e2.ClickLeftButton(); | 199 e2.ClickLeftButton(); |
200 EXPECT_TRUE(IsActiveWindow(unrelated.get())); | 200 EXPECT_TRUE(IsActiveWindow(unrelated.get())); |
201 } | 201 } |
202 | 202 |
203 TEST_F(SystemModalContainerLayoutManagerTest, | 203 TEST_F(SystemModalContainerLayoutManagerTest, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 EXPECT_EQ(1, main_delegate->mouse_presses()); | 237 EXPECT_EQ(1, main_delegate->mouse_presses()); |
238 | 238 |
239 // Verify that none of the other containers received any more mouse presses. | 239 // Verify that none of the other containers received any more mouse presses. |
240 EXPECT_EQ(1, transient_delegate->mouse_presses()); | 240 EXPECT_EQ(1, transient_delegate->mouse_presses()); |
241 EXPECT_EQ(1, lock_delegate->mouse_presses()); | 241 EXPECT_EQ(1, lock_delegate->mouse_presses()); |
242 EXPECT_EQ(1, lock_modal_delegate->mouse_presses()); | 242 EXPECT_EQ(1, lock_modal_delegate->mouse_presses()); |
243 } | 243 } |
244 | 244 |
245 } // namespace test | 245 } // namespace test |
246 } // namespace ash | 246 } // namespace ash |
OLD | NEW |