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

Unified Diff: components/search_engines/default_search_manager_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/search_engines/default_search_manager_unittest.cc
diff --git a/components/search_engines/default_search_manager_unittest.cc b/components/search_engines/default_search_manager_unittest.cc
index f2a12757b92e686c1da71062c7d445ded1aa5c48..5e72128e7055199e6848025ee37b94a6dc18ae42 100644
--- a/components/search_engines/default_search_manager_unittest.cc
+++ b/components/search_engines/default_search_manager_unittest.cc
@@ -7,9 +7,11 @@
#include <stddef.h>
#include <memory>
+#include <utility>
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -30,8 +32,8 @@ namespace {
void SetOverrides(sync_preferences::TestingPrefServiceSyncable* prefs,
bool update) {
prefs->SetUserPref(prefs::kSearchProviderOverridesVersion,
- new base::Value(1));
- base::ListValue* overrides = new base::ListValue;
+ base::MakeUnique<base::Value>(1));
+ auto overrides = base::MakeUnique<base::ListValue>();
std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
entry->SetString("name", update ? "new_foo" : "foo");
@@ -59,7 +61,7 @@ void SetOverrides(sync_preferences::TestingPrefServiceSyncable* prefs,
entry->SetString("keyword", "bazk");
entry->SetString("encoding", "UTF-8");
overrides->Append(entry->CreateDeepCopy());
- prefs->SetUserPref(prefs::kSearchProviderOverrides, overrides);
+ prefs->SetUserPref(prefs::kSearchProviderOverrides, std::move(overrides));
}
void SetPolicy(sync_preferences::TestingPrefServiceSyncable* prefs,
@@ -74,7 +76,7 @@ void SetPolicy(sync_preferences::TestingPrefServiceSyncable* prefs,
entry->SetBoolean(DefaultSearchManager::kDisabledByPolicy, !enabled);
prefs->SetManagedPref(
DefaultSearchManager::kDefaultSearchProviderDataPrefName,
- entry.release());
+ std::move(entry));
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698