| 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/shelf/shelf_layout_manager.h" | 7 #include "ash/common/shelf/shelf_layout_manager.h" |
| 8 #include "ash/public/cpp/shelf_types.h" | 8 #include "ash/public/cpp/shelf_types.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 EXPECT_TRUE(tabstrip->visible()); | 125 EXPECT_TRUE(tabstrip->visible()); |
| 126 EXPECT_TRUE(toolbar->visible()); | 126 EXPECT_TRUE(toolbar->visible()); |
| 127 | 127 |
| 128 ToggleFullscreen(); | 128 ToggleFullscreen(); |
| 129 EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); | 129 EXPECT_TRUE(browser_view()->GetWidget()->IsFullscreen()); |
| 130 EXPECT_TRUE(controller()->IsEnabled()); | 130 EXPECT_TRUE(controller()->IsEnabled()); |
| 131 EXPECT_FALSE(controller()->IsRevealed()); | 131 EXPECT_FALSE(controller()->IsRevealed()); |
| 132 EXPECT_FALSE(toolbar->visible()); | 132 EXPECT_FALSE(toolbar->visible()); |
| 133 // The browser's top chrome is completely offscreen with tapstrip visible. | 133 // The browser's top chrome is completely offscreen with tapstrip visible. |
| 134 EXPECT_TRUE(tabstrip->visible()); | 134 EXPECT_TRUE(tabstrip->visible()); |
| 135 // Top container view should be completely offscreen. |
| 136 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).bottom()); |
| 135 | 137 |
| 136 // The tab indicators should be flush with the top of the widget. | 138 // The tab indicators should be flush with the top of the widget. |
| 137 EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y()); | 139 EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y()); |
| 138 | 140 |
| 139 // Since the tab strip and tool bar are both hidden in immersive fullscreen | 141 // Since the tab strip and tool bar are both hidden in immersive fullscreen |
| 140 // mode, the web contents should extend to the edge of screen. | 142 // mode, the web contents should extend to the edge of screen. |
| 141 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); | 143 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| 142 | 144 |
| 143 // Revealing the top-of-window views should set the tab strip back to the | 145 // Revealing the top-of-window views should set the tab strip back to the |
| 144 // normal style and show the toolbar. | 146 // normal style and show the toolbar. |
| 145 AttemptReveal(); | 147 AttemptReveal(); |
| 146 EXPECT_TRUE(controller()->IsRevealed()); | 148 EXPECT_TRUE(controller()->IsRevealed()); |
| 147 EXPECT_TRUE(tabstrip->visible()); | 149 EXPECT_TRUE(tabstrip->visible()); |
| 148 EXPECT_FALSE(tabstrip->IsImmersiveStyle()); | |
| 149 EXPECT_TRUE(toolbar->visible()); | 150 EXPECT_TRUE(toolbar->visible()); |
| 150 | 151 |
| 151 // The TopContainerView should be flush with the top edge of the widget. If | 152 // The TopContainerView should be flush with the top edge of the widget. If |
| 152 // it is not flush with the top edge the immersive reveal animation looks | 153 // it is not flush with the top edge the immersive reveal animation looks |
| 153 // wonky. | 154 // wonky. |
| 154 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y()); | 155 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y()); |
| 155 | 156 |
| 156 // The web contents should be at the same y position as they were when the | 157 // The web contents should be at the same y position as they were when the |
| 157 // top-of-window views were hidden. | 158 // top-of-window views were hidden. |
| 158 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); | 159 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| 159 | 160 |
| 160 // Repeat the test for when in both immersive fullscreen and tab fullscreen. | 161 // Repeat the test for when in both immersive fullscreen and tab fullscreen. |
| 161 SetTabFullscreen(true); | 162 SetTabFullscreen(true); |
| 162 // Hide and reveal the top-of-window views so that they get relain out. | 163 // Hide and reveal the top-of-window views so that they get relain out. |
| 163 AttemptUnreveal(); | 164 AttemptUnreveal(); |
| 164 AttemptReveal(); | 165 AttemptReveal(); |
| 165 | 166 |
| 166 // The tab strip and toolbar should still be visible and the TopContainerView | 167 // The tab strip and toolbar should still be visible and the TopContainerView |
| 167 // should still be flush with the top edge of the widget. | 168 // should still be flush with the top edge of the widget. |
| 168 EXPECT_TRUE(controller()->IsRevealed()); | 169 EXPECT_TRUE(controller()->IsRevealed()); |
| 169 EXPECT_TRUE(tabstrip->visible()); | 170 EXPECT_TRUE(tabstrip->visible()); |
| 170 EXPECT_FALSE(tabstrip->IsImmersiveStyle()); | |
| 171 EXPECT_TRUE(toolbar->visible()); | 171 EXPECT_TRUE(toolbar->visible()); |
| 172 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y()); | 172 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y()); |
| 173 | 173 |
| 174 // The web contents should be flush with the top edge of the widget when in | 174 // The web contents should be flush with the top edge of the widget when in |
| 175 // both immersive and tab fullscreen. | 175 // both immersive and tab fullscreen. |
| 176 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); | 176 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| 177 | 177 |
| 178 // Hide the top-of-window views. Tabstrip is still considered as visible. | 178 // Hide the top-of-window views. Tabstrip is still considered as visible. |
| 179 AttemptUnreveal(); | 179 AttemptUnreveal(); |
| 180 EXPECT_FALSE(controller()->IsRevealed()); | 180 EXPECT_FALSE(controller()->IsRevealed()); |
| 181 EXPECT_FALSE(toolbar->visible()); | 181 EXPECT_FALSE(toolbar->visible()); |
| 182 EXPECT_TRUE(tabstrip->visible()); | 182 EXPECT_TRUE(tabstrip->visible()); |
| 183 | 183 |
| 184 // The web contents should still be flush with the edge of the widget. | 184 // The web contents should still be flush with the edge of the widget. |
| 185 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); | 185 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); |
| 186 | 186 |
| 187 // Exiting both immersive and tab fullscreen should show the tab strip and | 187 // Exiting both immersive and tab fullscreen should show the tab strip and |
| 188 // toolbar. | 188 // toolbar. |
| 189 ToggleFullscreen(); | 189 ToggleFullscreen(); |
| 190 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); | 190 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); |
| 191 EXPECT_FALSE(controller()->IsEnabled()); | 191 EXPECT_FALSE(controller()->IsEnabled()); |
| 192 EXPECT_FALSE(controller()->IsRevealed()); | 192 EXPECT_FALSE(controller()->IsRevealed()); |
| 193 EXPECT_TRUE(tabstrip->visible()); | 193 EXPECT_TRUE(tabstrip->visible()); |
| 194 EXPECT_FALSE(tabstrip->IsImmersiveStyle()); | |
| 195 EXPECT_TRUE(toolbar->visible()); | 194 EXPECT_TRUE(toolbar->visible()); |
| 196 } | 195 } |
| 197 | 196 |
| 198 // Test that the browser commands which are usually disabled in fullscreen are | 197 // Test that the browser commands which are usually disabled in fullscreen are |
| 199 // are enabled in immersive fullscreen. | 198 // are enabled in immersive fullscreen. |
| 200 TEST_F(ImmersiveModeControllerAshTest, EnabledCommands) { | 199 TEST_F(ImmersiveModeControllerAshTest, EnabledCommands) { |
| 201 ASSERT_FALSE(controller()->IsEnabled()); | 200 ASSERT_FALSE(controller()->IsEnabled()); |
| 202 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL)); | 201 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL)); |
| 203 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT)); | 202 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT)); |
| 204 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION)); | 203 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION)); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 346 |
| 348 // Exit immersive fullscreen. The web contents should be back below the window | 347 // Exit immersive fullscreen. The web contents should be back below the window |
| 349 // header. | 348 // header. |
| 350 ToggleFullscreen(); | 349 ToggleFullscreen(); |
| 351 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); | 350 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); |
| 352 EXPECT_FALSE(controller()->IsEnabled()); | 351 EXPECT_FALSE(controller()->IsEnabled()); |
| 353 EXPECT_FALSE(tabstrip->visible()); | 352 EXPECT_FALSE(tabstrip->visible()); |
| 354 EXPECT_FALSE(toolbar->visible()); | 353 EXPECT_FALSE(toolbar->visible()); |
| 355 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); | 354 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); |
| 356 } | 355 } |
| OLD | NEW |