prefs: Replace base::MakeUnique with std::make_unique
Bug: 755727
Change-Id: I64bb34f8807685ee0bc9fe581bffee9e3f5fa031
Reviewed-on: https://chromium-review.googlesource.com/846584
Commit-Queue: Jinho Bang <[email protected]>
Reviewed-by: Dominic Battré <[email protected]>
Cr-Commit-Position: refs/heads/master@{#526428}
diff --git a/components/prefs/json_pref_store_unittest.cc b/components/prefs/json_pref_store_unittest.cc
index fcb28f5..b0e2229 100644
--- a/components/prefs/json_pref_store_unittest.cc
+++ b/components/prefs/json_pref_store_unittest.cc
@@ -14,7 +14,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/location.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/metrics/histogram_samples.h"
#include "base/path_service.h"
@@ -231,7 +230,7 @@
base::FilePath some_path(FILE_PATH_LITERAL("/usr/sbin/"));
pref_store->SetValue(kSomeDirectory,
- base::MakeUnique<Value>(some_path.value()),
+ std::make_unique<Value>(some_path.value()),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
EXPECT_TRUE(pref_store->GetValue(kSomeDirectory, &actual));
EXPECT_TRUE(actual->GetAsString(&path));
@@ -243,7 +242,7 @@
EXPECT_TRUE(actual->GetAsBoolean(&boolean));
EXPECT_TRUE(boolean);
- pref_store->SetValue(kNewWindowsInTabs, base::MakeUnique<Value>(false),
+ pref_store->SetValue(kNewWindowsInTabs, std::make_unique<Value>(false),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
EXPECT_TRUE(pref_store->GetValue(kNewWindowsInTabs, &actual));
EXPECT_TRUE(actual->GetAsBoolean(&boolean));
@@ -253,7 +252,7 @@
int integer = 0;
EXPECT_TRUE(actual->GetAsInteger(&integer));
EXPECT_EQ(20, integer);
- pref_store->SetValue(kMaxTabs, base::MakeUnique<Value>(10),
+ pref_store->SetValue(kMaxTabs, std::make_unique<Value>(10),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
EXPECT_TRUE(pref_store->GetValue(kMaxTabs, &actual));
EXPECT_TRUE(actual->GetAsInteger(&integer));
@@ -261,7 +260,7 @@
pref_store->SetValue(
kLongIntPref,
- base::MakeUnique<Value>(base::Int64ToString(214748364842LL)),
+ std::make_unique<Value>(base::Int64ToString(214748364842LL)),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
EXPECT_TRUE(pref_store->GetValue(kLongIntPref, &actual));
EXPECT_TRUE(actual->GetAsString(&string_value));
@@ -350,9 +349,9 @@
auto pref_store = base::MakeRefCounted<JsonPrefStore>(pref_file);
// Set some keys with empty values.
- pref_store->SetValue("list", base::MakeUnique<base::ListValue>(),
+ pref_store->SetValue("list", std::make_unique<base::ListValue>(),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
- pref_store->SetValue("dict", base::MakeUnique<base::DictionaryValue>(),
+ pref_store->SetValue("dict", std::make_unique<base::DictionaryValue>(),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
// Write to file.
@@ -714,7 +713,7 @@
// Set a normal pref and check that it gets scheduled to be written.
ASSERT_FALSE(file_writer->HasPendingWrite());
- pref_store->SetValue("normal", base::MakeUnique<base::Value>("normal"),
+ pref_store->SetValue("normal", std::make_unique<base::Value>("normal"),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
ASSERT_TRUE(file_writer->HasPendingWrite());
file_writer->DoScheduledWrite();
@@ -723,14 +722,14 @@
// Set a lossy pref and check that it is not scheduled to be written.
// SetValue/RemoveValue.
- pref_store->SetValue("lossy", base::MakeUnique<base::Value>("lossy"),
+ pref_store->SetValue("lossy", std::make_unique<base::Value>("lossy"),
WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
ASSERT_FALSE(file_writer->HasPendingWrite());
pref_store->RemoveValue("lossy", WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
ASSERT_FALSE(file_writer->HasPendingWrite());
// SetValueSilently/RemoveValueSilently.
- pref_store->SetValueSilently("lossy", base::MakeUnique<base::Value>("lossy"),
+ pref_store->SetValueSilently("lossy", std::make_unique<base::Value>("lossy"),
WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
ASSERT_FALSE(file_writer->HasPendingWrite());
pref_store->RemoveValueSilently("lossy",
@@ -738,7 +737,7 @@
ASSERT_FALSE(file_writer->HasPendingWrite());
// ReportValueChanged.
- pref_store->SetValue("lossy", base::MakeUnique<base::Value>("lossy"),
+ pref_store->SetValue("lossy", std::make_unique<base::Value>("lossy"),
WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
ASSERT_FALSE(file_writer->HasPendingWrite());
pref_store->ReportValueChanged("lossy",
@@ -759,12 +758,12 @@
// Set a lossy pref and check that it is not scheduled to be written.
ASSERT_FALSE(file_writer->HasPendingWrite());
- pref_store->SetValue("lossy", base::MakeUnique<base::Value>("lossy"),
+ pref_store->SetValue("lossy", std::make_unique<base::Value>("lossy"),
WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
ASSERT_FALSE(file_writer->HasPendingWrite());
// Set a normal pref and check that it is scheduled to be written.
- pref_store->SetValue("normal", base::MakeUnique<base::Value>("normal"),
+ pref_store->SetValue("normal", std::make_unique<base::Value>("normal"),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
ASSERT_TRUE(file_writer->HasPendingWrite());
@@ -781,12 +780,12 @@
// Set a normal pref and check that it is scheduled to be written.
ASSERT_FALSE(file_writer->HasPendingWrite());
- pref_store->SetValue("normal", base::MakeUnique<base::Value>("normal"),
+ pref_store->SetValue("normal", std::make_unique<base::Value>("normal"),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
ASSERT_TRUE(file_writer->HasPendingWrite());
// Set a lossy pref and check that the write is still scheduled.
- pref_store->SetValue("lossy", base::MakeUnique<base::Value>("lossy"),
+ pref_store->SetValue("lossy", std::make_unique<base::Value>("lossy"),
WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
ASSERT_TRUE(file_writer->HasPendingWrite());
@@ -802,7 +801,7 @@
ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store.get());
// Set a lossy pref and check that it is not scheduled to be written.
- pref_store->SetValue("lossy", base::MakeUnique<base::Value>("lossy"),
+ pref_store->SetValue("lossy", std::make_unique<base::Value>("lossy"),
WriteablePrefStore::LOSSY_PREF_WRITE_FLAG);
ASSERT_FALSE(file_writer->HasPendingWrite());
@@ -965,7 +964,7 @@
EXPECT_EQ(NOT_CALLED,
write_callback_observer_.GetAndResetPostWriteObservationState());
- pref_store->SetValue("normal", base::MakeUnique<base::Value>("normal"),
+ pref_store->SetValue("normal", std::make_unique<base::Value>("normal"),
WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS);
file_writer->DoScheduledWrite();
@@ -989,7 +988,7 @@
// RegisterOnNextSuccessfulWriteReply.
successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get());
write_callback_observer_.ObserveNextWriteCallback(pref_store.get());
- file_writer->WriteNow(MakeUnique<std::string>("foo"));
+ file_writer->WriteNow(std::make_unique<std::string>("foo"));
scoped_task_environment_.RunUntilIdle();
EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState());
EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState());
@@ -1000,7 +999,7 @@
// RegisterOnNextWriteSynchronousCallbacks.
successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get());
write_callback_observer_.ObserveNextWriteCallback(pref_store.get());
- file_writer->WriteNow(MakeUnique<std::string>("foo"));
+ file_writer->WriteNow(std::make_unique<std::string>("foo"));
scoped_task_environment_.RunUntilIdle();
EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState());
EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState());
@@ -1009,7 +1008,7 @@
// Test RegisterOnNextSuccessfulWriteReply only.
successful_write_reply_observer_.ObserveNextWriteCallback(pref_store.get());
- file_writer->WriteNow(MakeUnique<std::string>("foo"));
+ file_writer->WriteNow(std::make_unique<std::string>("foo"));
scoped_task_environment_.RunUntilIdle();
EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState());
EXPECT_FALSE(write_callback_observer_.GetAndResetPreWriteObservationState());
@@ -1018,7 +1017,7 @@
// Test RegisterOnNextWriteSynchronousCallbacks only.
write_callback_observer_.ObserveNextWriteCallback(pref_store.get());
- file_writer->WriteNow(MakeUnique<std::string>("foo"));
+ file_writer->WriteNow(std::make_unique<std::string>("foo"));
scoped_task_environment_.RunUntilIdle();
EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState());
EXPECT_TRUE(write_callback_observer_.GetAndResetPreWriteObservationState());
@@ -1062,7 +1061,7 @@
// Do a real write, and confirm that the successful observer was invoked after
// being set by |PostWriteCallback| by the last TriggerFakeWriteCallback.
ImportantFileWriter* file_writer = GetImportantFileWriter(pref_store.get());
- file_writer->WriteNow(MakeUnique<std::string>("foo"));
+ file_writer->WriteNow(std::make_unique<std::string>("foo"));
scoped_task_environment_.RunUntilIdle();
EXPECT_TRUE(successful_write_reply_observer_.GetAndResetObservationState());
EXPECT_EQ(NOT_CALLED,
@@ -1081,7 +1080,7 @@
soon_out_of_scope_pref_store.get());
write_callback_observer_.ObserveNextWriteCallback(
soon_out_of_scope_pref_store.get());
- file_writer->WriteNow(MakeUnique<std::string>("foo"));
+ file_writer->WriteNow(std::make_unique<std::string>("foo"));
}
scoped_task_environment_.RunUntilIdle();
EXPECT_FALSE(successful_write_reply_observer_.GetAndResetObservationState());