Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm |
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 0810bf67b94331b8db105f9d2ccb6bae6458a419..aad3242f7f984e6fc204bf09ad844a900ff9ed74 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() { |