summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
diff options
context:
space:
mode:
authorspqchan <spqchan@chromium.org>2016-02-04 16:59:18 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-05 01:00:37 +0000
commitcae22576c51838b5c32a2d489e8c6187dc3c451f (patch)
tree5c3b91c77d54cb50a4c9bfe8686799e0de7f1673 /chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
parent03b7a204fceb8948d84e36e66b26b9a447a2f51f (diff)
downloadchromium_src-cae22576c51838b5c32a2d489e8c6187dc3c451f.zip
chromium_src-cae22576c51838b5c32a2d489e8c6187dc3c451f.tar.gz
chromium_src-cae22576c51838b5c32a2d489e8c6187dc3c451f.tar.bz2
Preference for Presentation Mode/Fullscreen Toolbar
Fixes the issue with the test on 10.10 for the commit: https://chromium.googlesource.com/chromium/src/+/048c293643242dc0357c8bc8651d1c251559a400 BUG=544307 Review URL: https://codereview.chromium.org/1650713003 Cr-Commit-Position: refs/heads/master@{#373695}
Diffstat (limited to 'chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm')
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm48
1 files changed, 48 insertions, 0 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm b/chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm
index df6e2cd..7865cef 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));
+}