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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include "ash/session_state_delegate.h" | 7 #include "ash/session_state_delegate.h" |
8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // Activate the maximized window's workspace. GetFullscreenWindow() should | 380 // Activate the maximized window's workspace. GetFullscreenWindow() should |
381 // fail because the fullscreen window's workspace is no longer active. | 381 // fail because the fullscreen window's workspace is no longer active. |
382 w1->Activate(); | 382 w1->Activate(); |
383 EXPECT_FALSE(controller->GetFullscreenWindow()); | 383 EXPECT_FALSE(controller->GetFullscreenWindow()); |
384 | 384 |
385 // If the fullscreen window is active, GetFullscreenWindow() should find it. | 385 // If the fullscreen window is active, GetFullscreenWindow() should find it. |
386 w2->Activate(); | 386 w2->Activate(); |
387 EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow()); | 387 EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow()); |
388 } | 388 } |
389 | 389 |
| 390 // Test that user session window can't be focused if user session blocked by |
| 391 // some overlapping UI. |
| 392 TEST_F(RootWindowControllerTest, FocusBlockedWindow) { |
| 393 UpdateDisplay("600x600"); |
| 394 internal::RootWindowController* controller = |
| 395 Shell::GetInstance()->GetPrimaryRootWindowController(); |
| 396 aura::Window* lock_container = |
| 397 Shell::GetContainer(controller->root_window(), |
| 398 internal::kShellWindowId_LockScreenContainer); |
| 399 aura::Window* lock_window = Widget::CreateWindowWithParentAndBounds(NULL, |
| 400 lock_container, gfx::Rect(0, 0, 100, 100))->GetNativeView(); |
| 401 lock_window->Show(); |
| 402 aura::Window* session_window = |
| 403 CreateTestWidget(gfx::Rect(0, 0, 100, 100))->GetNativeView(); |
| 404 session_window->Show(); |
| 405 |
| 406 // Lock screen. |
| 407 Shell::GetInstance()->session_state_delegate()->LockScreen(); |
| 408 lock_window->Focus(); |
| 409 EXPECT_TRUE(lock_window->HasFocus()); |
| 410 session_window->Focus(); |
| 411 EXPECT_FALSE(session_window->HasFocus()); |
| 412 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); |
| 413 |
| 414 // Session not started yet. |
| 415 SetSessionStarted(false); |
| 416 lock_window->Focus(); |
| 417 EXPECT_TRUE(lock_window->HasFocus()); |
| 418 session_window->Focus(); |
| 419 EXPECT_FALSE(session_window->HasFocus()); |
| 420 SetSessionStarted(true); |
| 421 } |
| 422 |
390 } // namespace test | 423 } // namespace test |
391 } // namespace ash | 424 } // namespace ash |
OLD | NEW |