summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/cocoa')
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm19
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
index 0810bf6..aad3242 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm
@@ -24,6 +24,7 @@
#import "chrome/browser/ui/cocoa/view_resizer_pong.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
+#include "chrome/test/base/testing_pref_service_syncable.h"
#include "chrome/test/base/testing_profile.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_utils.h"
@@ -1607,6 +1608,24 @@ TEST_F(BookmarkBarControllerTest, BookmarksWithoutAppsPageShortcut) {
NSMinX([[[bar_ buttonView] importBookmarksButton] frame]));
}
+TEST_F(BookmarkBarControllerTest, ManagedShowAppsShortcutInBookmarksBar) {
+ // By default the pref is not managed and the apps shortcut is shown.
+ TestingPrefServiceSyncable* prefs = profile()->GetTestingPrefService();
+ EXPECT_FALSE(
+ prefs->IsManagedPreference(prefs::kShowAppsShortcutInBookmarkBar));
+ EXPECT_FALSE([bar_ appsPageShortcutButtonIsHidden]);
+
+ // Hide the apps shortcut by policy, via the managed pref.
+ prefs->SetManagedPref(prefs::kShowAppsShortcutInBookmarkBar,
+ new base::FundamentalValue(false));
+ EXPECT_TRUE([bar_ appsPageShortcutButtonIsHidden]);
+
+ // And try showing it via policy too.
+ prefs->SetManagedPref(prefs::kShowAppsShortcutInBookmarkBar,
+ new base::FundamentalValue(true));
+ EXPECT_FALSE([bar_ appsPageShortcutButtonIsHidden]);
+}
+
class BookmarkBarControllerOpenAllTest : public BookmarkBarControllerTest {
public:
virtual void SetUp() {