OLD | NEW |
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/policy_test_utils.h" | 5 #include "components/policy/core/common/policy_test_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 PolicyDetailsMapping::const_iterator it = map_.find(policy); | 41 PolicyDetailsMapping::const_iterator it = map_.find(policy); |
42 return it == map_.end() ? NULL : it->second; | 42 return it == map_.end() ? NULL : it->second; |
43 } | 43 } |
44 | 44 |
45 bool PolicyServiceIsEmpty(const PolicyService* service) { | 45 bool PolicyServiceIsEmpty(const PolicyService* service) { |
46 const PolicyMap& map = service->GetPolicies( | 46 const PolicyMap& map = service->GetPolicies( |
47 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | 47 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
48 if (!map.empty()) { | 48 if (!map.empty()) { |
49 base::DictionaryValue dict; | 49 base::DictionaryValue dict; |
50 for (PolicyMap::const_iterator it = map.begin(); it != map.end(); ++it) | 50 for (PolicyMap::const_iterator it = map.begin(); it != map.end(); ++it) |
51 dict.SetWithoutPathExpansion(it->first, it->second.value->DeepCopy()); | 51 dict.SetWithoutPathExpansion(it->first, |
| 52 it->second.value->CreateDeepCopy()); |
52 LOG(WARNING) << "There are pre-existing policies in this machine: " << dict; | 53 LOG(WARNING) << "There are pre-existing policies in this machine: " << dict; |
53 } | 54 } |
54 return map.empty(); | 55 return map.empty(); |
55 } | 56 } |
56 | 57 |
57 #if defined(OS_IOS) || defined(OS_MACOSX) | 58 #if defined(OS_IOS) || defined(OS_MACOSX) |
58 CFPropertyListRef ValueToProperty(const base::Value& value) { | 59 CFPropertyListRef ValueToProperty(const base::Value& value) { |
59 switch (value.GetType()) { | 60 switch (value.GetType()) { |
60 case base::Value::Type::NONE: | 61 case base::Value::Type::NONE: |
61 return kCFNull; | 62 return kCFNull; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 << " \"scope\": " << e.scope << "," << std::endl | 234 << " \"scope\": " << e.scope << "," << std::endl |
234 << " \"value\": " << value | 235 << " \"value\": " << value |
235 << "}"; | 236 << "}"; |
236 return os; | 237 return os; |
237 } | 238 } |
238 | 239 |
239 std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns) { | 240 std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns) { |
240 os << ns.domain << "/" << ns.component_id; | 241 os << ns.domain << "/" << ns.component_id; |
241 return os; | 242 return os; |
242 } | 243 } |
OLD | NEW |