OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/ash_switches.h" | 7 #include "ash/common/ash_switches.h" |
8 #include "ash/common/material_design/material_design_controller.h" | 8 #include "ash/common/material_design/material_design_controller.h" |
9 #include "ash/common/shelf/shelf_layout_manager.h" | 9 #include "ash/common/shelf/shelf_layout_manager.h" |
10 #include "ash/common/shelf/shelf_types.h" | 10 #include "ash/common/shelf/shelf_types.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 ash::Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | 255 ash::Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); |
256 ASSERT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 256 ASSERT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); |
257 | 257 |
258 // 1) Test that entering tab fullscreen from immersive fullscreen hides the | 258 // 1) Test that entering tab fullscreen from immersive fullscreen hides the |
259 // tab indicators and the shelf. | 259 // tab indicators and the shelf. |
260 // Note that tab indicators are removed from MD, so ShouldHideTabIndicators() | 260 // Note that tab indicators are removed from MD, so ShouldHideTabIndicators() |
261 // always returns true. | 261 // always returns true. |
262 ToggleFullscreen(); | 262 ToggleFullscreen(); |
263 ASSERT_TRUE(controller()->IsEnabled()); | 263 ASSERT_TRUE(controller()->IsEnabled()); |
264 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 264 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
265 if (!ash::MaterialDesignController::IsShelfMaterial()) | 265 if (!ash::MaterialDesignController::IsImmersiveModeEnabled()) |
266 EXPECT_FALSE(controller()->ShouldHideTabIndicators()); | 266 EXPECT_FALSE(controller()->ShouldHideTabIndicators()); |
267 | 267 |
268 SetTabFullscreen(true); | 268 SetTabFullscreen(true); |
269 ASSERT_TRUE(controller()->IsEnabled()); | 269 ASSERT_TRUE(controller()->IsEnabled()); |
270 EXPECT_EQ(ash::SHELF_HIDDEN, shelf->visibility_state()); | 270 EXPECT_EQ(ash::SHELF_HIDDEN, shelf->visibility_state()); |
271 if (!ash::MaterialDesignController::IsShelfMaterial()) | 271 if (!ash::MaterialDesignController::IsImmersiveModeEnabled()) |
272 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); | 272 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
273 | 273 |
274 // 2) Test that exiting tab fullscreen shows the tab indicators and autohides | 274 // 2) Test that exiting tab fullscreen shows the tab indicators and autohides |
275 // the shelf. | 275 // the shelf. |
276 SetTabFullscreen(false); | 276 SetTabFullscreen(false); |
277 ASSERT_TRUE(controller()->IsEnabled()); | 277 ASSERT_TRUE(controller()->IsEnabled()); |
278 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); | 278 EXPECT_EQ(ash::SHELF_AUTO_HIDE, shelf->visibility_state()); |
279 if (!ash::MaterialDesignController::IsShelfMaterial()) | 279 if (!ash::MaterialDesignController::IsImmersiveModeEnabled()) |
280 EXPECT_FALSE(controller()->ShouldHideTabIndicators()); | 280 EXPECT_FALSE(controller()->ShouldHideTabIndicators()); |
281 | 281 |
282 // 3) Test that exiting tab fullscreen and immersive fullscreen | 282 // 3) Test that exiting tab fullscreen and immersive fullscreen |
283 // simultaneously correctly updates the shelf visibility and whether the tab | 283 // simultaneously correctly updates the shelf visibility and whether the tab |
284 // indicators should be hidden. | 284 // indicators should be hidden. |
285 SetTabFullscreen(true); | 285 SetTabFullscreen(true); |
286 ToggleFullscreen(); | 286 ToggleFullscreen(); |
287 ASSERT_FALSE(controller()->IsEnabled()); | 287 ASSERT_FALSE(controller()->IsEnabled()); |
288 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); | 288 EXPECT_EQ(ash::SHELF_VISIBLE, shelf->visibility_state()); |
289 if (!ash::MaterialDesignController::IsShelfMaterial()) | 289 if (!ash::MaterialDesignController::IsImmersiveModeEnabled()) |
290 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); | 290 EXPECT_TRUE(controller()->ShouldHideTabIndicators()); |
291 } | 291 } |
292 | 292 |
293 // Ensure the circular tab-loading throbbers are not painted as layers in | 293 // Ensure the circular tab-loading throbbers are not painted as layers in |
294 // immersive fullscreen, since the tab strip may animate in or out without | 294 // immersive fullscreen, since the tab strip may animate in or out without |
295 // moving the layers. | 295 // moving the layers. |
296 TEST_F(ImmersiveModeControllerAshTest, LayeredSpinners) { | 296 TEST_F(ImmersiveModeControllerAshTest, LayeredSpinners) { |
297 AddTab(browser(), GURL("about:blank")); | 297 AddTab(browser(), GURL("about:blank")); |
298 | 298 |
299 TabStrip* tabstrip = browser_view()->tabstrip(); | 299 TabStrip* tabstrip = browser_view()->tabstrip(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 // Exit immersive fullscreen. The web contents should be back below the window | 377 // Exit immersive fullscreen. The web contents should be back below the window |
378 // header. | 378 // header. |
379 ToggleFullscreen(); | 379 ToggleFullscreen(); |
380 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); | 380 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); |
381 EXPECT_FALSE(controller()->IsEnabled()); | 381 EXPECT_FALSE(controller()->IsEnabled()); |
382 EXPECT_FALSE(tabstrip->visible()); | 382 EXPECT_FALSE(tabstrip->visible()); |
383 EXPECT_FALSE(toolbar->visible()); | 383 EXPECT_FALSE(toolbar->visible()); |
384 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); | 384 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); |
385 } | 385 } |
OLD | NEW |