| 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 <CoreFoundation/CoreFoundation.h> | 5 #include <CoreFoundation/CoreFoundation.h> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 return NULL; | 116 return NULL; |
| 117 } | 117 } |
| 118 | 118 |
| 119 class TestHarness : public PolicyProviderTestHarness { | 119 class TestHarness : public PolicyProviderTestHarness { |
| 120 public: | 120 public: |
| 121 TestHarness(); | 121 TestHarness(); |
| 122 virtual ~TestHarness(); | 122 virtual ~TestHarness(); |
| 123 | 123 |
| 124 virtual void SetUp() OVERRIDE; | 124 virtual void SetUp() OVERRIDE; |
| 125 | 125 |
| 126 virtual AsynchronousPolicyProvider* CreateProvider( | 126 virtual ConfigurationPolicyProvider* CreateProvider( |
| 127 const PolicyDefinitionList* policy_definition_list) OVERRIDE; | 127 const PolicyDefinitionList* policy_definition_list) OVERRIDE; |
| 128 | 128 |
| 129 virtual void InstallEmptyPolicy() OVERRIDE; | 129 virtual void InstallEmptyPolicy() OVERRIDE; |
| 130 virtual void InstallStringPolicy(const std::string& policy_name, | 130 virtual void InstallStringPolicy(const std::string& policy_name, |
| 131 const std::string& policy_value) OVERRIDE; | 131 const std::string& policy_value) OVERRIDE; |
| 132 virtual void InstallIntegerPolicy(const std::string& policy_name, | 132 virtual void InstallIntegerPolicy(const std::string& policy_name, |
| 133 int policy_value) OVERRIDE; | 133 int policy_value) OVERRIDE; |
| 134 virtual void InstallBooleanPolicy(const std::string& policy_name, | 134 virtual void InstallBooleanPolicy(const std::string& policy_name, |
| 135 bool policy_value) OVERRIDE; | 135 bool policy_value) OVERRIDE; |
| 136 virtual void InstallStringListPolicy( | 136 virtual void InstallStringListPolicy( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 148 DISALLOW_COPY_AND_ASSIGN(TestHarness); | 148 DISALLOW_COPY_AND_ASSIGN(TestHarness); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 TestHarness::TestHarness() | 151 TestHarness::TestHarness() |
| 152 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER) {} | 152 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER) {} |
| 153 | 153 |
| 154 TestHarness::~TestHarness() {} | 154 TestHarness::~TestHarness() {} |
| 155 | 155 |
| 156 void TestHarness::SetUp() {} | 156 void TestHarness::SetUp() {} |
| 157 | 157 |
| 158 AsynchronousPolicyProvider* TestHarness::CreateProvider( | 158 ConfigurationPolicyProvider* TestHarness::CreateProvider( |
| 159 const PolicyDefinitionList* policy_definition_list) { | 159 const PolicyDefinitionList* policy_definition_list) { |
| 160 prefs_ = new MockPreferences(); | 160 prefs_ = new MockPreferences(); |
| 161 return new ConfigurationPolicyProviderMac(policy_definition_list, prefs_); | 161 return new ConfigurationPolicyProviderMac(policy_definition_list, prefs_); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void TestHarness::InstallEmptyPolicy() {} | 164 void TestHarness::InstallEmptyPolicy() {} |
| 165 | 165 |
| 166 void TestHarness::InstallStringPolicy(const std::string& policy_name, | 166 void TestHarness::InstallStringPolicy(const std::string& policy_name, |
| 167 const std::string& policy_value) { | 167 const std::string& policy_value) { |
| 168 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); | 168 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 ScopedCFTypeRef<CFPropertyListRef> property(CreatePropertyFromValue(&root)); | 307 ScopedCFTypeRef<CFPropertyListRef> property(CreatePropertyFromValue(&root)); |
| 308 ASSERT_TRUE(property); | 308 ASSERT_TRUE(property); |
| 309 scoped_ptr<base::Value> value( | 309 scoped_ptr<base::Value> value( |
| 310 MacPreferencesPolicyProviderDelegate::CreateValueFromProperty(property)); | 310 MacPreferencesPolicyProviderDelegate::CreateValueFromProperty(property)); |
| 311 ASSERT_TRUE(value.get()); | 311 ASSERT_TRUE(value.get()); |
| 312 | 312 |
| 313 EXPECT_TRUE(root.Equals(value.get())); | 313 EXPECT_TRUE(root.Equals(value.get())); |
| 314 } | 314 } |
| 315 | 315 |
| 316 } // namespace policy | 316 } // namespace policy |
| OLD | NEW |