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

Unified Diff: components/policy/core/common/policy_bundle_unittest.cc

Issue 2252353002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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/policy/core/common/policy_bundle_unittest.cc
diff --git a/components/policy/core/common/policy_bundle_unittest.cc b/components/policy/core/common/policy_bundle_unittest.cc
index 3d4e2808820cdc40121267c91d48d88393cfc5dd..4cf59f60681dfd09d00354516e21973ede482be3 100644
--- a/components/policy/core/common/policy_bundle_unittest.cc
+++ b/components/policy/core/common/policy_bundle_unittest.cc
@@ -33,13 +33,13 @@ const char kExtension3[] = "extension-3";
void AddTestPolicies(PolicyMap* policy) {
policy->Set("mandatory-user", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(123)), nullptr);
+ base::MakeUnique<base::FundamentalValue>(123), nullptr);
policy->Set("mandatory-machine", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::StringValue("omg")), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("omg"),
+ nullptr);
policy->Set("recommended-user", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(true)), nullptr);
+ base::MakeUnique<base::FundamentalValue>(true), nullptr);
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetBoolean("false", false);
dict->SetInteger("int", 456);
@@ -60,12 +60,12 @@ void AddTestPoliciesWithParams(PolicyMap *policy,
PolicyScope scope) {
policy->Set(kPolicyClashing0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(value)), nullptr);
+ base::MakeUnique<base::FundamentalValue>(value), nullptr);
policy->Set(kPolicyClashing1, level, scope, POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(value)), nullptr);
+ base::MakeUnique<base::FundamentalValue>(value), nullptr);
policy->Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(value)), nullptr);
+ base::MakeUnique<base::FundamentalValue>(value), nullptr);
}
// Returns true if |bundle| is empty.
@@ -193,20 +193,20 @@ TEST(PolicyBundleTest, MergeFrom) {
// - kPolicyN are merged from each bundle.
PolicyMap expected;
expected.Set(kPolicyClashing0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(0)), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(0),
+ nullptr);
expected.Set(kPolicyClashing1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(1)), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(1),
+ nullptr);
expected.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(0)), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(0),
+ nullptr);
expected.Set(kPolicy1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(1)), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(1),
+ nullptr);
expected.Set(kPolicy2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(2)), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(2),
+ nullptr);
EXPECT_TRUE(merged.Get(PolicyNamespace(POLICY_DOMAIN_CHROME,
std::string())).Equals(expected));
EXPECT_TRUE(merged.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS,
@@ -246,15 +246,15 @@ TEST(PolicyBundleTest, Equals) {
other.CopyFrom(bundle);
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))
.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(123)), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(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::WrapUnique(new base::FundamentalValue(123)), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::FundamentalValue>(123),
+ nullptr);
EXPECT_FALSE(bundle.Equals(other));
// Test non-const Get().
@@ -265,7 +265,7 @@ TEST(PolicyBundleTest, Equals) {
EXPECT_TRUE(bundle.Equals(other));
policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD,
- base::WrapUnique(new base::FundamentalValue(123)), nullptr);
+ base::MakeUnique<base::FundamentalValue>(123), nullptr);
EXPECT_FALSE(bundle.Equals(other));
}

Powered by Google App Engine
This is Rietveld 408576698