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

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

Issue 1825173003: [Policy Experimental] Add "recommended" policies for URL exceptions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 4 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/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 29 matching lines...) Expand all
40 const PolicyDetails* PolicyDetailsMap::Lookup(const std::string& policy) const { 40 const PolicyDetails* PolicyDetailsMap::Lookup(const std::string& policy) const {
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();
51 dict.SetWithoutPathExpansion(it->first, it->second.value->DeepCopy()); 51 map.next_dominant(&it)) {
52 dict.SetWithoutPathExpansion(it->first.name,
53 it->second.value->DeepCopy());
54 }
52 LOG(WARNING) << "There are pre-existing policies in this machine: " << dict; 55 LOG(WARNING) << "There are pre-existing policies in this machine: " << dict;
53 } 56 }
54 return map.empty(); 57 return map.empty();
55 } 58 }
56 59
57 #if defined(OS_IOS) || defined(OS_MACOSX) 60 #if defined(OS_IOS) || defined(OS_MACOSX)
58 CFPropertyListRef ValueToProperty(const base::Value* value) { 61 CFPropertyListRef ValueToProperty(const base::Value* value) {
59 switch (value->GetType()) { 62 switch (value->GetType()) {
60 case base::Value::TYPE_NULL: 63 case base::Value::TYPE_NULL:
61 return kCFNull; 64 return kCFNull;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 << " \"scope\": " << e.scope << "," << std::endl 233 << " \"scope\": " << e.scope << "," << std::endl
231 << " \"value\": " << value 234 << " \"value\": " << value
232 << "}"; 235 << "}";
233 return os; 236 return os;
234 } 237 }
235 238
236 std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns) { 239 std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns) {
237 os << ns.domain << "/" << ns.component_id; 240 os << ns.domain << "/" << ns.component_id;
238 return os; 241 return os;
239 } 242 }
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_map.cc ('k') | components/policy/core/common/policy_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698