| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" | 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 EXPECT_FALSE(browser_view->tabstrip()->IsImmersiveStyle()); | 115 EXPECT_FALSE(browser_view->tabstrip()->IsImmersiveStyle()); |
| 116 EXPECT_TRUE(browser_view->IsTabStripVisible()); | 116 EXPECT_TRUE(browser_view->IsTabStripVisible()); |
| 117 EXPECT_TRUE(browser_view->IsToolbarVisible()); | 117 EXPECT_TRUE(browser_view->IsToolbarVisible()); |
| 118 // Shelf hide triggered by enabling immersive mode eventually changes the | 118 // Shelf hide triggered by enabling immersive mode eventually changes the |
| 119 // widget bounds and causes a Layout(). Force it to happen early for test. | 119 // widget bounds and causes a Layout(). Force it to happen early for test. |
| 120 browser_view->parent()->Layout(); | 120 browser_view->parent()->Layout(); |
| 121 // Content area is still immediately below the tab indicators. | 121 // Content area is still immediately below the tab indicators. |
| 122 EXPECT_EQ(GetRectInWidget(browser_view).y() + Tab::GetImmersiveHeight(), | 122 EXPECT_EQ(GetRectInWidget(browser_view).y() + Tab::GetImmersiveHeight(), |
| 123 GetRectInWidget(contents_view).y()); | 123 GetRectInWidget(contents_view).y()); |
| 124 | 124 |
| 125 // Ending a reveal keeps us in immersive mode, but toolbar goes invisible. | 125 // End reveal by moving the mouse off the top-of-window views. We |
| 126 controller->CancelReveal(); | 126 // should stay in immersive mode, but the toolbar should go invisible. |
| 127 controller->SetMouseHoveredForTest(false); |
| 127 EXPECT_TRUE(controller->IsEnabled()); | 128 EXPECT_TRUE(controller->IsEnabled()); |
| 128 EXPECT_TRUE(controller->ShouldHideTopViews()); | 129 EXPECT_TRUE(controller->ShouldHideTopViews()); |
| 129 EXPECT_FALSE(controller->IsRevealed()); | 130 EXPECT_FALSE(controller->IsRevealed()); |
| 130 EXPECT_TRUE(browser_view->tabstrip()->IsImmersiveStyle()); | 131 EXPECT_TRUE(browser_view->tabstrip()->IsImmersiveStyle()); |
| 131 EXPECT_TRUE(browser_view->IsTabStripVisible()); | 132 EXPECT_TRUE(browser_view->IsTabStripVisible()); |
| 132 EXPECT_FALSE(browser_view->IsToolbarVisible()); | 133 EXPECT_FALSE(browser_view->IsToolbarVisible()); |
| 133 | 134 |
| 134 // Disabling immersive mode puts us back to the beginning. | 135 // Disabling immersive mode puts us back to the beginning. |
| 135 chrome::ToggleFullscreenMode(browser()); | 136 chrome::ToggleFullscreenMode(browser()); |
| 136 ASSERT_FALSE(browser_view->IsFullscreen()); | 137 ASSERT_FALSE(browser_view->IsFullscreen()); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 383 |
| 383 // Immersive mode should start in the closed state because the lock is no | 384 // Immersive mode should start in the closed state because the lock is no |
| 384 // longer held. | 385 // longer held. |
| 385 chrome::ToggleFullscreenMode(browser()); | 386 chrome::ToggleFullscreenMode(browser()); |
| 386 EXPECT_TRUE(controller->IsEnabled()); | 387 EXPECT_TRUE(controller->IsEnabled()); |
| 387 EXPECT_FALSE(controller->IsRevealed()); | 388 EXPECT_FALSE(controller->IsRevealed()); |
| 388 EXPECT_TRUE(controller->ShouldHideTopViews()); | 389 EXPECT_TRUE(controller->ShouldHideTopViews()); |
| 389 | 390 |
| 390 // 2) Test that acquiring a revealed state lock reveals the top-of-window | 391 // 2) Test that acquiring a revealed state lock reveals the top-of-window |
| 391 // views if they are hidden. | 392 // views if they are hidden. |
| 392 controller->CancelReveal(); | |
| 393 EXPECT_FALSE(controller->IsRevealed()); | 393 EXPECT_FALSE(controller->IsRevealed()); |
| 394 lock1.reset(controller->GetRevealedLock()); | 394 lock1.reset(controller->GetRevealedLock()); |
| 395 EXPECT_TRUE(controller->IsRevealed()); | 395 EXPECT_TRUE(controller->IsRevealed()); |
| 396 | 396 |
| 397 // 3) Test that the top-of-window views are only hidden when all of the locks | 397 // 3) Test that the top-of-window views are only hidden when all of the locks |
| 398 // are released. | 398 // are released. |
| 399 lock2.reset(controller->GetRevealedLock()); | 399 lock2.reset(controller->GetRevealedLock()); |
| 400 lock1.reset(); | 400 lock1.reset(); |
| 401 EXPECT_TRUE(controller->IsRevealed()); | 401 EXPECT_TRUE(controller->IsRevealed()); |
| 402 | 402 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 // Setting the window property directly toggles immersive mode. | 451 // Setting the window property directly toggles immersive mode. |
| 452 aura::Window* window = browser_view->GetWidget()->GetNativeWindow(); | 452 aura::Window* window = browser_view->GetWidget()->GetNativeWindow(); |
| 453 window->SetProperty(ash::internal::kImmersiveModeKey, true); | 453 window->SetProperty(ash::internal::kImmersiveModeKey, true); |
| 454 EXPECT_TRUE(immersive_controller->IsEnabled()); | 454 EXPECT_TRUE(immersive_controller->IsEnabled()); |
| 455 window->SetProperty(ash::internal::kImmersiveModeKey, false); | 455 window->SetProperty(ash::internal::kImmersiveModeKey, false); |
| 456 EXPECT_FALSE(immersive_controller->IsEnabled()); | 456 EXPECT_FALSE(immersive_controller->IsEnabled()); |
| 457 } | 457 } |
| 458 | 458 |
| 459 #endif // defined(OS_CHROMEOS) | 459 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |