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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 case base::Value::Type::LIST: { | 120 case base::Value::Type::LIST: { |
121 const base::ListValue* list; | 121 const base::ListValue* list; |
122 if (value.GetAsList(&list)) { | 122 if (value.GetAsList(&list)) { |
123 CFMutableArrayRef array = | 123 CFMutableArrayRef array = |
124 CFArrayCreateMutable(NULL, list->GetSize(), &kCFTypeArrayCallBacks); | 124 CFArrayCreateMutable(NULL, list->GetSize(), &kCFTypeArrayCallBacks); |
125 for (const auto& entry : *list) { | 125 for (const auto& entry : *list) { |
126 // CFArrayAppendValue() retains |cf_value|, so make sure the reference | 126 // CFArrayAppendValue() retains |cf_value|, so make sure the reference |
127 // created by ValueToProperty() is released. | 127 // created by ValueToProperty() is released. |
128 base::ScopedCFTypeRef<CFPropertyListRef> cf_value( | 128 base::ScopedCFTypeRef<CFPropertyListRef> cf_value( |
129 ValueToProperty(*entry)); | 129 ValueToProperty(entry)); |
130 if (cf_value) | 130 if (cf_value) |
131 CFArrayAppendValue(array, cf_value); | 131 CFArrayAppendValue(array, cf_value); |
132 } | 132 } |
133 return array; | 133 return array; |
134 } | 134 } |
135 break; | 135 break; |
136 } | 136 } |
137 | 137 |
138 case base::Value::Type::BINARY: | 138 case base::Value::Type::BINARY: |
139 // This type isn't converted (though it can be represented as CFData) | 139 // This type isn't converted (though it can be represented as CFData) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 << " \"scope\": " << e.scope << "," << std::endl | 233 << " \"scope\": " << e.scope << "," << std::endl |
234 << " \"value\": " << value | 234 << " \"value\": " << value |
235 << "}"; | 235 << "}"; |
236 return os; | 236 return os; |
237 } | 237 } |
238 | 238 |
239 std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns) { | 239 std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns) { |
240 os << ns.domain << "/" << ns.component_id; | 240 os << ns.domain << "/" << ns.component_id; |
241 return os; | 241 return os; |
242 } | 242 } |
OLD | NEW |