policy: Replace base::MakeUnique with std::make_unique
Bug: 755727
Change-Id: I40c12783a9fdadbb693c87282b86bc11bcbcd106
Reviewed-on: https://chromium-review.googlesource.com/846582
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Commit-Queue: Jinho Bang <jinho.bang@samsung.com>
Cr-Commit-Position: refs/heads/master@{#526423}
CrOS-Libchrome-Original-Commit: 17610a4d9347c0270f92dd0e0b623d5407421668
diff --git a/components/policy/core/common/async_policy_provider_unittest.cc b/components/policy/core/common/async_policy_provider_unittest.cc
index 5365465..61286c6 100644
--- a/components/policy/core/common/async_policy_provider_unittest.cc
+++ b/components/policy/core/common/async_policy_provider_unittest.cc
@@ -6,7 +6,6 @@
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -34,7 +33,7 @@
const std::string& value) {
bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
.Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(value),
+ POLICY_SOURCE_PLATFORM, std::make_unique<base::Value>(value),
nullptr);
}
diff --git a/components/policy/core/common/config_dir_policy_loader_unittest.cc b/components/policy/core/common/config_dir_policy_loader_unittest.cc
index 569fe2d..b17add7 100644
--- a/components/policy/core/common/config_dir_policy_loader_unittest.cc
+++ b/components/policy/core/common/config_dir_policy_loader_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "components/policy/core/common/config_dir_policy_loader.h"
+#include <memory>
#include <utility>
@@ -11,7 +12,6 @@
#include "base/files/scoped_temp_dir.h"
#include "base/json/json_string_value_serializer.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_number_conversions.h"
@@ -122,7 +122,7 @@
void TestHarness::InstallStringListPolicy(const std::string& policy_name,
const base::ListValue* policy_value) {
base::DictionaryValue dict;
- dict.Set(policy_name, base::MakeUnique<base::Value>(policy_value->Clone()));
+ dict.Set(policy_name, std::make_unique<base::Value>(policy_value->Clone()));
WriteConfigFile(dict, NextConfigFileName());
}
@@ -130,7 +130,7 @@
const std::string& policy_name,
const base::DictionaryValue* policy_value) {
base::DictionaryValue dict;
- dict.Set(policy_name, base::MakeUnique<base::Value>(policy_value->Clone()));
+ dict.Set(policy_name, std::make_unique<base::Value>(policy_value->Clone()));
WriteConfigFile(dict, NextConfigFileName());
}
diff --git a/components/policy/core/common/configuration_policy_provider_test.cc b/components/policy/core/common/configuration_policy_provider_test.cc
index 554825a..4f9beea 100644
--- a/components/policy/core/common/configuration_policy_provider_test.cc
+++ b/components/policy/core/common/configuration_policy_provider_test.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/memory/ptr_util.h"
#include "base/task_scheduler/post_task.h"
#include "base/task_scheduler/task_traits.h"
#include "base/values.h"
@@ -298,19 +297,19 @@
expected_value.SetInteger("int", 123);
expected_value.SetString("string", "omg");
- auto list = base::MakeUnique<base::ListValue>();
+ auto list = std::make_unique<base::ListValue>();
list->AppendString("first");
list->AppendString("second");
expected_value.Set("array", std::move(list));
- auto dict = base::MakeUnique<base::DictionaryValue>();
+ auto dict = std::make_unique<base::DictionaryValue>();
dict->SetString("sub", "value");
- list = base::MakeUnique<base::ListValue>();
- auto sub = base::MakeUnique<base::DictionaryValue>();
+ list = std::make_unique<base::ListValue>();
+ auto sub = std::make_unique<base::DictionaryValue>();
sub->SetInteger("aaa", 111);
sub->SetInteger("bbb", 222);
list->Append(std::move(sub));
- sub = base::MakeUnique<base::DictionaryValue>();
+ sub = std::make_unique<base::DictionaryValue>();
sub->SetString("ccc", "333");
sub->SetString("ddd", "444");
list->Append(std::move(sub));
@@ -349,7 +348,7 @@
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
.Set(test_keys::kKeyString, test_harness_->policy_level(),
test_harness_->policy_scope(), test_harness_->policy_source(),
- base::MakeUnique<base::Value>("value"), nullptr);
+ std::make_unique<base::Value>("value"), nullptr);
EXPECT_TRUE(provider_->policies().Equals(bundle));
provider_->RemoveObserver(&observer);
}
@@ -367,9 +366,9 @@
policy_dict.SetInteger("int", 789);
policy_dict.SetString("string", "string value");
- auto list = base::MakeUnique<base::ListValue>();
+ auto list = std::make_unique<base::ListValue>();
for (int i = 0; i < 2; ++i) {
- auto dict = base::MakeUnique<base::DictionaryValue>();
+ auto dict = std::make_unique<base::DictionaryValue>();
dict->SetInteger("subdictindex", i);
dict->SetKey("subdict", policy_dict.Clone());
list->Append(std::move(dict));
diff --git a/components/policy/core/common/generate_policy_source_unittest.cc b/components/policy/core/common/generate_policy_source_unittest.cc
index 1e9fa94..78d5cad 100644
--- a/components/policy/core/common/generate_policy_source_unittest.cc
+++ b/components/policy/core/common/generate_policy_source_unittest.cc
@@ -6,7 +6,6 @@
#include <memory>
#include <string>
-#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/policy/core/common/policy_details.h"
@@ -216,7 +215,7 @@
// If policy already configured, it's not changed to enterprise defaults.
policy_map.Set(key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>("test_value"), nullptr);
+ std::make_unique<base::Value>("test_value"), nullptr);
SetEnterpriseUsersDefaults(&policy_map);
multiprof_behavior =
policy_map.GetValue(key::kChromeOsMultiProfileUserBehavior);
diff --git a/components/policy/core/common/policy_bundle.cc b/components/policy/core/common/policy_bundle.cc
index fdcbb2a..8d369ad 100644
--- a/components/policy/core/common/policy_bundle.cc
+++ b/components/policy/core/common/policy_bundle.cc
@@ -5,7 +5,6 @@
#include "components/policy/core/common/policy_bundle.h"
#include "base/logging.h"
-#include "base/memory/ptr_util.h"
namespace policy {
@@ -19,7 +18,7 @@
DCHECK(ns.domain != POLICY_DOMAIN_CHROME || ns.component_id.empty());
std::unique_ptr<PolicyMap>& policy = policy_bundle_[ns];
if (!policy)
- policy = base::MakeUnique<PolicyMap>();
+ policy = std::make_unique<PolicyMap>();
return *policy;
}
diff --git a/components/policy/core/common/policy_bundle_unittest.cc b/components/policy/core/common/policy_bundle_unittest.cc
index 9193843..7ac3bd1 100644
--- a/components/policy/core/common/policy_bundle_unittest.cc
+++ b/components/policy/core/common/policy_bundle_unittest.cc
@@ -8,7 +8,6 @@
#include <utility>
#include "base/callback.h"
-#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_map.h"
@@ -32,12 +31,12 @@
// Adds test policies to |policy|.
void AddTestPolicies(PolicyMap* policy) {
policy->Set("mandatory-user", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(123), nullptr);
policy->Set("mandatory-machine", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("omg"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("omg"),
nullptr);
policy->Set("recommended-user", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true),
nullptr);
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetBoolean("false", false);
@@ -58,12 +57,12 @@
PolicyLevel level,
PolicyScope scope) {
policy->Set(kPolicyClashing0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(value),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(value),
nullptr);
policy->Set(kPolicyClashing1, level, scope, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(value), nullptr);
+ std::make_unique<base::Value>(value), nullptr);
policy->Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(value),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(value),
nullptr);
}
@@ -192,15 +191,15 @@
// - kPolicyN are merged from each bundle.
PolicyMap expected;
expected.Set(kPolicyClashing0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(0), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(0), nullptr);
expected.Set(kPolicyClashing1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(1), nullptr);
expected.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(0), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(0), nullptr);
expected.Set(kPolicy1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(1), nullptr);
expected.Set(kPolicy2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(2), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(2), nullptr);
EXPECT_TRUE(merged.Get(PolicyNamespace(POLICY_DOMAIN_CHROME,
std::string())).Equals(expected));
EXPECT_TRUE(merged.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS,
@@ -240,13 +239,13 @@
other.CopyFrom(bundle);
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(123), nullptr);
EXPECT_FALSE(bundle.Equals(other));
other.CopyFrom(bundle);
EXPECT_TRUE(bundle.Equals(other));
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(123), nullptr);
EXPECT_FALSE(bundle.Equals(other));
// Test non-const Get().
@@ -256,7 +255,7 @@
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
EXPECT_TRUE(bundle.Equals(other));
policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(123),
nullptr);
EXPECT_FALSE(bundle.Equals(other));
}
diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc
index 5c49dfd..4320faa 100644
--- a/components/policy/core/common/policy_map_unittest.cc
+++ b/components/policy/core/common/policy_map_unittest.cc
@@ -8,7 +8,6 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "components/policy/core/common/external_data_manager.h"
#include "components/policy/core/common/policy_types.h"
@@ -53,16 +52,16 @@
std::unique_ptr<ExternalDataFetcher> PolicyMapTest::CreateExternalDataFetcher(
const std::string& policy) const {
- return base::MakeUnique<ExternalDataFetcher>(
+ return std::make_unique<ExternalDataFetcher>(
base::WeakPtr<ExternalDataManager>(), policy);
}
TEST_F(PolicyMapTest, SetAndGet) {
PolicyMap map;
- SetPolicy(&map, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
+ SetPolicy(&map, kTestPolicyName1, std::make_unique<base::Value>("aaa"));
base::Value expected("aaa");
EXPECT_TRUE(expected.Equals(map.GetValue(kTestPolicyName1)));
- SetPolicy(&map, kTestPolicyName1, base::MakeUnique<base::Value>("bbb"));
+ SetPolicy(&map, kTestPolicyName1, std::make_unique<base::Value>("bbb"));
base::Value expected_b("bbb");
EXPECT_TRUE(expected_b.Equals(map.GetValue(kTestPolicyName1)));
SetPolicy(&map, kTestPolicyName1, CreateExternalDataFetcher("dummy"));
@@ -88,14 +87,14 @@
TEST_F(PolicyMapTest, Equals) {
PolicyMap a;
- SetPolicy(&a, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
+ SetPolicy(&a, kTestPolicyName1, std::make_unique<base::Value>("aaa"));
PolicyMap a2;
- SetPolicy(&a2, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
+ SetPolicy(&a2, kTestPolicyName1, std::make_unique<base::Value>("aaa"));
PolicyMap b;
- SetPolicy(&b, kTestPolicyName1, base::MakeUnique<base::Value>("bbb"));
+ SetPolicy(&b, kTestPolicyName1, std::make_unique<base::Value>("bbb"));
PolicyMap c;
- SetPolicy(&c, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
- SetPolicy(&c, kTestPolicyName2, base::MakeUnique<base::Value>(true));
+ SetPolicy(&c, kTestPolicyName1, std::make_unique<base::Value>("aaa"));
+ SetPolicy(&c, kTestPolicyName2, std::make_unique<base::Value>(true));
PolicyMap d;
SetPolicy(&d, kTestPolicyName1, CreateExternalDataFetcher("ddd"));
PolicyMap d2;
@@ -136,11 +135,11 @@
TEST_F(PolicyMapTest, Swap) {
PolicyMap a;
- SetPolicy(&a, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
+ SetPolicy(&a, kTestPolicyName1, std::make_unique<base::Value>("aaa"));
SetPolicy(&a, kTestPolicyName2, CreateExternalDataFetcher("dummy"));
PolicyMap b;
- SetPolicy(&b, kTestPolicyName1, base::MakeUnique<base::Value>("bbb"));
- SetPolicy(&b, kTestPolicyName3, base::MakeUnique<base::Value>(true));
+ SetPolicy(&b, kTestPolicyName1, std::make_unique<base::Value>("bbb"));
+ SetPolicy(&b, kTestPolicyName3, std::make_unique<base::Value>(true));
a.Swap(&b);
base::Value expected("bbb");
@@ -169,41 +168,41 @@
TEST_F(PolicyMapTest, MergeFrom) {
PolicyMap a;
a.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("google.com"),
nullptr);
a.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
a.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_ENTERPRISE_DEFAULT, nullptr,
CreateExternalDataFetcher("a"));
a.Set(kTestPolicyName4, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false), nullptr);
a.Set(kTestPolicyName5, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com/q={x}"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("google.com/q={x}"),
nullptr);
a.Set(kTestPolicyName7, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_ENTERPRISE_DEFAULT, base::MakeUnique<base::Value>(false),
+ POLICY_SOURCE_ENTERPRISE_DEFAULT, std::make_unique<base::Value>(false),
nullptr);
PolicyMap b;
b.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("chromium.org"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("chromium.org"),
nullptr);
b.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false), nullptr);
b.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_ENTERPRISE_DEFAULT, nullptr,
CreateExternalDataFetcher("b"));
b.Set(kTestPolicyName4, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE,
- base::MakeUnique<base::Value>(true), nullptr);
+ std::make_unique<base::Value>(true), nullptr);
b.Set(kTestPolicyName5, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(std::string()),
+ POLICY_SOURCE_PLATFORM, std::make_unique<base::Value>(std::string()),
nullptr);
b.Set(kTestPolicyName6, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
b.Set(kTestPolicyName7, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_ACTIVE_DIRECTORY, base::MakeUnique<base::Value>(true),
+ POLICY_SOURCE_ACTIVE_DIRECTORY, std::make_unique<base::Value>(true),
nullptr);
a.MergeFrom(b);
@@ -211,28 +210,28 @@
PolicyMap c;
// POLICY_SCOPE_MACHINE over POLICY_SCOPE_USER.
c.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("chromium.org"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("chromium.org"),
nullptr);
// |a| has precedence over |b|.
c.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
c.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_ENTERPRISE_DEFAULT, nullptr,
CreateExternalDataFetcher("a"));
// POLICY_SCOPE_MACHINE over POLICY_SCOPE_USER for POLICY_LEVEL_RECOMMENDED.
c.Set(kTestPolicyName4, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE,
- base::MakeUnique<base::Value>(true), nullptr);
+ std::make_unique<base::Value>(true), nullptr);
// POLICY_LEVEL_MANDATORY over POLICY_LEVEL_RECOMMENDED.
c.Set(kTestPolicyName5, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(std::string()),
+ POLICY_SOURCE_PLATFORM, std::make_unique<base::Value>(std::string()),
nullptr);
// Merge new ones.
c.Set(kTestPolicyName6, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
// POLICY_SOURCE_ACTIVE_DIRECTORY over POLICY_SOURCE_ENTERPRISE_DEFAULT.
c.Set(kTestPolicyName7, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_ACTIVE_DIRECTORY, base::MakeUnique<base::Value>(true),
+ POLICY_SOURCE_ACTIVE_DIRECTORY, std::make_unique<base::Value>(true),
nullptr);
EXPECT_TRUE(a.Equals(c));
@@ -241,39 +240,39 @@
TEST_F(PolicyMapTest, GetDifferingKeys) {
PolicyMap a;
a.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("google.com"),
nullptr);
a.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, nullptr, CreateExternalDataFetcher("dummy"));
a.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
a.Set(kTestPolicyName4, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, nullptr, CreateExternalDataFetcher("a"));
a.Set(kTestPolicyName5, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false), nullptr);
a.Set(kTestPolicyName6, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com/q={x}"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("google.com/q={x}"),
nullptr);
a.Set(kTestPolicyName7, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
PolicyMap b;
b.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("google.com"),
nullptr);
b.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, nullptr, CreateExternalDataFetcher("dummy"));
b.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false), nullptr);
b.Set(kTestPolicyName4, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, nullptr, CreateExternalDataFetcher("b"));
b.Set(kTestPolicyName5, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false), nullptr);
b.Set(kTestPolicyName6, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com/q={x}"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("google.com/q={x}"),
nullptr);
b.Set(kTestPolicyName8, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
std::set<std::string> diff;
std::set<std::string> diff2;
@@ -315,12 +314,12 @@
PolicyMap expected;
expected.Set("TestPolicy1", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_PLATFORM,
- base::MakeUnique<base::Value>("google.com"), nullptr);
+ std::make_unique<base::Value>("google.com"), nullptr);
expected.Set("TestPolicy2", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(true),
+ POLICY_SOURCE_PLATFORM, std::make_unique<base::Value>(true),
nullptr);
expected.Set("TestPolicy3", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(-12321),
+ POLICY_SOURCE_PLATFORM, std::make_unique<base::Value>(-12321),
nullptr);
EXPECT_TRUE(loaded.Equals(expected));
}
@@ -332,16 +331,16 @@
TEST_F(PolicyMapTest, EraseNonmatching) {
PolicyMap a;
a.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("google.com"),
nullptr);
a.Set(kTestPolicyName2, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
a.EraseNonmatching(base::Bind(&IsMandatory));
PolicyMap b;
b.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("google.com"),
nullptr);
EXPECT_TRUE(a.Equals(b));
}
diff --git a/components/policy/core/common/policy_scheduler.cc b/components/policy/core/common/policy_scheduler.cc
index b4c4bd1..4c8d67d 100644
--- a/components/policy/core/common/policy_scheduler.cc
+++ b/components/policy/core/common/policy_scheduler.cc
@@ -4,7 +4,6 @@
#include "components/policy/core/common/policy_scheduler.h"
-#include "base/memory/ptr_util.h"
#include "base/threading/thread_task_runner_handle.h"
namespace policy {
@@ -31,7 +30,7 @@
if (job_) {
job_->Cancel();
}
- job_ = base::MakeUnique<base::CancelableClosure>(base::Bind(
+ job_ = std::make_unique<base::CancelableClosure>(base::Bind(
&PolicyScheduler::RunScheduledTask, weak_ptr_factory_.GetWeakPtr()));
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(FROM_HERE,
job_->callback(), delay);
diff --git a/components/policy/core/common/policy_scheduler_unittest.cc b/components/policy/core/common/policy_scheduler_unittest.cc
index cb5758c..2950f3f 100644
--- a/components/policy/core/common/policy_scheduler_unittest.cc
+++ b/components/policy/core/common/policy_scheduler_unittest.cc
@@ -7,7 +7,6 @@
#include <memory>
#include "base/bind.h"
-#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/test/scoped_task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -59,7 +58,7 @@
};
TEST_F(PolicySchedulerTest, Run) {
- scheduler_ = base::MakeUnique<PolicyScheduler>(
+ scheduler_ = std::make_unique<PolicyScheduler>(
base::BindRepeating(&PolicySchedulerTest::DoTask, base::Unretained(this)),
base::BindRepeating(&PolicySchedulerTest::OnTaskDone,
base::Unretained(this)),
@@ -70,7 +69,7 @@
}
TEST_F(PolicySchedulerTest, Loop) {
- scheduler_ = base::MakeUnique<PolicyScheduler>(
+ scheduler_ = std::make_unique<PolicyScheduler>(
base::BindRepeating(&PolicySchedulerTest::DoTask, base::Unretained(this)),
base::BindRepeating(&PolicySchedulerTest::OnTaskDone,
base::Unretained(this)),
@@ -81,7 +80,7 @@
}
TEST_F(PolicySchedulerTest, Reschedule) {
- scheduler_ = base::MakeUnique<PolicyScheduler>(
+ scheduler_ = std::make_unique<PolicyScheduler>(
base::BindRepeating(&PolicySchedulerTest::DoTask, base::Unretained(this)),
base::BindRepeating(&PolicySchedulerTest::OnTaskDone,
base::Unretained(this)),
@@ -101,7 +100,7 @@
}
TEST_F(PolicySchedulerTest, OverlappingTasks) {
- scheduler_ = base::MakeUnique<PolicyScheduler>(
+ scheduler_ = std::make_unique<PolicyScheduler>(
base::BindRepeating(&PolicySchedulerTest::CaptureCallbackForSlowTask,
base::Unretained(this)),
base::BindRepeating(&PolicySchedulerTest::OnTaskDone,
@@ -131,4 +130,4 @@
EXPECT_EQ(2, done_counter_);
}
-} // namespace policy
\ No newline at end of file
+} // namespace policy
diff --git a/components/policy/core/common/policy_service_impl.cc b/components/policy/core/common/policy_service_impl.cc
index 53cdc09..29c09af 100644
--- a/components/policy/core/common/policy_service_impl.cc
+++ b/components/policy/core/common/policy_service_impl.cc
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
@@ -101,7 +100,7 @@
DCHECK(thread_checker_.CalledOnValidThread());
std::unique_ptr<Observers>& list = observers_[domain];
if (!list)
- list = base::MakeUnique<Observers>();
+ list = std::make_unique<Observers>();
list->AddObserver(observer);
}
diff --git a/components/policy/core/common/policy_service_impl_unittest.cc b/components/policy/core/common/policy_service_impl_unittest.cc
index 4b0bbb9..dd2d2da 100644
--- a/components/policy/core/common/policy_service_impl_unittest.cc
+++ b/components/policy/core/common/policy_service_impl_unittest.cc
@@ -11,7 +11,6 @@
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/values.h"
@@ -57,16 +56,16 @@
&bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
policy_map->Set(kSameLevelPolicy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
- base::MakeUnique<base::Value>(value), nullptr);
+ std::make_unique<base::Value>(value), nullptr);
policy_map->Set(kDiffLevelPolicy, level, scope, POLICY_SOURCE_PLATFORM,
- base::MakeUnique<base::Value>(value), nullptr);
+ std::make_unique<base::Value>(value), nullptr);
policy_map =
&bundle->Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kExtension));
policy_map->Set(kSameLevelPolicy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
- base::MakeUnique<base::Value>(value), nullptr);
+ std::make_unique<base::Value>(value), nullptr);
policy_map->Set(kDiffLevelPolicy, level, scope, POLICY_SOURCE_PLATFORM,
- base::MakeUnique<base::Value>(value), nullptr);
+ std::make_unique<base::Value>(value), nullptr);
}
// Observer class that changes the policy in the passed provider when the
@@ -82,7 +81,7 @@
const PolicyMap& current) override {
PolicyMap new_policy;
new_policy.Set("foo", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(14),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(14),
nullptr);
provider_->UpdateChromePolicy(new_policy);
observer_invoked_ = true;
@@ -114,7 +113,7 @@
policy0_.Set("pre", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
- base::MakeUnique<base::Value>(13), nullptr);
+ std::make_unique<base::Value>(13), nullptr);
provider0_.UpdateChromePolicy(policy0_);
PolicyServiceImpl::Providers providers;
@@ -164,7 +163,7 @@
PolicyMap expected;
expected.Set("pre", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
- base::MakeUnique<base::Value>(13), nullptr);
+ std::make_unique<base::Value>(13), nullptr);
EXPECT_TRUE(VerifyPolicies(
PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()), expected));
}
@@ -176,15 +175,15 @@
PolicyMap expectedPrevious;
expectedPrevious.Set("pre", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
- base::MakeUnique<base::Value>(13), nullptr);
+ std::make_unique<base::Value>(13), nullptr);
PolicyMap expectedCurrent;
expectedCurrent.CopyFrom(expectedPrevious);
expectedCurrent.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(123),
nullptr);
policy0_.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(123),
nullptr);
EXPECT_CALL(observer, OnPolicyUpdated(PolicyNamespace(POLICY_DOMAIN_CHROME,
std::string()),
@@ -203,10 +202,10 @@
// New policy.
expectedPrevious.CopyFrom(expectedCurrent);
expectedCurrent.Set("bbb", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(456),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(456),
nullptr);
policy0_.Set("bbb", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(456),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(456),
nullptr);
EXPECT_CALL(observer, OnPolicyUpdated(PolicyNamespace(POLICY_DOMAIN_CHROME,
std::string()),
@@ -229,10 +228,10 @@
// Changed policy.
expectedPrevious.CopyFrom(expectedCurrent);
expectedCurrent.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(789),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(789),
nullptr);
policy0_.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(789),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(789),
nullptr);
EXPECT_CALL(observer, OnPolicyUpdated(PolicyNamespace(POLICY_DOMAIN_CHROME,
@@ -264,11 +263,11 @@
PolicyMap previous_policy_map;
previous_policy_map.Set("pre", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
- base::MakeUnique<base::Value>(13), nullptr);
+ std::make_unique<base::Value>(13), nullptr);
PolicyMap policy_map;
policy_map.CopyFrom(previous_policy_map);
policy_map.Set("policy", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value"),
nullptr);
std::unique_ptr<PolicyBundle> bundle(new PolicyBundle());
@@ -309,7 +308,7 @@
.CopyFrom(policy_map);
policy_map.Set("policy", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>("another value"), nullptr);
+ std::make_unique<base::Value>("another value"), nullptr);
bundle->Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kExtension1))
.CopyFrom(policy_map);
bundle->Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kExtension2))
@@ -345,10 +344,10 @@
ChangePolicyObserver observer(&provider0_);
policy_service_->AddObserver(POLICY_DOMAIN_CHROME, &observer);
policy0_.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(123),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(123),
nullptr);
policy0_.Set("bbb", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1234),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(1234),
nullptr);
// Should not crash.
provider0_.UpdateChromePolicy(policy0_);
@@ -360,15 +359,15 @@
PolicyMap expected;
expected.Set("pre", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
- base::MakeUnique<base::Value>(13), nullptr);
+ std::make_unique<base::Value>(13), nullptr);
expected.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(0), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(0), nullptr);
policy0_.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(0), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(0), nullptr);
policy1_.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(1), nullptr);
policy2_.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(2), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(2), nullptr);
provider0_.UpdateChromePolicy(policy0_);
provider1_.UpdateChromePolicy(policy1_);
provider2_.UpdateChromePolicy(policy2_);
@@ -376,16 +375,16 @@
PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()), expected));
expected.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(1), nullptr);
policy0_.Erase("aaa");
provider0_.UpdateChromePolicy(policy0_);
EXPECT_TRUE(VerifyPolicies(
PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()), expected));
expected.Set("aaa", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(2), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(2), nullptr);
policy1_.Set("aaa", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(1), nullptr);
provider1_.UpdateChromePolicy(policy1_);
EXPECT_TRUE(VerifyPolicies(
PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()), expected));
@@ -537,11 +536,11 @@
// precedence, on every namespace.
expected.Set(kSameLevelPolicy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_ENTERPRISE_DEFAULT,
- base::MakeUnique<base::Value>("bundle0"), nullptr);
+ std::make_unique<base::Value>("bundle0"), nullptr);
// For policies with different levels and scopes, the highest priority
// level/scope combination takes precedence, on every namespace.
expected.Set(kDiffLevelPolicy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>("bundle2"),
+ POLICY_SOURCE_PLATFORM, std::make_unique<base::Value>("bundle2"),
nullptr);
EXPECT_TRUE(policy_service_->GetPolicies(
PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())).Equals(expected));
@@ -665,22 +664,22 @@
// into a dictionary.
policy_map.Set(key::kProxyServerMode, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(3), nullptr);
+ std::make_unique<base::Value>(3), nullptr);
// Both these policies should be ignored, since there's a higher priority
// policy available.
policy_map.Set(key::kProxyMode, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>("pac_script"), nullptr);
+ std::make_unique<base::Value>("pac_script"), nullptr);
policy_map.Set(key::kProxyPacUrl, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>("http://example.com/wpad.dat"),
+ std::make_unique<base::Value>("http://example.com/wpad.dat"),
nullptr);
// Add a value to a non-Chrome namespace.
policy_bundle->Get(extension_namespace)
.Set(key::kProxyServerMode, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(3), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(3), nullptr);
// The resulting Chrome namespace map should have the collected policy.
PolicyMap expected_chrome;
@@ -695,7 +694,7 @@
PolicyMap expected_extension;
expected_extension.Set(key::kProxyServerMode, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>(3), nullptr);
+ std::make_unique<base::Value>(3), nullptr);
provider0_.UpdatePolicy(std::move(policy_bundle));
RunUntilIdle();
diff --git a/components/policy/core/common/policy_statistics_collector_unittest.cc b/components/policy/core/common/policy_statistics_collector_unittest.cc
index 649058c..05438df 100644
--- a/components/policy/core/common/policy_statistics_collector_unittest.cc
+++ b/components/policy/core/common/policy_statistics_collector_unittest.cc
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
-#include "base/memory/ptr_util.h"
#include "base/test/test_simple_task_runner.h"
#include "base/values.h"
#include "components/policy/core/common/external_data_fetcher.h"
@@ -109,7 +108,7 @@
void SetPolicy(const std::string& name) {
policy_map_.Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true),
nullptr);
}
diff --git a/components/policy/core/common/preg_parser_unittest.cc b/components/policy/core/common/preg_parser_unittest.cc
index c28cd32..1b7c349 100644
--- a/components/policy/core/common/preg_parser_unittest.cc
+++ b/components/policy/core/common/preg_parser_unittest.cc
@@ -104,7 +104,7 @@
RegistryDict dict;
SetInteger(&dict, "DeleteValuesTest1", 1);
SetString(&dict, "DeleteValuesTest2", "2");
- dict.SetKey("DeleteKeysTest1", base::MakeUnique<RegistryDict>());
+ dict.SetKey("DeleteKeysTest1", std::make_unique<RegistryDict>());
std::unique_ptr<RegistryDict> delete_keys_test(new RegistryDict());
SetInteger(delete_keys_test.get(), "DeleteKeysTest2Entry", 1);
dict.SetKey("DeleteKeysTest2", std::move(delete_keys_test));
@@ -112,7 +112,7 @@
std::unique_ptr<RegistryDict> subdict(new RegistryDict());
SetInteger(subdict.get(), "DelValsTest1", 1);
SetString(subdict.get(), "DelValsTest2", "2");
- subdict->SetKey("DelValsTest3", base::MakeUnique<RegistryDict>());
+ subdict->SetKey("DelValsTest3", std::make_unique<RegistryDict>());
dict.SetKey("DelValsTest", std::move(subdict));
// Run the parser.
@@ -124,7 +124,7 @@
// Build the expected output dictionary.
RegistryDict expected;
std::unique_ptr<RegistryDict> del_vals_dict(new RegistryDict());
- del_vals_dict->SetKey("DelValsTest3", base::MakeUnique<RegistryDict>());
+ del_vals_dict->SetKey("DelValsTest3", std::make_unique<RegistryDict>());
expected.SetKey("DelValsTest", std::move(del_vals_dict));
SetInteger(&expected, "HomepageIsNewTabPage", 1);
SetString(&expected, "HomepageLocation", "http://www.example.com");
diff --git a/components/policy/core/common/proxy_policy_provider_unittest.cc b/components/policy/core/common/proxy_policy_provider_unittest.cc
index 1b57eb5..fcd9317 100644
--- a/components/policy/core/common/proxy_policy_provider_unittest.cc
+++ b/components/policy/core/common/proxy_policy_provider_unittest.cc
@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "components/policy/core/common/proxy_policy_provider.h"
+#include <memory>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/core/common/policy_types.h"
-#include "components/policy/core/common/proxy_policy_provider.h"
#include "components/policy/core/common/schema_registry.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -55,7 +55,7 @@
PolicyBundle bundle;
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
.Set("policy", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value"),
nullptr);
mock_provider_.UpdatePolicy(CopyBundle(bundle));
@@ -67,7 +67,7 @@
EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
.Set("policy", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("new value"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("new value"),
nullptr);
mock_provider_.UpdatePolicy(CopyBundle(bundle));
Mock::VerifyAndClearExpectations(&observer_);
diff --git a/components/policy/core/common/registry_dict.cc b/components/policy/core/common/registry_dict.cc
index d2b1d6c..6bff6e4 100644
--- a/components/policy/core/common/registry_dict.cc
+++ b/components/policy/core/common/registry_dict.cc
@@ -7,7 +7,6 @@
#include <utility>
#include "base/json/json_reader.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -76,7 +75,7 @@
int int_value = 0;
switch (schema.type()) {
case base::Value::Type::NONE: {
- return base::MakeUnique<base::Value>();
+ return std::make_unique<base::Value>();
}
case base::Value::Type::BOOLEAN: {
// Accept booleans encoded as either string or integer.
@@ -234,7 +233,7 @@
entry != other.keys_.end(); ++entry) {
std::unique_ptr<RegistryDict>& subdict = keys_[entry->first];
if (!subdict)
- subdict = base::MakeUnique<RegistryDict>();
+ subdict = std::make_unique<RegistryDict>();
subdict->Merge(*entry->second);
}
diff --git a/components/policy/core/common/registry_dict_unittest.cc b/components/policy/core/common/registry_dict_unittest.cc
index 4a54444..1a18bb6 100644
--- a/components/policy/core/common/registry_dict_unittest.cc
+++ b/components/policy/core/common/registry_dict_unittest.cc
@@ -7,7 +7,6 @@
#include <string>
#include <utility>
-#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "components/policy/core/common/schema.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -102,7 +101,7 @@
base::Value int_value(42);
- test_dict.SetKey("One", base::MakeUnique<RegistryDict>());
+ test_dict.SetKey("One", std::make_unique<RegistryDict>());
EXPECT_EQ(1u, test_dict.keys().size());
RegistryDict* actual_subdict = test_dict.GetKey("One");
ASSERT_TRUE(actual_subdict);
@@ -166,7 +165,7 @@
base::Value string_value("fortytwo");
dict_a.SetValue("one", int_value.CreateDeepCopy());
- dict_a.SetKey("two", base::MakeUnique<RegistryDict>());
+ dict_a.SetKey("two", std::make_unique<RegistryDict>());
dict_b.SetValue("three", string_value.CreateDeepCopy());
dict_a.Swap(&dict_b);
@@ -227,20 +226,20 @@
base::DictionaryValue expected;
expected.SetKey("one", int_value.Clone());
- auto expected_subdict = base::MakeUnique<base::DictionaryValue>();
+ auto expected_subdict = std::make_unique<base::DictionaryValue>();
expected_subdict->SetKey("two", string_value.Clone());
expected.Set("three", std::move(expected_subdict));
- auto expected_list = base::MakeUnique<base::ListValue>();
- expected_list->Append(base::MakeUnique<base::Value>(string_value.Clone()));
+ auto expected_list = std::make_unique<base::ListValue>();
+ expected_list->Append(std::make_unique<base::Value>(string_value.Clone()));
expected.Set("dict-to-list", std::move(expected_list));
expected.SetBoolean("int-to-bool", true);
expected.SetDouble("int-to-double", 42.0);
expected.SetBoolean("string-to-bool", false);
expected.SetDouble("string-to-double", 0.0);
expected.SetInteger("string-to-int", static_cast<int>(0));
- expected_list = base::MakeUnique<base::ListValue>();
- expected_list->Append(base::MakeUnique<base::Value>("value"));
- expected_subdict = base::MakeUnique<base::DictionaryValue>();
+ expected_list = std::make_unique<base::ListValue>();
+ expected_list->Append(std::make_unique<base::Value>("value"));
+ expected_subdict = std::make_unique<base::DictionaryValue>();
expected_subdict->Set("key", std::move(expected_list));
expected.Set("string-to-dict", std::move(expected_subdict));
diff --git a/components/policy/core/common/schema_map_unittest.cc b/components/policy/core/common/schema_map_unittest.cc
index b99bc8a..96916e5 100644
--- a/components/policy/core/common/schema_map_unittest.cc
+++ b/components/policy/core/common/schema_map_unittest.cc
@@ -3,8 +3,8 @@
// found in the LICENSE file.
#include "components/policy/core/common/schema_map.h"
+#include <memory>
-#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "components/policy/core/common/external_data_fetcher.h"
@@ -142,14 +142,14 @@
PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, "");
expected_bundle.Get(chrome_ns).Set(
"ChromePolicy", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value"), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value"), nullptr);
bundle.CopyFrom(expected_bundle);
// Unknown components are filtered out.
PolicyNamespace another_extension_ns(POLICY_DOMAIN_EXTENSIONS, "xyz");
bundle.Get(another_extension_ns)
.Set("AnotherExtensionPolicy", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value"),
nullptr);
schema_map->FilterBundle(&bundle);
EXPECT_TRUE(bundle.Equals(expected_bundle));
@@ -162,25 +162,25 @@
map.Set("list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, list.CreateDeepCopy(), nullptr);
map.Set("boolean", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(true), nullptr);
map.Set("integer", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(1), nullptr);
map.Set("null", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(), nullptr);
map.Set("double", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1.2), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(1.2), nullptr);
base::DictionaryValue dict;
dict.SetString("a", "b");
dict.SetInteger("b", 2);
map.Set("object", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, dict.CreateDeepCopy(), nullptr);
map.Set("string", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value"), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value"), nullptr);
bundle.MergeFrom(expected_bundle);
bundle.Get(extension_ns)
.Set("Unexpected", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("to-be-removed"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("to-be-removed"),
nullptr);
schema_map->FilterBundle(&bundle);
@@ -190,25 +190,25 @@
bundle.Clear();
PolicyMap& badmap = bundle.Get(extension_ns);
badmap.Set("list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false),
nullptr);
badmap.Set("boolean", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(0), nullptr);
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(0), nullptr);
badmap.Set("integer", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false),
nullptr);
badmap.Set("null", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false),
nullptr);
badmap.Set("double", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false),
nullptr);
badmap.Set("object", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(false),
nullptr);
badmap.Set("string", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, nullptr,
- base::MakeUnique<ExternalDataFetcher>(nullptr, std::string()));
+ std::make_unique<ExternalDataFetcher>(nullptr, std::string()));
schema_map->FilterBundle(&bundle);
EXPECT_TRUE(bundle.Equals(empty_bundle));
@@ -237,14 +237,14 @@
PolicyNamespace extension_ns(POLICY_DOMAIN_EXTENSIONS, "with-schema");
bundle.Get(extension_ns)
.Set("String", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value 1"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value 1"),
nullptr);
// The Chrome namespace isn't filtered.
PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, "");
bundle.Get(chrome_ns).Set("ChromePolicy", POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>("value 3"), nullptr);
+ std::make_unique<base::Value>("value 3"), nullptr);
PolicyBundle expected_bundle;
expected_bundle.MergeFrom(bundle);
@@ -253,20 +253,20 @@
PolicyNamespace without_schema_ns(POLICY_DOMAIN_EXTENSIONS, "without-schema");
bundle.Get(without_schema_ns)
.Set("Schemaless", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value 2"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value 2"),
nullptr);
// Unknown policies of known components with a schema are removed.
bundle.Get(extension_ns)
.Set("Surprise", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value 4"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value 4"),
nullptr);
// Unknown components are removed.
PolicyNamespace unknown_ns(POLICY_DOMAIN_EXTENSIONS, "unknown");
bundle.Get(unknown_ns)
.Set("Surprise", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value 5"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("value 5"),
nullptr);
schema_map->FilterBundle(&bundle);
diff --git a/components/policy/core/common/schema_registry_tracking_policy_provider_unittest.cc b/components/policy/core/common/schema_registry_tracking_policy_provider_unittest.cc
index fd6668d..5def498 100644
--- a/components/policy/core/common/schema_registry_tracking_policy_provider_unittest.cc
+++ b/components/policy/core/common/schema_registry_tracking_policy_provider_unittest.cc
@@ -8,7 +8,6 @@
#include <string>
#include <utility>
-#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/core/common/policy_bundle.h"
@@ -87,14 +86,14 @@
const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, "");
bundle.Get(chrome_ns).Set("policy", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>("visible"), nullptr);
+ std::make_unique<base::Value>("visible"), nullptr);
EXPECT_CALL(observer_, OnUpdatePolicy(&schema_registry_tracking_provider_));
std::unique_ptr<PolicyBundle> delegate_bundle(new PolicyBundle);
delegate_bundle->CopyFrom(bundle);
delegate_bundle->Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "xyz"))
.Set("foo", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("not visible"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("not visible"),
nullptr);
mock_provider_.UpdatePolicy(std::move(delegate_bundle));
Mock::VerifyAndClearExpectations(&observer_);
@@ -122,7 +121,7 @@
TEST_F(SchemaRegistryTrackingPolicyProviderTest, SchemaReadyWithComponents) {
PolicyMap policy_map;
policy_map.Set("foo", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("omg"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("omg"),
nullptr);
std::unique_ptr<PolicyBundle> bundle(new PolicyBundle);
bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, "")).CopyFrom(policy_map);
@@ -171,7 +170,7 @@
PolicyMap policy_map;
policy_map.Set("foo", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("omg"),
+ POLICY_SOURCE_CLOUD, std::make_unique<base::Value>("omg"),
nullptr);
// Chrome policy updates are visible even if the components aren't ready.
EXPECT_CALL(observer_, OnUpdatePolicy(&schema_registry_tracking_provider_));
@@ -211,7 +210,7 @@
PolicyBundle platform_policy;
platform_policy.Get(ns).Set("foo", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::Value>("omg"), nullptr);
+ std::make_unique<base::Value>("omg"), nullptr);
std::unique_ptr<PolicyBundle> copy(new PolicyBundle);
copy->CopyFrom(platform_policy);
EXPECT_CALL(observer_, OnUpdatePolicy(_));
diff --git a/components/policy/core/common/schema_unittest.cc b/components/policy/core/common/schema_unittest.cc
index 6829de9..4b99223 100644
--- a/components/policy/core/common/schema_unittest.cc
+++ b/components/policy/core/common/schema_unittest.cc
@@ -10,7 +10,6 @@
#include <utility>
#include "base/macros.h"
-#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "components/policy/core/common/schema_internal.h"
@@ -642,7 +641,7 @@
bundle.Clear();
bundle.SetBoolean("Boolean", true);
bundle.SetInteger("Integer", 123);
- bundle.Set("Null", base::MakeUnique<base::Value>());
+ bundle.Set("Null", std::make_unique<base::Value>());
bundle.SetDouble("Number", 3.14);
bundle.SetString("String", "omg");
@@ -805,7 +804,7 @@
base::DictionaryValue root;
base::ListValue* list_value =
- root.SetList("List", base::MakeUnique<base::ListValue>());
+ root.SetList("List", std::make_unique<base::ListValue>());
// Test that there are not errors here.
list_value->AppendInteger(12345);
@@ -831,9 +830,9 @@
ASSERT_TRUE(subschema.valid());
base::ListValue root;
- auto dict_value = base::MakeUnique<base::DictionaryValue>();
+ auto dict_value = std::make_unique<base::DictionaryValue>();
base::ListValue* list_value =
- dict_value->SetList("List", base::MakeUnique<base::ListValue>());
+ dict_value->SetList("List", std::make_unique<base::ListValue>());
root.Append(std::move(dict_value));
// Test that there are not errors here.