Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc

Issue 2368653002: Remove pre-MD code from browser/ui/views/tabs/tab.cc (Closed)
Patch Set: fix compile Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/shelf/shelf_types.h" 9 #include "ash/common/shelf/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
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 EXPECT_FALSE(tabstrip->visible());
135 // fullscreen mode.
136 bool is_using_material_design =
137 ash::MaterialDesignController::IsImmersiveModeMaterial();
138 if (is_using_material_design) {
139 EXPECT_FALSE(tabstrip->visible());
140 } else {
141 EXPECT_TRUE(tabstrip->visible());
142 EXPECT_TRUE(tabstrip->IsImmersiveStyle());
143 }
144 135
145 // The tab indicators should be flush with the top of the widget. 136 // The tab indicators should be flush with the top of the widget.
146 EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y()); 137 EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y());
147 138
148 // In MD, since the tab strip and tool bar are both hidden in immersive 139 // The web contents should extend to the edge of screen.
149 // fullscreen mode, the web contents should extend to the edge of screen. In 140 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y());
150 // non-MD, the web contents should be immediately below the tab indicators.
151 if (is_using_material_design) {
152 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y());
153 } else {
154 EXPECT_EQ(Tab::GetImmersiveHeight(),
155 GetBoundsInWidget(contents_web_view).y());
156 }
157 141
158 // Revealing the top-of-window views should set the tab strip back to the 142 // Revealing the top-of-window views should set the tab strip back to the
159 // normal style and show the toolbar. 143 // normal style and show the toolbar.
160 AttemptReveal(); 144 AttemptReveal();
161 EXPECT_TRUE(controller()->IsRevealed()); 145 EXPECT_TRUE(controller()->IsRevealed());
162 EXPECT_TRUE(tabstrip->visible()); 146 EXPECT_TRUE(tabstrip->visible());
163 EXPECT_FALSE(tabstrip->IsImmersiveStyle());
164 EXPECT_TRUE(toolbar->visible()); 147 EXPECT_TRUE(toolbar->visible());
165 148
166 // The TopContainerView should be flush with the top edge of the widget. If 149 // The TopContainerView should be flush with the top edge of the widget. If
167 // it is not flush with the top edge the immersive reveal animation looks 150 // it is not flush with the top edge the immersive reveal animation looks
168 // wonky. 151 // wonky.
169 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y()); 152 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y());
170 153
171 // The web contents should be at the same y position as they were when the 154 // The web contents should be at the same y position as they were when the
172 // top-of-window views were hidden. 155 // top-of-window views were hidden.
173 if (is_using_material_design) { 156 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y());
174 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y());
175 } else {
176 EXPECT_EQ(Tab::GetImmersiveHeight(),
177 GetBoundsInWidget(contents_web_view).y());
178 }
179 157
180 // Repeat the test for when in both immersive fullscreen and tab fullscreen. 158 // Repeat the test for when in both immersive fullscreen and tab fullscreen.
181 SetTabFullscreen(true); 159 SetTabFullscreen(true);
182 // Hide and reveal the top-of-window views so that they get relain out. 160 // Hide and reveal the top-of-window views so that they get relain out.
183 AttemptUnreveal(); 161 AttemptUnreveal();
184 AttemptReveal(); 162 AttemptReveal();
185 163
186 // The tab strip and toolbar should still be visible and the TopContainerView 164 // The tab strip and toolbar should still be visible and the TopContainerView
187 // should still be flush with the top edge of the widget. 165 // should still be flush with the top edge of the widget.
188 EXPECT_TRUE(controller()->IsRevealed()); 166 EXPECT_TRUE(controller()->IsRevealed());
189 EXPECT_TRUE(tabstrip->visible()); 167 EXPECT_TRUE(tabstrip->visible());
190 EXPECT_FALSE(tabstrip->IsImmersiveStyle());
191 EXPECT_TRUE(toolbar->visible()); 168 EXPECT_TRUE(toolbar->visible());
192 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y()); 169 EXPECT_EQ(0, GetBoundsInWidget(browser_view()->top_container()).y());
193 170
194 // The web contents should be flush with the top edge of the widget when in 171 // The web contents should be flush with the top edge of the widget when in
195 // both immersive and tab fullscreen. 172 // both immersive and tab fullscreen.
196 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); 173 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y());
197 174
198 // Hide the top-of-window views. Both the tab strip and the toolbar should 175 // Hide the top-of-window views. Both the tab strip and the toolbar should
199 // hide when in both immersive and tab fullscreen. 176 // hide when in both immersive and tab fullscreen.
200 AttemptUnreveal(); 177 AttemptUnreveal();
201 EXPECT_FALSE(controller()->IsRevealed()); 178 EXPECT_FALSE(controller()->IsRevealed());
202 EXPECT_FALSE(tabstrip->visible()); 179 EXPECT_FALSE(tabstrip->visible());
203 EXPECT_FALSE(toolbar->visible()); 180 EXPECT_FALSE(toolbar->visible());
204 181
205 // The web contents should still be flush with the edge of the widget. 182 // The web contents should still be flush with the edge of the widget.
206 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y()); 183 EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y());
207 184
208 // Exiting both immersive and tab fullscreen should show the tab strip and 185 // Exiting both immersive and tab fullscreen should show the tab strip and
209 // toolbar. 186 // toolbar.
210 ToggleFullscreen(); 187 ToggleFullscreen();
211 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); 188 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen());
212 EXPECT_FALSE(controller()->IsEnabled()); 189 EXPECT_FALSE(controller()->IsEnabled());
213 EXPECT_FALSE(controller()->IsRevealed()); 190 EXPECT_FALSE(controller()->IsRevealed());
214 EXPECT_TRUE(tabstrip->visible()); 191 EXPECT_TRUE(tabstrip->visible());
215 EXPECT_FALSE(tabstrip->IsImmersiveStyle());
216 EXPECT_TRUE(toolbar->visible()); 192 EXPECT_TRUE(toolbar->visible());
217 } 193 }
218 194
219 // Test that the browser commands which are usually disabled in fullscreen are 195 // Test that the browser commands which are usually disabled in fullscreen are
220 // are enabled in immersive fullscreen. 196 // are enabled in immersive fullscreen.
221 TEST_F(ImmersiveModeControllerAshTest, EnabledCommands) { 197 TEST_F(ImmersiveModeControllerAshTest, EnabledCommands) {
222 ASSERT_FALSE(controller()->IsEnabled()); 198 ASSERT_FALSE(controller()->IsEnabled());
223 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL)); 199 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_OPEN_CURRENT_URL));
224 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT)); 200 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT));
225 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION)); 201 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FOCUS_LOCATION));
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 351
376 // Exit immersive fullscreen. The web contents should be back below the window 352 // Exit immersive fullscreen. The web contents should be back below the window
377 // header. 353 // header.
378 ToggleFullscreen(); 354 ToggleFullscreen();
379 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen()); 355 EXPECT_FALSE(browser_view()->GetWidget()->IsFullscreen());
380 EXPECT_FALSE(controller()->IsEnabled()); 356 EXPECT_FALSE(controller()->IsEnabled());
381 EXPECT_FALSE(tabstrip->visible()); 357 EXPECT_FALSE(tabstrip->visible());
382 EXPECT_FALSE(toolbar->visible()); 358 EXPECT_FALSE(toolbar->visible());
383 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y()); 359 EXPECT_EQ(header_height, GetBoundsInWidget(contents_web_view).y());
384 } 360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698