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

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

Issue 2339663002: [Mac] Fullscreen Toolbar Bar Visibility Edge Cases (Closed)
Patch Set: 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #import "base/mac/mac_util.h" 8 #import "base/mac/mac_util.h"
9 9
10 #include "base/mac/sdk_forward_declarations.h" 10 #include "base/mac/sdk_forward_declarations.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // BWC exits fullscreen. 205 // BWC exits fullscreen.
206 - (void)exitFullscreenMode; 206 - (void)exitFullscreenMode;
207 207
208 @end 208 @end
209 209
210 @implementation MockFullscreenToolbarController 210 @implementation MockFullscreenToolbarController
211 211
212 @synthesize isRevealingToolbarForTabstrip = isRevealingToolbarForTabstrip_; 212 @synthesize isRevealingToolbarForTabstrip = isRevealingToolbarForTabstrip_;
213 213
214 - (id)initWithBrowserController:(BrowserWindowController*)controller { 214 - (id)initWithBrowserController:(BrowserWindowController*)controller {
215 if ((self = [super 215 if ((self = [super initWithBrowserController:controller
216 initWithBrowserController:controller 216 style:FullscreenSlidingStyle::
217 style:fullscreen_mac::OMNIBOX_TABS_HIDDEN])) { 217 OMNIBOX_TABS_HIDDEN])) {
218 } 218 }
219 219
220 return self; 220 return self;
221 } 221 }
222 222
223 - (void)resetToolbarFlag { 223 - (void)resetToolbarFlag {
224 isRevealingToolbarForTabstrip_ = NO; 224 isRevealingToolbarForTabstrip_ = NO;
225 } 225 }
226 226
227 - (void)revealToolbarForTabStripChanges { 227 - (void)revealToolbarForTabStripChanges {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 base::Timer timer(false, true); 364 base::Timer timer(false, true);
365 timer.Start( 365 timer.Start(
366 FROM_HERE, 366 FROM_HERE,
367 base::TimeDelta::FromMilliseconds(15), 367 base::TimeDelta::FromMilliseconds(15),
368 base::Bind(&CheckBookmarkBarAnimation, 368 base::Bind(&CheckBookmarkBarAnimation,
369 [controller() bookmarkBarController], 369 [controller() bookmarkBarController],
370 runner->QuitClosure())); 370 runner->QuitClosure()));
371 runner->Run(); 371 runner->Run();
372 } 372 }
373 373
374 void VerifyFullscreenToolbarVisibility(fullscreen_mac::SlidingStyle style) { 374 void VerifyFullscreenToolbarVisibility(FullscreenSlidingStyle style) {
375 EXPECT_EQ([[controller() fullscreenToolbarController] slidingStyle], style); 375 EXPECT_EQ([[controller() fullscreenToolbarController] slidingStyle], style);
376 376
377 NSRect toolbarFrame = [[[controller() toolbarController] view] frame]; 377 NSRect toolbarFrame = [[[controller() toolbarController] view] frame];
378 NSRect screenFrame = [[[controller() window] screen] frame]; 378 NSRect screenFrame = [[[controller() window] screen] frame];
379 if (style == fullscreen_mac::OMNIBOX_TABS_PRESENT) 379 if (style == FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT)
380 EXPECT_LE(NSMaxY(toolbarFrame), NSMaxY(screenFrame)); 380 EXPECT_LE(NSMaxY(toolbarFrame), NSMaxY(screenFrame));
381 else 381 else
382 EXPECT_GE(NSMinY(toolbarFrame), NSMaxY(screenFrame)); 382 EXPECT_GE(NSMinY(toolbarFrame), NSMaxY(screenFrame));
383 } 383 }
384 384
385 NSInteger GetExpectedTopInfoBarTipHeight() { 385 NSInteger GetExpectedTopInfoBarTipHeight() {
386 InfoBarContainerController* info_bar_container_controller = 386 InfoBarContainerController* info_bar_container_controller =
387 [controller() infoBarContainerController]; 387 [controller() infoBarContainerController];
388 CGFloat overlapping_tip_height = 388 CGFloat overlapping_tip_height =
389 [info_bar_container_controller overlappingTipHeight]; 389 [info_bar_container_controller overlappingTipHeight];
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 // preferences are updated correctly. 750 // preferences are updated correctly.
751 // Flakily times out. http://crbug.com/599119 751 // Flakily times out. http://crbug.com/599119
752 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, 752 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest,
753 DISABLED_FullscreenToolbarIsVisibleAccordingToPrefs) { 753 DISABLED_FullscreenToolbarIsVisibleAccordingToPrefs) {
754 // Tests that the preference is set to true by default. 754 // Tests that the preference is set to true by default.
755 PrefService* prefs = browser()->profile()->GetPrefs(); 755 PrefService* prefs = browser()->profile()->GetPrefs();
756 EXPECT_TRUE(prefs->GetBoolean(prefs::kShowFullscreenToolbar)); 756 EXPECT_TRUE(prefs->GetBoolean(prefs::kShowFullscreenToolbar));
757 757
758 // Toggle fullscreen and check if the toolbar is shown. 758 // Toggle fullscreen and check if the toolbar is shown.
759 ToggleFullscreenAndWaitForNotification(); 759 ToggleFullscreenAndWaitForNotification();
760 VerifyFullscreenToolbarVisibility(fullscreen_mac::OMNIBOX_TABS_PRESENT); 760 VerifyFullscreenToolbarVisibility(
761 FullscreenSlidingStyle::OMNIBOX_TABS_PRESENT);
761 762
762 // Toggle the visibility of the fullscreen toolbar. Verify that the toolbar 763 // Toggle the visibility of the fullscreen toolbar. Verify that the toolbar
763 // is hidden and the preference is correctly updated. 764 // is hidden and the preference is correctly updated.
764 [[controller() fullscreenToolbarController] setMenuBarRevealProgress:0.0]; 765 [[controller() fullscreenToolbarController] setMenuBarRevealProgress:0.0];
765 chrome::ExecuteCommand(browser(), IDC_TOGGLE_FULLSCREEN_TOOLBAR); 766 chrome::ExecuteCommand(browser(), IDC_TOGGLE_FULLSCREEN_TOOLBAR);
766 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowFullscreenToolbar)); 767 EXPECT_FALSE(prefs->GetBoolean(prefs::kShowFullscreenToolbar));
767 VerifyFullscreenToolbarVisibility(fullscreen_mac::OMNIBOX_TABS_HIDDEN); 768 VerifyFullscreenToolbarVisibility(
769 FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN);
768 770
769 // Toggle out and back into fullscreen and verify that the toolbar is still 771 // Toggle out and back into fullscreen and verify that the toolbar is still
770 // hidden. 772 // hidden.
771 ToggleFullscreenAndWaitForNotification(); 773 ToggleFullscreenAndWaitForNotification();
772 ToggleFullscreenAndWaitForNotification(); 774 ToggleFullscreenAndWaitForNotification();
773 [[controller() fullscreenToolbarController] setMenuBarRevealProgress:0.0]; 775 [[controller() fullscreenToolbarController] setMenuBarRevealProgress:0.0];
774 VerifyFullscreenToolbarVisibility(fullscreen_mac::OMNIBOX_TABS_HIDDEN); 776 VerifyFullscreenToolbarVisibility(
777 FullscreenSlidingStyle::OMNIBOX_TABS_HIDDEN);
775 778
776 chrome::ExecuteCommand(browser(), IDC_TOGGLE_FULLSCREEN_TOOLBAR); 779 chrome::ExecuteCommand(browser(), IDC_TOGGLE_FULLSCREEN_TOOLBAR);
777 EXPECT_TRUE(prefs->GetBoolean(prefs::kShowFullscreenToolbar)); 780 EXPECT_TRUE(prefs->GetBoolean(prefs::kShowFullscreenToolbar));
778 } 781 }
779 782
780 // Tests that the toolbar (tabstrip and omnibox) reveal animation is correctly 783 // Tests that the toolbar (tabstrip and omnibox) reveal animation is correctly
781 // triggered by the changes in the tabstrip. The animation should not trigger 784 // triggered by the changes in the tabstrip. The animation should not trigger
782 // if the current tab is a NTP, since the location bar would be focused. 785 // if the current tab is a NTP, since the location bar would be focused.
783 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, 786 IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest,
784 FullscreenToolbarExposedForTabstripChanges) { 787 FullscreenToolbarExposedForTabstripChanges) {
(...skipping 29 matching lines...) Expand all
814 EXPECT_FALSE([fullscreenToolbarController isRevealingToolbarForTabstrip]); 817 EXPECT_FALSE([fullscreenToolbarController isRevealingToolbarForTabstrip]);
815 [fullscreenToolbarController resetToolbarFlag]; 818 [fullscreenToolbarController resetToolbarFlag];
816 819
817 // Switch to a non-NTP tab. 820 // Switch to a non-NTP tab.
818 TabStripModel* model = browser()->tab_strip_model(); 821 TabStripModel* model = browser()->tab_strip_model();
819 model->ActivateTabAt(1, true); 822 model->ActivateTabAt(1, true);
820 ASSERT_FALSE([[controller() toolbarController] isLocationBarFocused]); 823 ASSERT_FALSE([[controller() toolbarController] isLocationBarFocused]);
821 EXPECT_TRUE([fullscreenToolbarController isRevealingToolbarForTabstrip]); 824 EXPECT_TRUE([fullscreenToolbarController isRevealingToolbarForTabstrip]);
822 [fullscreenToolbarController resetToolbarFlag]; 825 [fullscreenToolbarController resetToolbarFlag];
823 } 826 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/browser_window_controller_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698