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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 EXPECT_TRUE(toolbar->visible()); | 128 EXPECT_TRUE(toolbar->visible()); |
129 | 129 |
130 ToggleFullscreen(); | 130 ToggleFullscreen(); |
131 EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); | 131 EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); |
132 EXPECT_TRUE(controller()->IsEnabled()); | 132 EXPECT_TRUE(controller()->IsEnabled()); |
133 EXPECT_FALSE(controller()->IsRevealed()); | 133 EXPECT_FALSE(controller()->IsRevealed()); |
134 EXPECT_FALSE(toolbar->visible()); | 134 EXPECT_FALSE(toolbar->visible()); |
135 // For MD, the browser's top chrome is completely hidden in immersive | 135 // For MD, the browser's top chrome is completely hidden in immersive |
136 // fullscreen mode. | 136 // fullscreen mode. |
137 bool is_using_material_design = | 137 bool is_using_material_design = |
138 ash::MaterialDesignController::IsShelfMaterial(); | 138 ash::MaterialDesignController::IsImmersiveModeMaterial(); |
139 if (is_using_material_design) { | 139 if (is_using_material_design) { |
140 EXPECT_FALSE(tabstrip->visible()); | 140 EXPECT_FALSE(tabstrip->visible()); |
141 } else { | 141 } else { |
142 EXPECT_TRUE(tabstrip->visible()); | 142 EXPECT_TRUE(tabstrip->visible()); |
143 EXPECT_TRUE(tabstrip->IsImmersiveStyle()); | 143 EXPECT_TRUE(tabstrip->IsImmersiveStyle()); |
144 } | 144 } |
145 | 145 |
146 // The tab indicators should be flush with the top of the widget. | 146 // The tab indicators should be flush with the top of the widget. |
147 EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y()); | 147 EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y()); |
148 | 148 |
(...skipping 106 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::IsImmersiveModeMaterial()) |
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::IsImmersiveModeMaterial()) |
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::IsImmersiveModeMaterial()) |
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::IsImmersiveModeMaterial()) |
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 |