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

Side by Side Diff: components/policy/core/common/schema_map_unittest.cc

Issue 2792573002: Remove base::Value::CreateNullValue (Closed)
Patch Set: Rebase Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/policy/core/common/schema_map.h" 5 #include "components/policy/core/common/schema_map.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "components/policy/core/common/external_data_fetcher.h" 10 #include "components/policy/core/common/external_data_fetcher.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 base::ListValue list; 159 base::ListValue list;
160 list.AppendString("a"); 160 list.AppendString("a");
161 list.AppendString("b"); 161 list.AppendString("b");
162 map.Set("list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 162 map.Set("list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
163 POLICY_SOURCE_CLOUD, list.CreateDeepCopy(), nullptr); 163 POLICY_SOURCE_CLOUD, list.CreateDeepCopy(), nullptr);
164 map.Set("boolean", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 164 map.Set("boolean", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
165 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr); 165 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(true), nullptr);
166 map.Set("integer", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 166 map.Set("integer", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
167 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1), nullptr); 167 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1), nullptr);
168 map.Set("null", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 168 map.Set("null", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
169 POLICY_SOURCE_CLOUD, base::Value::CreateNullValue(), nullptr); 169 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(), nullptr);
170 map.Set("double", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 170 map.Set("double", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
171 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1.2), nullptr); 171 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>(1.2), nullptr);
172 base::DictionaryValue dict; 172 base::DictionaryValue dict;
173 dict.SetString("a", "b"); 173 dict.SetString("a", "b");
174 dict.SetInteger("b", 2); 174 dict.SetInteger("b", 2);
175 map.Set("object", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 175 map.Set("object", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
176 POLICY_SOURCE_CLOUD, dict.CreateDeepCopy(), nullptr); 176 POLICY_SOURCE_CLOUD, dict.CreateDeepCopy(), nullptr);
177 map.Set("string", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, 177 map.Set("string", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
178 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value"), nullptr); 178 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("value"), nullptr);
179 179
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 newer = new SchemaMap(map); 299 newer = new SchemaMap(map);
300 newer->GetChanges(older, &removed, &added); 300 newer->GetChanges(older, &removed, &added);
301 ASSERT_EQ(2u, removed.size()); 301 ASSERT_EQ(2u, removed.size());
302 EXPECT_EQ(PolicyNamespace(POLICY_DOMAIN_CHROME, ""), removed[0]); 302 EXPECT_EQ(PolicyNamespace(POLICY_DOMAIN_CHROME, ""), removed[0]);
303 EXPECT_EQ(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "xyz"), removed[1]); 303 EXPECT_EQ(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "xyz"), removed[1]);
304 ASSERT_EQ(1u, added.size()); 304 ASSERT_EQ(1u, added.size());
305 EXPECT_EQ(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "abc"), added[0]); 305 EXPECT_EQ(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "abc"), added[0]);
306 } 306 }
307 307
308 } // namespace policy 308 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/registry_dict.cc ('k') | components/policy/core/common/schema_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698