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

Unified Diff: components/prefs/pref_change_registrar_unittest.cc

Issue 2782553004: Move TestingPrefService to use unique_ptr<Value> (Closed)
Patch Set: comments Created 3 years, 9 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: components/prefs/pref_change_registrar_unittest.cc
diff --git a/components/prefs/pref_change_registrar_unittest.cc b/components/prefs/pref_change_registrar_unittest.cc
index cecaca85ed90bd38f8bf23288a1b6da32b8f6b83..15be02c869e6a044d01c4b682db15cab27072441 100644
--- a/components/prefs/pref_change_registrar_unittest.cc
+++ b/components/prefs/pref_change_registrar_unittest.cc
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "components/prefs/pref_change_registrar.h"
+
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "components/prefs/pref_change_registrar.h"
+#include "base/memory/ptr_util.h"
#include "components/prefs/pref_observer.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
@@ -157,9 +159,11 @@ TEST_F(ObserveSetOfPreferencesTest, IsObserved) {
TEST_F(ObserveSetOfPreferencesTest, IsManaged) {
std::unique_ptr<PrefChangeRegistrar> pref_set(CreatePrefChangeRegistrar());
EXPECT_FALSE(pref_set->IsManaged());
- pref_service_->SetManagedPref(kHomePage, new Value("http://crbug.com"));
+ pref_service_->SetManagedPref(kHomePage,
+ base::MakeUnique<Value>("http://crbug.com"));
EXPECT_TRUE(pref_set->IsManaged());
- pref_service_->SetManagedPref(kHomePageIsNewTabPage, new Value(true));
+ pref_service_->SetManagedPref(kHomePageIsNewTabPage,
+ base::MakeUnique<Value>(true));
EXPECT_TRUE(pref_set->IsManaged());
pref_service_->RemoveManagedPref(kHomePage);
EXPECT_TRUE(pref_set->IsManaged());
@@ -180,15 +184,18 @@ TEST_F(ObserveSetOfPreferencesTest, Observe) {
pref_set.Add(kHomePageIsNewTabPage, callback);
EXPECT_CALL(*this, OnPreferenceChanged(kHomePage));
- pref_service_->SetUserPref(kHomePage, new Value("http://crbug.com"));
+ pref_service_->SetUserPref(kHomePage,
+ base::MakeUnique<Value>("http://crbug.com"));
Mock::VerifyAndClearExpectations(this);
EXPECT_CALL(*this, OnPreferenceChanged(kHomePageIsNewTabPage));
- pref_service_->SetUserPref(kHomePageIsNewTabPage, new Value(true));
+ pref_service_->SetUserPref(kHomePageIsNewTabPage,
+ base::MakeUnique<Value>(true));
Mock::VerifyAndClearExpectations(this);
EXPECT_CALL(*this, OnPreferenceChanged(_)).Times(0);
- pref_service_->SetUserPref(kApplicationLocale, new Value("en_US.utf8"));
+ pref_service_->SetUserPref(kApplicationLocale,
+ base::MakeUnique<Value>("en_US.utf8"));
Mock::VerifyAndClearExpectations(this);
}
« no previous file with comments | « components/policy/core/browser/url_blacklist_manager_unittest.cc ('k') | components/prefs/pref_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698