| 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_delegate.h" |
| 8 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 9 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/window_util.h" | 11 #include "ash/wm/window_util.h" |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 13 #include "ui/aura/test/event_generator.h" | 14 #include "ui/aura/test/event_generator.h" |
| 14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 15 #include "ui/views/events/event.h" | 16 #include "ui/views/events/event.h" |
| 16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 17 #include "ui/views/widget/widget_delegate.h" | 18 #include "ui/views/widget/widget_delegate.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // Create a modal window for the main window and verify that the main window | 221 // Create a modal window for the main window and verify that the main window |
| 221 // no longer receives mouse events. | 222 // no longer receives mouse events. |
| 222 EventTestWindow* transient_delegate = new EventTestWindow(true); | 223 EventTestWindow* transient_delegate = new EventTestWindow(true); |
| 223 aura::Window* transient = transient_delegate->OpenTestWindow(main.get()); | 224 aura::Window* transient = transient_delegate->OpenTestWindow(main.get()); |
| 224 EXPECT_TRUE(wm::IsActiveWindow(transient)); | 225 EXPECT_TRUE(wm::IsActiveWindow(transient)); |
| 225 e1.ClickLeftButton(); | 226 e1.ClickLeftButton(); |
| 226 EXPECT_EQ(1, transient_delegate->mouse_presses()); | 227 EXPECT_EQ(1, transient_delegate->mouse_presses()); |
| 227 | 228 |
| 228 // Create a window in the lock screen container and ensure that it receives | 229 // Create a window in the lock screen container and ensure that it receives |
| 229 // the mouse event instead of the modal window (crbug.com/110920). | 230 // the mouse event instead of the modal window (crbug.com/110920). |
| 231 Shell::GetInstance()->delegate()->LockScreen(); |
| 230 EventTestWindow* lock_delegate = new EventTestWindow(false); | 232 EventTestWindow* lock_delegate = new EventTestWindow(false); |
| 231 scoped_ptr<aura::Window> lock(lock_delegate->OpenTestWindow( | 233 scoped_ptr<aura::Window> lock(lock_delegate->OpenTestWindow( |
| 232 Shell::GetInstance()->GetContainer( | 234 Shell::GetInstance()->GetContainer( |
| 233 ash::internal::kShellWindowId_LockScreenContainer))); | 235 ash::internal::kShellWindowId_LockScreenContainer))); |
| 234 EXPECT_TRUE(wm::IsActiveWindow(lock.get())); | 236 EXPECT_TRUE(wm::IsActiveWindow(lock.get())); |
| 235 e1.ClickLeftButton(); | 237 e1.ClickLeftButton(); |
| 236 EXPECT_EQ(1, lock_delegate->mouse_presses()); | 238 EXPECT_EQ(1, lock_delegate->mouse_presses()); |
| 237 | 239 |
| 238 // Make sure that a modal container created by the lock screen can still | 240 // Make sure that a modal container created by the lock screen can still |
| 239 // receive mouse events. | 241 // receive mouse events. |
| 240 EventTestWindow* lock_modal_delegate = new EventTestWindow(true); | 242 EventTestWindow* lock_modal_delegate = new EventTestWindow(true); |
| 241 aura::Window* lock_modal = lock_modal_delegate->OpenTestWindow(lock.get()); | 243 aura::Window* lock_modal = lock_modal_delegate->OpenTestWindow(lock.get()); |
| 242 EXPECT_TRUE(wm::IsActiveWindow(lock_modal)); | 244 EXPECT_TRUE(wm::IsActiveWindow(lock_modal)); |
| 243 e1.ClickLeftButton(); | 245 e1.ClickLeftButton(); |
| 244 EXPECT_EQ(1, main_delegate->mouse_presses()); | 246 EXPECT_EQ(1, main_delegate->mouse_presses()); |
| 245 | 247 |
| 246 // Verify that none of the other containers received any more mouse presses. | 248 // Verify that none of the other containers received any more mouse presses. |
| 247 EXPECT_EQ(1, transient_delegate->mouse_presses()); | 249 EXPECT_EQ(1, transient_delegate->mouse_presses()); |
| 248 EXPECT_EQ(1, lock_delegate->mouse_presses()); | 250 EXPECT_EQ(1, lock_delegate->mouse_presses()); |
| 249 EXPECT_EQ(1, lock_modal_delegate->mouse_presses()); | 251 EXPECT_EQ(1, lock_modal_delegate->mouse_presses()); |
| 252 |
| 253 Shell::GetInstance()->delegate()->UnlockScreen(); |
| 250 } | 254 } |
| 251 | 255 |
| 252 } // namespace test | 256 } // namespace test |
| 253 } // namespace ash | 257 } // namespace ash |
| OLD | NEW |