| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 231 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 // Test how being simultaneously in tab fullscreen and immersive fullscreen | 234 // Test how being simultaneously in tab fullscreen and immersive fullscreen |
| 235 // affects the shelf visibility and whether the tab indicators are hidden. | 235 // affects the shelf visibility and whether the tab indicators are hidden. |
| 236 IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshTest, | 236 IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshTest, |
| 237 TabAndBrowserFullscreen) { | 237 TabAndBrowserFullscreen) { |
| 238 ash::internal::ShelfLayoutManager* shelf = | 238 ash::internal::ShelfLayoutManager* shelf = |
| 239 ash::Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | 239 ash::Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); |
| 240 | 240 |
| 241 controller()->SetForceHideTabIndicatorsForTest(false); | |
| 242 | |
| 243 // The shelf should start out as visible. | 241 // The shelf should start out as visible. |
| 244 ASSERT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 242 ASSERT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); |
| 245 | 243 |
| 246 // 1) Test that entering tab fullscreen from immersive mode hides the tab | 244 // 1) Test that entering tab fullscreen from immersive mode hides the tab |
| 247 // indicators and the shelf. | 245 // indicators and the shelf. |
| 248 chrome::ToggleFullscreenMode(browser()); | 246 chrome::ToggleFullscreenMode(browser()); |
| 249 ASSERT_TRUE(controller()->IsEnabled()); | 247 ASSERT_TRUE(controller()->IsEnabled()); |
| 250 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 248 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
| 251 EXPECT_FALSE(controller()->ShouldHideTabIndicators()); | 249 EXPECT_FALSE(controller()->ShouldHideTabIndicators()); |
| 252 | 250 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 282 waiter->Wait(); | 280 waiter->Wait(); |
| 283 waiter.reset(new FullscreenNotificationObserver()); | 281 waiter.reset(new FullscreenNotificationObserver()); |
| 284 chrome::ToggleFullscreenMode(browser()); | 282 chrome::ToggleFullscreenMode(browser()); |
| 285 waiter->Wait(); | 283 waiter->Wait(); |
| 286 | 284 |
| 287 ASSERT_FALSE(controller()->IsEnabled()); | 285 ASSERT_FALSE(controller()->IsEnabled()); |
| 288 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 286 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); |
| 289 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); | 287 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
| 290 } | 288 } |
| 291 | 289 |
| 292 // Validate top container touch insets are being updated at the correct time in | |
| 293 // immersive mode. | |
| 294 IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshTest, | |
| 295 ImmersiveTopContainerInsets) { | |
| 296 content::WebContents* contents = browser_view()->GetActiveWebContents(); | |
| 297 aura::Window* window = contents->GetView()->GetContentNativeView(); | |
| 298 | |
| 299 // Turning immersive mode on sets positive top touch insets on the render view | |
| 300 // window. | |
| 301 chrome::ToggleFullscreenMode(browser()); | |
| 302 ASSERT_TRUE(browser_view()->IsFullscreen()); | |
| 303 ASSERT_TRUE(controller()->IsEnabled()); | |
| 304 EXPECT_TRUE(window->hit_test_bounds_override_outer_touch().top() > 0); | |
| 305 | |
| 306 // Trigger a reveal resets insets as now the touch target for the top | |
| 307 // container is large enough. | |
| 308 controller()->StartRevealForTest(true); | |
| 309 EXPECT_TRUE(window->hit_test_bounds_override_outer_touch().top() == 0); | |
| 310 | |
| 311 // End reveal by moving the mouse off the top-of-window views. We | |
| 312 // should see the top insets being positive again to allow a bigger touch | |
| 313 // target. | |
| 314 controller()->SetMouseHoveredForTest(false); | |
| 315 EXPECT_TRUE(window->hit_test_bounds_override_outer_touch().top() > 0); | |
| 316 | |
| 317 // Disabling immersive mode resets the top touch insets to 0. | |
| 318 chrome::ToggleFullscreenMode(browser()); | |
| 319 ASSERT_FALSE(browser_view()->IsFullscreen()); | |
| 320 ASSERT_FALSE(controller()->IsEnabled()); | |
| 321 EXPECT_TRUE(window->hit_test_bounds_override_outer_touch().top() == 0); | |
| 322 } | |
| 323 | |
| 324 #endif // defined(OS_CHROMEOS) | 290 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |