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

Side by Side Diff: chrome/browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc

Issue 2459823002: [Sync] Rename syncable_prefs to sync_preferences. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 15 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 17 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
18 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" 18 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h"
19 #include "chrome/test/base/testing_profile.h" 19 #include "chrome/test/base/testing_profile.h"
20 #include "components/bookmarks/browser/bookmark_model.h" 20 #include "components/bookmarks/browser/bookmark_model.h"
21 #include "components/bookmarks/browser/bookmark_node.h" 21 #include "components/bookmarks/browser/bookmark_node.h"
22 #include "components/bookmarks/common/bookmark_pref_names.h" 22 #include "components/bookmarks/common/bookmark_pref_names.h"
23 #include "components/bookmarks/test/bookmark_test_helpers.h" 23 #include "components/bookmarks/test/bookmark_test_helpers.h"
24 #include "components/syncable_prefs/testing_pref_service_syncable.h" 24 #include "components/sync_preferences/testing_pref_service_syncable.h"
25 #include "content/public/browser/page_navigator.h" 25 #include "content/public/browser/page_navigator.h"
26 #include "content/public/test/test_browser_thread.h" 26 #include "content/public/test/test_browser_thread.h"
27 #include "content/public/test/test_browser_thread_bundle.h" 27 #include "content/public/test/test_browser_thread_bundle.h"
28 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
29 #include "ui/base/clipboard/clipboard.h" 29 #include "ui/base/clipboard/clipboard.h"
30 30
31 using base::ASCIIToUTF16; 31 using base::ASCIIToUTF16;
32 using bookmarks::BookmarkModel; 32 using bookmarks::BookmarkModel;
33 using bookmarks::BookmarkNode; 33 using bookmarks::BookmarkNode;
34 using content::BrowserThread; 34 using content::BrowserThread;
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 ASSERT_EQ(old_count, bb_node->child_count()); 332 ASSERT_EQ(old_count, bb_node->child_count());
333 } 333 }
334 334
335 TEST_F(BookmarkContextMenuControllerTest, 335 TEST_F(BookmarkContextMenuControllerTest,
336 ManagedShowAppsShortcutInBookmarksBar) { 336 ManagedShowAppsShortcutInBookmarksBar) {
337 BookmarkContextMenuController controller( 337 BookmarkContextMenuController controller(
338 NULL, NULL, NULL, profile_.get(), NULL, model_->bookmark_bar_node(), 338 NULL, NULL, NULL, profile_.get(), NULL, model_->bookmark_bar_node(),
339 std::vector<const BookmarkNode*>()); 339 std::vector<const BookmarkNode*>());
340 340
341 // By default, the pref is not managed and the command is enabled. 341 // By default, the pref is not managed and the command is enabled.
342 syncable_prefs::TestingPrefServiceSyncable* prefs = 342 sync_preferences::TestingPrefServiceSyncable* prefs =
343 profile_->GetTestingPrefService(); 343 profile_->GetTestingPrefService();
344 EXPECT_FALSE(prefs->IsManagedPreference( 344 EXPECT_FALSE(prefs->IsManagedPreference(
345 bookmarks::prefs::kShowAppsShortcutInBookmarkBar)); 345 bookmarks::prefs::kShowAppsShortcutInBookmarkBar));
346 EXPECT_TRUE( 346 EXPECT_TRUE(
347 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); 347 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT));
348 348
349 // Disabling the shorcut by policy disables the command. 349 // Disabling the shorcut by policy disables the command.
350 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, 350 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar,
351 new base::FundamentalValue(false)); 351 new base::FundamentalValue(false));
352 EXPECT_FALSE( 352 EXPECT_FALSE(
353 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); 353 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT));
354 354
355 // And enabling the shortcut by policy disables the command too. 355 // And enabling the shortcut by policy disables the command too.
356 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, 356 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar,
357 new base::FundamentalValue(true)); 357 new base::FundamentalValue(true));
358 EXPECT_FALSE( 358 EXPECT_FALSE(
359 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); 359 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT));
360 } 360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698