| 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 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 virtual void InstallIntegerPolicy(const std::string& policy_name, | 90 virtual void InstallIntegerPolicy(const std::string& policy_name, |
| 91 int policy_value) = 0; | 91 int policy_value) = 0; |
| 92 virtual void InstallBooleanPolicy(const std::string& policy_name, | 92 virtual void InstallBooleanPolicy(const std::string& policy_name, |
| 93 bool policy_value) = 0; | 93 bool policy_value) = 0; |
| 94 virtual void InstallStringListPolicy(const std::string& policy_name, | 94 virtual void InstallStringListPolicy(const std::string& policy_name, |
| 95 const base::ListValue* policy_value) = 0; | 95 const base::ListValue* policy_value) = 0; |
| 96 virtual void InstallDictionaryPolicy( | 96 virtual void InstallDictionaryPolicy( |
| 97 const std::string& policy_name, | 97 const std::string& policy_name, |
| 98 const base::DictionaryValue* policy_value) = 0; | 98 const base::DictionaryValue* policy_value) = 0; |
| 99 | 99 |
| 100 // Not every provider supports installing 3rd party policy. Those who do |
| 101 // should override this method; the default just makes the test fail. |
| 102 virtual void Install3rdPartyPolicy(const base::DictionaryValue* policies); |
| 103 |
| 100 private: | 104 private: |
| 101 PolicyLevel level_; | 105 PolicyLevel level_; |
| 102 PolicyScope scope_; | 106 PolicyScope scope_; |
| 103 | 107 |
| 104 DISALLOW_COPY_AND_ASSIGN(PolicyProviderTestHarness); | 108 DISALLOW_COPY_AND_ASSIGN(PolicyProviderTestHarness); |
| 105 }; | 109 }; |
| 106 | 110 |
| 107 // A factory method for creating a test harness. | 111 // A factory method for creating a test harness. |
| 108 typedef PolicyProviderTestHarness* (*CreatePolicyProviderTestHarness)(); | 112 typedef PolicyProviderTestHarness* (*CreatePolicyProviderTestHarness)(); |
| 109 | 113 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 126 const base::Value& expected_value, | 130 const base::Value& expected_value, |
| 127 base::Closure install_value); | 131 base::Closure install_value); |
| 128 | 132 |
| 129 scoped_ptr<PolicyProviderTestHarness> test_harness_; | 133 scoped_ptr<PolicyProviderTestHarness> test_harness_; |
| 130 scoped_ptr<ConfigurationPolicyProvider> provider_; | 134 scoped_ptr<ConfigurationPolicyProvider> provider_; |
| 131 | 135 |
| 132 private: | 136 private: |
| 133 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderTest); | 137 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderTest); |
| 134 }; | 138 }; |
| 135 | 139 |
| 140 // An extension of ConfigurationPolicyProviderTest that also tests loading of |
| 141 // 3rd party policy. Policy provider implementations that support loading of |
| 142 // 3rd party policy should also instantiate these tests. |
| 143 class Configuration3rdPartyPolicyProviderTest |
| 144 : public ConfigurationPolicyProviderTest { |
| 145 protected: |
| 146 Configuration3rdPartyPolicyProviderTest(); |
| 147 virtual ~Configuration3rdPartyPolicyProviderTest(); |
| 148 |
| 149 private: |
| 150 DISALLOW_COPY_AND_ASSIGN(Configuration3rdPartyPolicyProviderTest); |
| 151 }; |
| 152 |
| 136 } // namespace policy | 153 } // namespace policy |
| 137 | 154 |
| 138 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ | 155 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ |
| OLD | NEW |