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

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

Issue 1940153002: Use std::unique_ptr to express ownership of base::Value in PolicyMap::Entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another-fix Created 4 years, 7 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 <cstring> 5 #include <cstring>
6 #include <memory> 6 #include <memory>
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/ptr_util.h"
9 #include "base/values.h" 10 #include "base/values.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 #include "components/policy/core/common/policy_details.h" 12 #include "components/policy/core/common/policy_details.h"
12 #include "components/policy/core/common/schema.h" 13 #include "components/policy/core/common/schema.h"
13 #include "policy/policy_constants.h" 14 #include "policy/policy_constants.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 // This unittest tests the code generated by 17 // This unittest tests the code generated by
17 // chrome/tools/build/generate_policy_source.py. 18 // chrome/tools/build/generate_policy_source.py.
18 19
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 211
211 // If policy not configured yet, set the enterprise default. 212 // If policy not configured yet, set the enterprise default.
212 SetEnterpriseUsersDefaults(&policy_map); 213 SetEnterpriseUsersDefaults(&policy_map);
213 214
214 const base::Value* multiprof_behavior = 215 const base::Value* multiprof_behavior =
215 policy_map.GetValue(key::kChromeOsMultiProfileUserBehavior); 216 policy_map.GetValue(key::kChromeOsMultiProfileUserBehavior);
216 base::StringValue expected("primary-only"); 217 base::StringValue expected("primary-only");
217 EXPECT_TRUE(expected.Equals(multiprof_behavior)); 218 EXPECT_TRUE(expected.Equals(multiprof_behavior));
218 219
219 // If policy already configured, it's not changed to enterprise defaults. 220 // If policy already configured, it's not changed to enterprise defaults.
220 policy_map.Set(key::kChromeOsMultiProfileUserBehavior, 221 policy_map.Set(key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY,
221 POLICY_LEVEL_MANDATORY, 222 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
222 POLICY_SCOPE_USER, 223 base::WrapUnique(new base::StringValue("test_value")),
223 POLICY_SOURCE_CLOUD, 224 nullptr);
224 new base::StringValue("test_value"),
225 NULL);
226 SetEnterpriseUsersDefaults(&policy_map); 225 SetEnterpriseUsersDefaults(&policy_map);
227 multiprof_behavior = 226 multiprof_behavior =
228 policy_map.GetValue(key::kChromeOsMultiProfileUserBehavior); 227 policy_map.GetValue(key::kChromeOsMultiProfileUserBehavior);
229 expected = base::StringValue("test_value"); 228 expected = base::StringValue("test_value");
230 EXPECT_TRUE(expected.Equals(multiprof_behavior)); 229 EXPECT_TRUE(expected.Equals(multiprof_behavior));
231 } 230 }
232 #endif 231 #endif
233 232
234 } // namespace policy 233 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698