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

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

Issue 2782553004: Move TestingPrefService to use unique_ptr<Value> (Closed)
Patch Set: comments Created 3 years, 8 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 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/memory/ptr_util.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 18 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
18 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h" 19 #include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h"
19 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
20 #include "components/bookmarks/browser/bookmark_model.h" 21 #include "components/bookmarks/browser/bookmark_model.h"
21 #include "components/bookmarks/browser/bookmark_node.h" 22 #include "components/bookmarks/browser/bookmark_node.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // By default, the pref is not managed and the command is enabled. 342 // By default, the pref is not managed and the command is enabled.
342 sync_preferences::TestingPrefServiceSyncable* prefs = 343 sync_preferences::TestingPrefServiceSyncable* prefs =
343 profile_->GetTestingPrefService(); 344 profile_->GetTestingPrefService();
344 EXPECT_FALSE(prefs->IsManagedPreference( 345 EXPECT_FALSE(prefs->IsManagedPreference(
345 bookmarks::prefs::kShowAppsShortcutInBookmarkBar)); 346 bookmarks::prefs::kShowAppsShortcutInBookmarkBar));
346 EXPECT_TRUE( 347 EXPECT_TRUE(
347 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); 348 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT));
348 349
349 // Disabling the shorcut by policy disables the command. 350 // Disabling the shorcut by policy disables the command.
350 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, 351 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar,
351 new base::Value(false)); 352 base::MakeUnique<base::Value>(false));
352 EXPECT_FALSE( 353 EXPECT_FALSE(
353 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); 354 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT));
354 355
355 // And enabling the shortcut by policy disables the command too. 356 // And enabling the shortcut by policy disables the command too.
356 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, 357 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar,
357 new base::Value(true)); 358 base::MakeUnique<base::Value>(true));
358 EXPECT_FALSE( 359 EXPECT_FALSE(
359 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); 360 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT));
360 } 361 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698