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

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

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase 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/policy/core/common/policy_map_unittest.cc
diff --git a/components/policy/core/common/policy_map_unittest.cc b/components/policy/core/common/policy_map_unittest.cc
index 638fa4e39df058f8998ddf29cbd70f014dc4bbaa..5c49dfdcaff5ad2d6b56c652806a6a750047b4df 100644
--- a/components/policy/core/common/policy_map_unittest.cc
+++ b/components/policy/core/common/policy_map_unittest.cc
@@ -59,11 +59,11 @@ std::unique_ptr<ExternalDataFetcher> PolicyMapTest::CreateExternalDataFetcher(
TEST_F(PolicyMapTest, SetAndGet) {
PolicyMap map;
- SetPolicy(&map, kTestPolicyName1, base::MakeUnique<base::StringValue>("aaa"));
- base::StringValue expected("aaa");
+ SetPolicy(&map, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
+ base::Value expected("aaa");
EXPECT_TRUE(expected.Equals(map.GetValue(kTestPolicyName1)));
- SetPolicy(&map, kTestPolicyName1, base::MakeUnique<base::StringValue>("bbb"));
- base::StringValue expected_b("bbb");
+ SetPolicy(&map, kTestPolicyName1, base::MakeUnique<base::Value>("bbb"));
+ base::Value expected_b("bbb");
EXPECT_TRUE(expected_b.Equals(map.GetValue(kTestPolicyName1)));
SetPolicy(&map, kTestPolicyName1, CreateExternalDataFetcher("dummy"));
EXPECT_FALSE(map.GetValue(kTestPolicyName1));
@@ -88,13 +88,13 @@ TEST_F(PolicyMapTest, SetAndGet) {
TEST_F(PolicyMapTest, Equals) {
PolicyMap a;
- SetPolicy(&a, kTestPolicyName1, base::MakeUnique<base::StringValue>("aaa"));
+ SetPolicy(&a, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
PolicyMap a2;
- SetPolicy(&a2, kTestPolicyName1, base::MakeUnique<base::StringValue>("aaa"));
+ SetPolicy(&a2, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
PolicyMap b;
- SetPolicy(&b, kTestPolicyName1, base::MakeUnique<base::StringValue>("bbb"));
+ SetPolicy(&b, kTestPolicyName1, base::MakeUnique<base::Value>("bbb"));
PolicyMap c;
- SetPolicy(&c, kTestPolicyName1, base::MakeUnique<base::StringValue>("aaa"));
+ SetPolicy(&c, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
SetPolicy(&c, kTestPolicyName2, base::MakeUnique<base::Value>(true));
PolicyMap d;
SetPolicy(&d, kTestPolicyName1, CreateExternalDataFetcher("ddd"));
@@ -136,20 +136,20 @@ TEST_F(PolicyMapTest, Equals) {
TEST_F(PolicyMapTest, Swap) {
PolicyMap a;
- SetPolicy(&a, kTestPolicyName1, base::MakeUnique<base::StringValue>("aaa"));
+ SetPolicy(&a, kTestPolicyName1, base::MakeUnique<base::Value>("aaa"));
SetPolicy(&a, kTestPolicyName2, CreateExternalDataFetcher("dummy"));
PolicyMap b;
- SetPolicy(&b, kTestPolicyName1, base::MakeUnique<base::StringValue>("bbb"));
+ SetPolicy(&b, kTestPolicyName1, base::MakeUnique<base::Value>("bbb"));
SetPolicy(&b, kTestPolicyName3, base::MakeUnique<base::Value>(true));
a.Swap(&b);
- base::StringValue expected("bbb");
+ base::Value expected("bbb");
EXPECT_TRUE(expected.Equals(a.GetValue(kTestPolicyName1)));
base::Value expected_bool(true);
EXPECT_TRUE(expected_bool.Equals(a.GetValue(kTestPolicyName3)));
EXPECT_FALSE(a.GetValue(kTestPolicyName2));
EXPECT_FALSE(a.Get(kTestPolicyName2));
- base::StringValue expected_a("aaa");
+ base::Value expected_a("aaa");
EXPECT_TRUE(expected_a.Equals(b.GetValue(kTestPolicyName1)));
EXPECT_FALSE(b.GetValue(kTestPolicyName3));
EXPECT_FALSE(a.GetValue(kTestPolicyName2));
@@ -169,7 +169,7 @@ TEST_F(PolicyMapTest, Swap) {
TEST_F(PolicyMapTest, MergeFrom) {
PolicyMap a;
a.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("google.com"),
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
nullptr);
a.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
@@ -179,16 +179,16 @@ TEST_F(PolicyMapTest, MergeFrom) {
a.Set(kTestPolicyName4, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
a.Set(kTestPolicyName5, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::StringValue>("google.com/q={x}"), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<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),
nullptr);
PolicyMap b;
b.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::StringValue>("chromium.org"), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("chromium.org"),
+ nullptr);
b.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
b.Set(kTestPolicyName3, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
@@ -198,8 +198,8 @@ TEST_F(PolicyMapTest, MergeFrom) {
POLICY_SOURCE_PUBLIC_SESSION_OVERRIDE,
base::MakeUnique<base::Value>(true), nullptr);
b.Set(kTestPolicyName5, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_PLATFORM,
- base::MakeUnique<base::StringValue>(std::string()), nullptr);
+ POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(std::string()),
+ nullptr);
b.Set(kTestPolicyName6, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
b.Set(kTestPolicyName7, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
@@ -211,8 +211,8 @@ TEST_F(PolicyMapTest, MergeFrom) {
PolicyMap c;
// POLICY_SCOPE_MACHINE over POLICY_SCOPE_USER.
c.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::StringValue>("chromium.org"), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<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);
@@ -225,8 +225,8 @@ TEST_F(PolicyMapTest, MergeFrom) {
base::MakeUnique<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::StringValue>(std::string()), nullptr);
+ POLICY_SOURCE_PLATFORM, base::MakeUnique<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);
@@ -241,7 +241,7 @@ TEST_F(PolicyMapTest, MergeFrom) {
TEST_F(PolicyMapTest, GetDifferingKeys) {
PolicyMap a;
a.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("google.com"),
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
nullptr);
a.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, nullptr, CreateExternalDataFetcher("dummy"));
@@ -252,14 +252,14 @@ TEST_F(PolicyMapTest, GetDifferingKeys) {
a.Set(kTestPolicyName5, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
a.Set(kTestPolicyName6, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE,
- POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::StringValue>("google.com/q={x}"), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<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);
PolicyMap b;
b.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("google.com"),
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
nullptr);
b.Set(kTestPolicyName2, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, nullptr, CreateExternalDataFetcher("dummy"));
@@ -270,8 +270,8 @@ TEST_F(PolicyMapTest, GetDifferingKeys) {
b.Set(kTestPolicyName5, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(false), nullptr);
b.Set(kTestPolicyName6, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD,
- base::MakeUnique<base::StringValue>("google.com/q={x}"), nullptr);
+ POLICY_SOURCE_CLOUD, base::MakeUnique<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);
@@ -315,7 +315,7 @@ TEST_F(PolicyMapTest, LoadFromSetsLevelScopeAndSource) {
PolicyMap expected;
expected.Set("TestPolicy1", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_PLATFORM,
- base::MakeUnique<base::StringValue>("google.com"), nullptr);
+ base::MakeUnique<base::Value>("google.com"), nullptr);
expected.Set("TestPolicy2", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
POLICY_SOURCE_PLATFORM, base::MakeUnique<base::Value>(true),
nullptr);
@@ -332,7 +332,7 @@ bool IsMandatory(const PolicyMap::PolicyMapType::const_iterator iter) {
TEST_F(PolicyMapTest, EraseNonmatching) {
PolicyMap a;
a.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("google.com"),
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
nullptr);
a.Set(kTestPolicyName2, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_MACHINE,
POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
@@ -341,7 +341,7 @@ TEST_F(PolicyMapTest, EraseNonmatching) {
PolicyMap b;
b.Set(kTestPolicyName1, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
- POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("google.com"),
+ POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("google.com"),
nullptr);
EXPECT_TRUE(a.Equals(b));
}

Powered by Google App Engine
This is Rietveld 408576698