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

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

Issue 383263005: Remove more CreateIntegerValue calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/SetBoolean/SetInteger Created 6 years, 5 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 bafa25e2ca57beb33a7347179f7972b6f3d2059f..351e70564df163a99a959af65714d4f06aea1210 100644
--- a/components/policy/core/common/policy_bundle_unittest.cc
+++ b/components/policy/core/common/policy_bundle_unittest.cc
@@ -27,8 +27,11 @@ const char kExtension3[] = "extension-3";
// Adds test policies to |policy|.
void AddTestPolicies(PolicyMap* policy) {
- policy->Set("mandatory-user", POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_USER, base::Value::CreateIntegerValue(123), NULL);
+ policy->Set("mandatory-user",
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(123),
+ NULL);
policy->Set("mandatory-machine", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
base::Value::CreateStringValue("omg"), NULL);
policy->Set("recommended-user", POLICY_LEVEL_RECOMMENDED,
@@ -50,12 +53,18 @@ void AddTestPoliciesWithParams(PolicyMap *policy,
int value,
PolicyLevel level,
PolicyScope scope) {
- policy->Set(kPolicyClashing0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- base::Value::CreateIntegerValue(value), NULL);
- policy->Set(kPolicyClashing1, level, scope,
- base::Value::CreateIntegerValue(value), NULL);
- policy->Set(name, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- base::Value::CreateIntegerValue(value), NULL);
+ policy->Set(kPolicyClashing0,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(value),
+ NULL);
+ policy->Set(
+ kPolicyClashing1, level, scope, new base::FundamentalValue(value), NULL);
+ policy->Set(name,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(value),
+ NULL);
}
// Returns true if |bundle| is empty.
@@ -182,16 +191,31 @@ TEST(PolicyBundleTest, MergeFrom) {
// combination;
// - kPolicyN are merged from each bundle.
PolicyMap expected;
- expected.Set(kPolicyClashing0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- base::Value::CreateIntegerValue(0), NULL);
- expected.Set(kPolicyClashing1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- base::Value::CreateIntegerValue(1), NULL);
- expected.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- base::Value::CreateIntegerValue(0), NULL);
- expected.Set(kPolicy1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- base::Value::CreateIntegerValue(1), NULL);
- expected.Set(kPolicy2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- base::Value::CreateIntegerValue(2), NULL);
+ expected.Set(kPolicyClashing0,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(0),
+ NULL);
+ expected.Set(kPolicyClashing1,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE,
+ new base::FundamentalValue(1),
+ NULL);
+ expected.Set(kPolicy0,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(0),
+ NULL);
+ expected.Set(kPolicy1,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(1),
+ NULL);
+ expected.Set(kPolicy2,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(2),
+ NULL);
EXPECT_TRUE(merged.Get(PolicyNamespace(POLICY_DOMAIN_CHROME,
std::string())).Equals(expected));
EXPECT_TRUE(merged.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS,
@@ -233,7 +257,7 @@ TEST(PolicyBundleTest, Equals) {
.Set(kPolicy0,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_USER,
- base::Value::CreateIntegerValue(123),
+ new base::FundamentalValue(123),
NULL);
EXPECT_FALSE(bundle.Equals(other));
other.CopyFrom(bundle);
@@ -242,7 +266,7 @@ TEST(PolicyBundleTest, Equals) {
.Set(kPolicy0,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
- base::Value::CreateIntegerValue(123),
+ new base::FundamentalValue(123),
NULL);
EXPECT_FALSE(bundle.Equals(other));
@@ -252,8 +276,11 @@ TEST(PolicyBundleTest, Equals) {
PolicyMap& policy_map =
bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
EXPECT_TRUE(bundle.Equals(other));
- policy_map.Set(kPolicy0, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- base::Value::CreateIntegerValue(123), NULL);
+ policy_map.Set(kPolicy0,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER,
+ new base::FundamentalValue(123),
+ NULL);
EXPECT_FALSE(bundle.Equals(other));
}
« no previous file with comments | « components/policy/core/common/mac_util.cc ('k') | components/policy/core/common/policy_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698