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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm

Issue 312673006: Added a policy to control the visibility of the apps shortcut. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed remaining nits Created 6 years, 6 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/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() {

Powered by Google App Engine
This is Rietveld 408576698