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

Side by Side Diff: chrome/browser/ui/cocoa/presentation_mode_controller_unittest.mm

Issue 607603003: Mac: Minor fullscreen adjustments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix presentation mode unit test. Created 6 years, 2 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
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_layout_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
6 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" 6 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
7 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 7 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
8 #import "chrome/browser/ui/cocoa/fast_resize_view.h" 8 #import "chrome/browser/ui/cocoa/fast_resize_view.h"
9 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" 9 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
10 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 10 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 CheckLayoutNoOverlap(controller_); 145 CheckLayoutNoOverlap(controller_);
146 146
147 // No change after adjusting UI for Canonical Fullscreen. 147 // No change after adjusting UI for Canonical Fullscreen.
148 controller_->isInAppKitFullscreen_ = YES; 148 controller_->isInAppKitFullscreen_ = YES;
149 [controller_ 149 [controller_
150 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_PRESENT]; 150 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_PRESENT];
151 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabStripView])); 151 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabStripView]));
152 CheckLayoutNoOverlap(controller_); 152 CheckLayoutNoOverlap(controller_);
153 153
154 // The menu bar is starting to animate in. All views should slide down by a 154 // The menu bar is starting to animate in. All views should slide down by a
155 // small amount. 155 // small amount. The content area doesn't change size.
156 [controller_->presentationController_ setMenuBarRevealProgress:0.3]; 156 [controller_->presentationController_ setMenuBarRevealProgress:0.3];
157 EXPECT_LT(MaxYInWindow([controller_ tabStripView]), windowHeight - 1); 157 EXPECT_LT(MaxYInWindow([controller_ tabStripView]), windowHeight - 1);
158 EXPECT_GT(MaxYInWindow([controller_ tabStripView]), 158 EXPECT_GT(MaxYInWindow([controller_ tabStripView]),
159 windowHeight - kMenuBarHeight + 1); 159 windowHeight - kMenuBarHeight + 1);
160 CheckLayoutNoOverlap(controller_); 160 CheckToolbarLayoutNoOverlap(controller_);
161 EXPECT_EQ(MinYInWindow([[controller_ bookmarkBarController] view]),
162 MaxYInWindow([[controller_ infoBarContainerController] view]));
163 EXPECT_LT(MinYInWindow([[controller_ infoBarContainerController] view]),
164 MaxYInWindow([controller_ tabContentArea]));
161 165
162 // The menu bar is fully visible. All views should slide down by the size of 166 // The menu bar is fully visible. All views should slide down by the size of
163 // the menu bar. 167 // the menu bar. The content area doesn't change size.
164 [controller_->presentationController_ setMenuBarRevealProgress:1]; 168 [controller_->presentationController_ setMenuBarRevealProgress:1];
165 EXPECT_FLOAT_EQ(windowHeight - kMenuBarHeight, 169 EXPECT_FLOAT_EQ(windowHeight - kMenuBarHeight,
166 MaxYInWindow([controller_ tabStripView])); 170 MaxYInWindow([controller_ tabStripView]));
167 CheckLayoutNoOverlap(controller_); 171 CheckToolbarLayoutNoOverlap(controller_);
172 EXPECT_EQ(MinYInWindow([[controller_ bookmarkBarController] view]),
173 MaxYInWindow([[controller_ infoBarContainerController] view]));
174 EXPECT_LT(MinYInWindow([[controller_ infoBarContainerController] view]),
175 MaxYInWindow([controller_ tabContentArea]));
168 176
169 // The menu bar has disappeared. All views should return to normal. 177 // The menu bar has disappeared. All views should return to normal.
170 [controller_->presentationController_ setMenuBarRevealProgress:0]; 178 [controller_->presentationController_ setMenuBarRevealProgress:0];
171 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabStripView])); 179 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabStripView]));
172 CheckLayoutNoOverlap(controller_); 180 CheckLayoutNoOverlap(controller_);
173 } 181 }
174 182
175 // Tests the layout of views in Presentation Mode (emulating AppKit Fullscreen 183 // Tests the layout of views in Presentation Mode (emulating AppKit Fullscreen
176 // API). 184 // API).
177 TEST_F(PresentationModeControllerTest, PresentationModeAppKitLayout) { 185 TEST_F(PresentationModeControllerTest, PresentationModeAppKitLayout) {
178 // Check initial layout. 186 // Check initial layout.
179 CGFloat windowHeight = NSHeight([[controller_ window] frame]); 187 CGFloat windowHeight = NSHeight([[controller_ window] frame]);
180 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabStripView])); 188 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabStripView]));
181 CheckLayoutNoOverlap(controller_); 189 CheckLayoutNoOverlap(controller_);
182 190
183 // Adjust UI for Presentation Mode. 191 // Adjust UI for Presentation Mode.
184 controller_->isInAppKitFullscreen_ = YES; 192 controller_->isInAppKitFullscreen_ = YES;
185 [controller_ 193 [controller_
186 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_HIDDEN]; 194 adjustUIForSlidingFullscreenStyle:fullscreen_mac::OMNIBOX_TABS_HIDDEN];
187 195
188 // In AppKit Fullscreen, the titlebar disappears. This test can't remove the 196 // In AppKit Fullscreen, the titlebar disappears. This test can't remove the
189 // titlebar without non-trivially changing the view hierarchy. Instead, it 197 // titlebar without non-trivially changing the view hierarchy. Instead, it
190 // adjusts the expectations to sometimes use contentHeight instead of 198 // adjusts the expectations to sometimes use contentHeight instead of
191 // windowHeight (the two should be the same in AppKit Fullscreen). 199 // windowHeight (the two should be the same in AppKit Fullscreen).
192 CGFloat contentHeight = NSHeight([[[controller_ window] contentView] bounds]); 200 CGFloat contentHeight = NSHeight([[[controller_ window] contentView] bounds]);
193 CheckToolbarLayoutNoOverlap(controller_); 201 CheckToolbarLayoutNoOverlap(controller_);
194 EXPECT_EQ(windowHeight, MinYInWindow(LowestViewInToolbarArea(controller_))); 202 EXPECT_EQ(windowHeight, MinYInWindow(LowestViewInToolbarArea(controller_)));
195 EXPECT_EQ(contentHeight, MaxYInWindow([controller_ tabContentArea])); 203 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabContentArea]));
196 204
197 // The menu bar is starting to animate in. All views except the content view 205 // The menu bar is starting to animate in. All views except the content view
198 // should slide down by a small amount. 206 // should slide down by a small amount.
199 [controller_->presentationController_ setMenuBarRevealProgress:0.3]; 207 [controller_->presentationController_ setMenuBarRevealProgress:0.3];
200 [controller_->presentationController_ changeToolbarFraction:0.3]; 208 [controller_->presentationController_ changeToolbarFraction:0.3];
201 CheckToolbarLayoutNoOverlap(controller_); 209 CheckToolbarLayoutNoOverlap(controller_);
202 EXPECT_LT(MinYInWindow(LowestViewInToolbarArea(controller_)), contentHeight); 210 EXPECT_LT(MinYInWindow(LowestViewInToolbarArea(controller_)), contentHeight);
203 EXPECT_GT(MaxYInWindow(HighestViewInToolbarArea(controller_)), contentHeight); 211 EXPECT_GT(MaxYInWindow(HighestViewInToolbarArea(controller_)), contentHeight);
204 EXPECT_EQ(contentHeight, MaxYInWindow([controller_ tabContentArea])); 212 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabContentArea]));
205 213
206 // The menu bar is fully visible. All views should slide down by the size of 214 // The menu bar is fully visible. All views should slide down by the size of
207 // the menu bar. 215 // the menu bar.
208 [controller_->presentationController_ setMenuBarRevealProgress:1]; 216 [controller_->presentationController_ setMenuBarRevealProgress:1];
209 [controller_->presentationController_ changeToolbarFraction:1]; 217 [controller_->presentationController_ changeToolbarFraction:1];
210 CheckToolbarLayoutNoOverlap(controller_); 218 CheckToolbarLayoutNoOverlap(controller_);
211 EXPECT_EQ(contentHeight, MaxYInWindow(HighestViewInToolbarArea(controller_))); 219 EXPECT_EQ(contentHeight, MaxYInWindow(HighestViewInToolbarArea(controller_)));
212 EXPECT_EQ(contentHeight, MaxYInWindow([controller_ tabContentArea])); 220 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabContentArea]));
213 221
214 // The menu bar has disappeared. All views should return to normal. 222 // The menu bar has disappeared. All views should return to normal.
215 [controller_->presentationController_ setMenuBarRevealProgress:0]; 223 [controller_->presentationController_ setMenuBarRevealProgress:0];
216 [controller_->presentationController_ changeToolbarFraction:0]; 224 [controller_->presentationController_ changeToolbarFraction:0];
217 CheckToolbarLayoutNoOverlap(controller_); 225 CheckToolbarLayoutNoOverlap(controller_);
218 EXPECT_EQ(windowHeight, MinYInWindow(LowestViewInToolbarArea(controller_))); 226 EXPECT_EQ(windowHeight, MinYInWindow(LowestViewInToolbarArea(controller_)));
219 EXPECT_EQ(contentHeight, MaxYInWindow([controller_ tabContentArea])); 227 EXPECT_EQ(windowHeight, MaxYInWindow([controller_ tabContentArea]));
220 } 228 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_layout_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698