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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm

Issue 1650713003: Preference for Presentation Mode/Fullscreen Toolbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
index df6e2cd169ea0eee9c19f4bfa732e2259979dd6d..7865cef9cd1e971c704729430ac4dea0c073d46f 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
@@ -14,6 +14,7 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/devtools/devtools_window_testing.h"
+#include "chrome/browser/fullscreen.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -30,6 +31,7 @@
#import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h"
#import "chrome/browser/ui/cocoa/infobars/infobar_controller.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
+#import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
#import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h"
#import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
#import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
@@ -40,6 +42,7 @@
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/infobar_container_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_profile.h"
#include "components/infobars/core/infobar_delegate.h"
@@ -316,6 +319,17 @@ class BrowserWindowControllerTest : public InProcessBrowserTest {
runner->Run();
}
+ void VerifyFullscreenToolbarVisibility(fullscreen_mac::SlidingStyle style) {
+ EXPECT_EQ([[controller() presentationModeController] slidingStyle], style);
+
+ NSRect toolbarFrame = [[[controller() toolbarController] view] frame];
+ NSRect screenFrame = [[[controller() window] screen] frame];
+ if (style == fullscreen_mac::OMNIBOX_TABS_PRESENT)
+ EXPECT_LE(NSMaxY(toolbarFrame), NSMaxY(screenFrame));
+ else
+ EXPECT_GE(NSMinY(toolbarFrame), NSMaxY(screenFrame));
+ }
+
NSInteger GetExpectedTopInfoBarTipHeight() {
InfoBarContainerController* info_bar_container_controller =
[controller() infoBarContainerController];
@@ -673,3 +687,37 @@ IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest, FullscreenResizeFlags) {
ToggleFullscreenAndWaitForNotification();
VerifyFullscreenResizeFlagsAfterTransition();
}
+
+// Tests that the omnibox and tabs are hidden/visible in fullscreen mode.
+// Ensure that when the user toggles this setting, the omnibox, tabs and
+// preferences are updated correctly.
+IN_PROC_BROWSER_TEST_F(BrowserWindowControllerTest,
+ FullscreenToolbarIsVisibleAccordingToPrefs) {
+ // This feature is only available on SystemFullscreen.
+ if (!chrome::mac::SupportsSystemFullscreen())
+ return;
+
+ // Tests that the preference is set to false by default.
+ PrefService* prefs = browser()->profile()->GetPrefs();
+ EXPECT_FALSE(prefs->GetBoolean(prefs::kHideFullscreenToolbar));
+
+ // Toggle fullscreen and check if the toolbar is shown.
+ ToggleFullscreenAndWaitForNotification();
+ VerifyFullscreenToolbarVisibility(fullscreen_mac::OMNIBOX_TABS_PRESENT);
+
+ // Toggle the visibility of the fullscreen toolbar. Verify that the toolbar
+ // is hidden and the preference is correctly updated.
+ [[controller() presentationModeController] setToolbarFraction:0.0];
+ chrome::ExecuteCommand(browser(), IDC_TOGGLE_FULLSCREEN_TOOLBAR);
+ EXPECT_TRUE(prefs->GetBoolean(prefs::kHideFullscreenToolbar));
+ VerifyFullscreenToolbarVisibility(fullscreen_mac::OMNIBOX_TABS_HIDDEN);
+
+ // Toggle out and back into fullscreen and verify that the toolbar is still
+ // hidden.
+ ToggleFullscreenAndWaitForNotification();
+ ToggleFullscreenAndWaitForNotification();
+ VerifyFullscreenToolbarVisibility(fullscreen_mac::OMNIBOX_TABS_HIDDEN);
+
+ chrome::ExecuteCommand(browser(), IDC_TOGGLE_FULLSCREEN_TOOLBAR);
+ EXPECT_FALSE(prefs->GetBoolean(prefs::kHideFullscreenToolbar));
+}
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/browser/ui/cocoa/browser_window_controller_private.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698