Chromium Code Reviews

Unified Diff: components/prefs/pref_change_registrar_unittest.cc

Issue 2782553004: Move TestingPrefService to use unique_ptr<Value> (Closed)
Patch Set: Android Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
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..9c508eaa87817ba471d4a377681038e62862852f 100644
--- a/components/prefs/pref_change_registrar_unittest.cc
+++ b/components/prefs/pref_change_registrar_unittest.cc
@@ -2,9 +2,10 @@
// 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"
jdoerrie 2017/03/29 09:28:00 Nit: Missing New Line
vabr (Chromium) 2017/03/29 09:43:56 Thanks for catching this! Turns out clang-format m
#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 +158,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 +183,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);
}

Powered by Google App Engine