OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_loader_mac.h" | 5 #include "components/policy/core/common/policy_loader_mac.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 bool policy_value) { | 101 bool policy_value) { |
102 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); | 102 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); |
103 prefs_->AddTestItem(name, | 103 prefs_->AddTestItem(name, |
104 policy_value ? kCFBooleanTrue : kCFBooleanFalse, | 104 policy_value ? kCFBooleanTrue : kCFBooleanFalse, |
105 true); | 105 true); |
106 } | 106 } |
107 | 107 |
108 void TestHarness::InstallStringListPolicy(const std::string& policy_name, | 108 void TestHarness::InstallStringListPolicy(const std::string& policy_name, |
109 const base::ListValue* policy_value) { | 109 const base::ListValue* policy_value) { |
110 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); | 110 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); |
111 ScopedCFTypeRef<CFPropertyListRef> array(ValueToProperty(policy_value)); | 111 ScopedCFTypeRef<CFPropertyListRef> array(ValueToProperty(*policy_value)); |
112 ASSERT_TRUE(array); | 112 ASSERT_TRUE(array); |
113 prefs_->AddTestItem(name, array, true); | 113 prefs_->AddTestItem(name, array, true); |
114 } | 114 } |
115 | 115 |
116 void TestHarness::InstallDictionaryPolicy( | 116 void TestHarness::InstallDictionaryPolicy( |
117 const std::string& policy_name, | 117 const std::string& policy_name, |
118 const base::DictionaryValue* policy_value) { | 118 const base::DictionaryValue* policy_value) { |
119 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); | 119 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); |
120 ScopedCFTypeRef<CFPropertyListRef> dict(ValueToProperty(policy_value)); | 120 ScopedCFTypeRef<CFPropertyListRef> dict(ValueToProperty(*policy_value)); |
121 ASSERT_TRUE(dict); | 121 ASSERT_TRUE(dict); |
122 prefs_->AddTestItem(name, dict, true); | 122 prefs_->AddTestItem(name, dict, true); |
123 } | 123 } |
124 | 124 |
125 // static | 125 // static |
126 PolicyProviderTestHarness* TestHarness::Create() { | 126 PolicyProviderTestHarness* TestHarness::Create() { |
127 return new TestHarness(); | 127 return new TestHarness(); |
128 } | 128 } |
129 | 129 |
130 } // namespace | 130 } // namespace |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 loop_.RunUntilIdle(); | 194 loop_.RunUntilIdle(); |
195 PolicyBundle expected_bundle; | 195 PolicyBundle expected_bundle; |
196 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 196 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
197 .Set(test_keys::kKeyString, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, | 197 .Set(test_keys::kKeyString, POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, |
198 POLICY_SOURCE_PLATFORM, | 198 POLICY_SOURCE_PLATFORM, |
199 base::WrapUnique(new base::StringValue("string value")), nullptr); | 199 base::WrapUnique(new base::StringValue("string value")), nullptr); |
200 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); | 200 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); |
201 } | 201 } |
202 | 202 |
203 } // namespace policy | 203 } // namespace policy |
OLD | NEW |