| 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/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| 11 #include "ash/system/tray/system_tray_delegate.h" | 11 #include "ash/system/tray/system_tray_delegate.h" |
| 12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
| 13 #include "ash/wm/system_modal_container_layout_manager.h" | 13 #include "ash/wm/system_modal_container_layout_manager.h" |
| 14 #include "ash/wm/window_properties.h" |
| 14 #include "ash/wm/window_util.h" | 15 #include "ash/wm/window_util.h" |
| 15 #include "ui/aura/client/focus_change_observer.h" | 16 #include "ui/aura/client/focus_change_observer.h" |
| 16 #include "ui/aura/client/focus_client.h" | 17 #include "ui/aura/client/focus_client.h" |
| 17 #include "ui/aura/env.h" | 18 #include "ui/aura/env.h" |
| 18 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
| 19 #include "ui/aura/test/event_generator.h" | 20 #include "ui/aura/test/event_generator.h" |
| 20 #include "ui/aura/test/test_window_delegate.h" | 21 #include "ui/aura/test/test_window_delegate.h" |
| 21 #include "ui/aura/test/test_windows.h" | 22 #include "ui/aura/test/test_windows.h" |
| 22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
| 23 #include "ui/aura/window_tracker.h" | 24 #include "ui/aura/window_tracker.h" |
| 24 #include "ui/views/controls/menu/menu_controller.h" | 25 #include "ui/views/controls/menu/menu_controller.h" |
| 25 #include "ui/views/widget/widget.h" | 26 #include "ui/views/widget/widget.h" |
| 26 #include "ui/views/widget/widget_delegate.h" | 27 #include "ui/views/widget/widget_delegate.h" |
| 27 | 28 |
| 29 using aura::Window; |
| 30 using views::Widget; |
| 31 |
| 28 namespace ash { | 32 namespace ash { |
| 29 namespace { | 33 namespace { |
| 30 | 34 |
| 31 class TestDelegate : public views::WidgetDelegateView { | 35 class TestDelegate : public views::WidgetDelegateView { |
| 32 public: | 36 public: |
| 33 explicit TestDelegate(bool system_modal) : system_modal_(system_modal) {} | 37 explicit TestDelegate(bool system_modal) : system_modal_(system_modal) {} |
| 34 virtual ~TestDelegate() {} | 38 virtual ~TestDelegate() {} |
| 35 | 39 |
| 36 // Overridden from views::WidgetDelegate: | 40 // Overridden from views::WidgetDelegate: |
| 37 virtual views::View* GetContentsView() OVERRIDE { | 41 virtual views::View* GetContentsView() OVERRIDE { |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 controller->GetSystemModalLayoutManager(NULL)); | 316 controller->GetSystemModalLayoutManager(NULL)); |
| 313 | 317 |
| 314 views::Widget* session_modal_widget = | 318 views::Widget* session_modal_widget = |
| 315 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 319 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
| 316 EXPECT_EQ(Shell::GetContainer(controller->root_window(), | 320 EXPECT_EQ(Shell::GetContainer(controller->root_window(), |
| 317 internal::kShellWindowId_SystemModalContainer)->layout_manager(), | 321 internal::kShellWindowId_SystemModalContainer)->layout_manager(), |
| 318 controller->GetSystemModalLayoutManager( | 322 controller->GetSystemModalLayoutManager( |
| 319 session_modal_widget->GetNativeView())); | 323 session_modal_widget->GetNativeView())); |
| 320 } | 324 } |
| 321 | 325 |
| 326 // Ensure a workspace with two windows reports immersive mode even if only |
| 327 // one has the property set. |
| 328 TEST_F(RootWindowControllerTest, ImmersiveMode) { |
| 329 UpdateDisplay("600x600"); |
| 330 internal::RootWindowController* controller = |
| 331 Shell::GetInstance()->GetPrimaryRootWindowController(); |
| 332 |
| 333 // Open a maximized window. |
| 334 Widget* w1 = CreateTestWidget(gfx::Rect(0, 1, 250, 251)); |
| 335 w1->Maximize(); |
| 336 |
| 337 // Immersive mode off by default. |
| 338 EXPECT_FALSE(controller->IsImmersiveMode()); |
| 339 |
| 340 // Enter immersive mode. |
| 341 w1->GetNativeWindow()->SetProperty(ash::internal::kImmersiveModeKey, true); |
| 342 EXPECT_TRUE(controller->IsImmersiveMode()); |
| 343 |
| 344 // Add a child, like a print window. Still in immersive mode. |
| 345 Widget* w2 = |
| 346 Widget::CreateWindowWithParentAndBounds(NULL, |
| 347 w1->GetNativeWindow(), |
| 348 gfx::Rect(0, 1, 150, 151)); |
| 349 w2->Show(); |
| 350 EXPECT_TRUE(controller->IsImmersiveMode()); |
| 351 } |
| 352 |
| 322 } // namespace test | 353 } // namespace test |
| 323 } // namespace ash | 354 } // namespace ash |
| OLD | NEW |