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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/session_state_delegate.h" | 8 #include "ash/session_state_delegate.h" |
9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 controller->GetSystemModalLayoutManager(NULL)); | 365 controller->GetSystemModalLayoutManager(NULL)); |
366 | 366 |
367 views::Widget* session_modal_widget = | 367 views::Widget* session_modal_widget = |
368 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 368 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
369 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 369 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
370 internal::kShellWindowId_SystemModalContainer)->layout_manager(), | 370 internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
371 controller->GetSystemModalLayoutManager( | 371 controller->GetSystemModalLayoutManager( |
372 session_modal_widget->GetNativeView())); | 372 session_modal_widget->GetNativeView())); |
373 } | 373 } |
374 | 374 |
375 // Ensure a workspace with two windows reports immersive mode even if only | 375 // Test that GetFullscreenWindow() returns a fullscreen window only if the |
376 // one has the property set. | 376 // fullscreen window is in the active workspace. |
377 TEST_F(RootWindowControllerTest, ImmersiveMode) { | 377 TEST_F(RootWindowControllerTest, GetFullscreenWindow) { |
378 UpdateDisplay("600x600"); | 378 UpdateDisplay("600x600"); |
379 internal::RootWindowController* controller = | 379 internal::RootWindowController* controller = |
380 Shell::GetInstance()->GetPrimaryRootWindowController(); | 380 Shell::GetInstance()->GetPrimaryRootWindowController(); |
381 | 381 |
382 // Open a maximized window. | 382 Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); |
383 Widget* w1 = CreateTestWidget(gfx::Rect(0, 1, 250, 251)); | |
384 w1->Maximize(); | 383 w1->Maximize(); |
| 384 Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); |
| 385 w2->SetFullscreen(true); |
| 386 // |w3| is a transient child of |w2|. |
| 387 Widget* w3 = Widget::CreateWindowWithParentAndBounds(NULL, |
| 388 w2->GetNativeWindow(), gfx::Rect(0, 0, 100, 100)); |
385 | 389 |
386 // Immersive mode off by default. | 390 // Test that GetFullscreenWindow() finds the fullscreen window when one of |
387 EXPECT_FALSE(controller->IsImmersiveMode()); | 391 // its transient children is active. |
| 392 w3->Activate(); |
| 393 EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow()); |
388 | 394 |
389 // Enter immersive mode. | 395 // Activate the maximized window's workspace. GetFullscreenWindow() should |
390 w1->GetNativeWindow()->SetProperty(ash::internal::kImmersiveModeKey, true); | 396 // fail because the fullscreen window's workspace is no longer active. |
391 EXPECT_TRUE(controller->IsImmersiveMode()); | 397 w1->Activate(); |
| 398 EXPECT_FALSE(controller->GetFullscreenWindow()); |
392 | 399 |
393 // Add a child, like a print window. Still in immersive mode. | 400 // If the fullscreen window is active, GetFullscreenWindow() should find it. |
394 Widget* w2 = | 401 w2->Activate(); |
395 Widget::CreateWindowWithParentAndBounds(NULL, | 402 EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow()); |
396 w1->GetNativeWindow(), | |
397 gfx::Rect(0, 1, 150, 151)); | |
398 w2->Show(); | |
399 EXPECT_TRUE(controller->IsImmersiveMode()); | |
400 } | 403 } |
401 | 404 |
402 } // namespace test | 405 } // namespace test |
403 } // namespace ash | 406 } // namespace ash |
OLD | NEW |