| 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/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/shelf/shelf_layout_manager.h" | 8 #include "ash/common/shelf/shelf_layout_manager.h" |
| 9 #include "ash/public/cpp/shelf_types.h" | 9 #include "ash/public/cpp/shelf_types.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 // By default, the tabstrip and toolbar should be visible. | 125 // By default, the tabstrip and toolbar should be visible. |
| 126 EXPECT_TRUE(tabstrip->visible()); | 126 EXPECT_TRUE(tabstrip->visible()); |
| 127 EXPECT_TRUE(toolbar->visible()); | 127 EXPECT_TRUE(toolbar->visible()); |
| 128 | 128 |
| 129 ToggleFullscreen(); | 129 ToggleFullscreen(); |
| 130 EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); | 130 EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); |
| 131 EXPECT_TRUE(controller()->IsEnabled()); | 131 EXPECT_TRUE(controller()->IsEnabled()); |
| 132 EXPECT_FALSE(controller()->IsRevealed()); | 132 EXPECT_FALSE(controller()->IsRevealed()); |
| 133 EXPECT_FALSE(toolbar->visible()); | 133 EXPECT_FALSE(toolbar->visible()); |
| 134 // For MD, the browser's top chrome is completely hidden in immersive | 134 // For MD, the browser's top chrome is completely offscreen with tapstrip |
| 135 // fullscreen mode. | 135 // visible. |
| 136 EXPECT_TRUE(tabstrip->visible()); |
| 136 bool is_using_material_design = | 137 bool is_using_material_design = |
| 137 ash::MaterialDesignController::IsImmersiveModeMaterial(); | 138 ash::MaterialDesignController::IsImmersiveModeMaterial(); |
| 138 if (is_using_material_design) { | 139 if (!is_using_material_design) |
| 139 EXPECT_FALSE(tabstrip->visible()); | |
| 140 } else { | |
| 141 EXPECT_TRUE(tabstrip->visible()); | |
| 142 EXPECT_TRUE(tabstrip->IsImmersiveStyle()); | 140 EXPECT_TRUE(tabstrip->IsImmersiveStyle()); |
| 143 } | |
| 144 | 141 |
| 145 // The tab indicators should be flush with the top of the widget. | 142 // The tab indicators should be flush with the top of the widget. |
| 146 EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y()); | 143 EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y()); |
| 147 | 144 |
| 148 // In MD, since the tab strip and tool bar are both hidden in immersive | 145 // In MD, since the tab strip and tool bar are both hidden in immersive |
| 149 // fullscreen mode, the web contents should extend to the edge of screen. In | 146 // fullscreen mode, the web contents should extend to the edge of screen. In |
| 150 // non-MD, the web contents should be immediately below the tab indicators. | 147 // non-MD, the web contents should be immediately below the tab indicators. |
| 151 if (is_using_material_design) { | 148 if (is_using_material_design) { |
| 152 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); | 149 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| 153 } else { | 150 } else { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 EXPECT_TRUE(controller()->IsRevealed()); | 185 EXPECT_TRUE(controller()->IsRevealed()); |
| 189 EXPECT_TRUE(tabstrip->visible()); | 186 EXPECT_TRUE(tabstrip->visible()); |
| 190 EXPECT_FALSE(tabstrip->IsImmersiveStyle()); | 187 EXPECT_FALSE(tabstrip->IsImmersiveStyle()); |
| 191 EXPECT_TRUE(toolbar->visible()); | 188 EXPECT_TRUE(toolbar->visible()); |
| 192 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y()); | 189 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y()); |
| 193 | 190 |
| 194 // The web contents should be flush with the top edge of the widget when in | 191 // The web contents should be flush with the top edge of the widget when in |
| 195 // both immersive and tab fullscreen. | 192 // both immersive and tab fullscreen. |
| 196 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); | 193 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| 197 | 194 |
| 198 // Hide the top-of-window views. Both the tab strip and the toolbar should | 195 // Hide the top-of-window views. Tabstrip is still considered as visible. |
| 199 // hide when in both immersive and tab fullscreen. | |
| 200 AttemptUnreveal(); | 196 AttemptUnreveal(); |
| 201 EXPECT_FALSE(controller()->IsRevealed()); | 197 EXPECT_FALSE(controller()->IsRevealed()); |
| 202 EXPECT_FALSE(tabstrip->visible()); | |
| 203 EXPECT_FALSE(toolbar->visible()); | 198 EXPECT_FALSE(toolbar->visible()); |
| 199 EXPECT_TRUE(tabstrip->visible()); |
| 204 | 200 |
| 205 // The web contents should still be flush with the edge of the widget. | 201 // The web contents should still be flush with the edge of the widget. |
| 206 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); | 202 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| 207 | 203 |
| 208 // Exiting both immersive and tab fullscreen should show the tab strip and | 204 // Exiting both immersive and tab fullscreen should show the tab strip and |
| 209 // toolbar. | 205 // toolbar. |
| 210 ToggleFullscreen(); | 206 ToggleFullscreen(); |
| 211 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); | 207 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); |
| 212 EXPECT_FALSE(controller()->IsEnabled()); | 208 EXPECT_FALSE(controller()->IsEnabled()); |
| 213 EXPECT_FALSE(controller()->IsRevealed()); | 209 EXPECT_FALSE(controller()->IsRevealed()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 340 |
| 345 // The window header should be above the web contents. | 341 // The window header should be above the web contents. |
| 346 int header_height = GetBoundsInWidget(contents_web_view).y(); | 342 int header_height = GetBoundsInWidget(contents_web_view).y(); |
| 347 | 343 |
| 348 ToggleFullscreen(); | 344 ToggleFullscreen(); |
| 349 EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); | 345 EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); |
| 350 EXPECT_TRUE(controller()->IsEnabled()); | 346 EXPECT_TRUE(controller()->IsEnabled()); |
| 351 EXPECT_FALSE(controller()->IsRevealed()); | 347 EXPECT_FALSE(controller()->IsRevealed()); |
| 352 | 348 |
| 353 // Entering immersive fullscreen should make the web contents flush with the | 349 // Entering immersive fullscreen should make the web contents flush with the |
| 354 // top of the widget. | 350 // top of the widget. The popup browser type doesn't support tabstrip and |
| 351 // toolbar feature, thus invisible. |
| 355 EXPECT_FALSE(tabstrip->visible()); | 352 EXPECT_FALSE(tabstrip->visible()); |
| 356 EXPECT_FALSE(toolbar->visible()); | 353 EXPECT_FALSE(toolbar->visible()); |
| 357 EXPECT_TRUE(top_container->GetVisibleBounds().IsEmpty()); | 354 EXPECT_TRUE(top_container->GetVisibleBounds().IsEmpty()); |
| 358 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); | 355 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| 359 | 356 |
| 360 // Reveal the window header. | 357 // Reveal the window header. |
| 361 AttemptReveal(); | 358 AttemptReveal(); |
| 362 | 359 |
| 363 // The tabstrip and toolbar should still be hidden and the web contents should | 360 // The tabstrip and toolbar should still be hidden and the web contents should |
| 364 // still be flush with the top of the screen. | 361 // still be flush with the top of the screen. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 375 | 372 |
| 376 // Exit immersive fullscreen. The web contents should be back below the window | 373 // Exit immersive fullscreen. The web contents should be back below the window |
| 377 // header. | 374 // header. |
| 378 ToggleFullscreen(); | 375 ToggleFullscreen(); |
| 379 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); | 376 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); |
| 380 EXPECT_FALSE(controller()->IsEnabled()); | 377 EXPECT_FALSE(controller()->IsEnabled()); |
| 381 EXPECT_FALSE(tabstrip->visible()); | 378 EXPECT_FALSE(tabstrip->visible()); |
| 382 EXPECT_FALSE(toolbar->visible()); | 379 EXPECT_FALSE(toolbar->visible()); |
| 383 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); | 380 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); |
| 384 } | 381 } |
| OLD | NEW |