OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 } | 342 } |
343 | 343 |
344 TEST_F(BookmarkContextMenuControllerTest, | 344 TEST_F(BookmarkContextMenuControllerTest, |
345 ManagedShowAppsShortcutInBookmarksBar) { | 345 ManagedShowAppsShortcutInBookmarksBar) { |
346 BookmarkContextMenuController controller( | 346 BookmarkContextMenuController controller( |
347 NULL, NULL, NULL, profile_.get(), NULL, model_->bookmark_bar_node(), | 347 NULL, NULL, NULL, profile_.get(), NULL, model_->bookmark_bar_node(), |
348 std::vector<const BookmarkNode*>()); | 348 std::vector<const BookmarkNode*>()); |
349 | 349 |
350 // By default, the pref is not managed and the command is enabled. | 350 // By default, the pref is not managed and the command is enabled. |
351 TestingPrefServiceSyncable* prefs = profile_->GetTestingPrefService(); | 351 TestingPrefServiceSyncable* prefs = profile_->GetTestingPrefService(); |
352 EXPECT_FALSE( | 352 EXPECT_FALSE(prefs->IsManagedPreference( |
353 prefs->IsManagedPreference(prefs::kShowAppsShortcutInBookmarkBar)); | 353 bookmarks::prefs::kShowAppsShortcutInBookmarkBar)); |
354 EXPECT_TRUE( | 354 EXPECT_TRUE( |
355 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); | 355 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); |
356 | 356 |
357 // Disabling the shorcut by policy disables the command. | 357 // Disabling the shorcut by policy disables the command. |
358 prefs->SetManagedPref(prefs::kShowAppsShortcutInBookmarkBar, | 358 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, |
359 new base::FundamentalValue(false)); | 359 new base::FundamentalValue(false)); |
360 EXPECT_FALSE( | 360 EXPECT_FALSE( |
361 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); | 361 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); |
362 | 362 |
363 // And enabling the shortcut by policy disables the command too. | 363 // And enabling the shortcut by policy disables the command too. |
364 prefs->SetManagedPref(prefs::kShowAppsShortcutInBookmarkBar, | 364 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, |
365 new base::FundamentalValue(true)); | 365 new base::FundamentalValue(true)); |
366 EXPECT_FALSE( | 366 EXPECT_FALSE( |
367 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); | 367 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); |
368 } | 368 } |
OLD | NEW |