| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "chrome/browser/policy/policy_types.h" | 15 #include "chrome/browser/policy/policy_types.h" |
| 16 #include "chrome/browser/policy/schema_registry.h" | 16 #include "chrome/browser/policy/schema_registry.h" |
| 17 #include "components/policy/core/common/schema.h" | 17 #include "components/policy/core/common/schema.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class DictionaryValue; | 21 class DictionaryValue; |
| 22 class ListValue; | 22 class ListValue; |
| 23 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
| 24 class Value; | 24 class Value; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace policy { | 27 namespace policy { |
| 28 | 28 |
| 29 class ConfigurationPolicyProvider; | 29 class ConfigurationPolicyProvider; |
| 30 struct PolicyDefinitionList; | |
| 31 | 30 |
| 32 // A stripped-down policy definition list that contains entries for the | 31 namespace test_keys { |
| 33 // different policy setting types supported. | |
| 34 namespace test_policy_definitions { | |
| 35 | 32 |
| 36 // String policy keys. | |
| 37 extern const char kKeyString[]; | 33 extern const char kKeyString[]; |
| 38 extern const char kKeyBoolean[]; | 34 extern const char kKeyBoolean[]; |
| 39 extern const char kKeyInteger[]; | 35 extern const char kKeyInteger[]; |
| 40 extern const char kKeyStringList[]; | 36 extern const char kKeyStringList[]; |
| 41 extern const char kKeyDictionary[]; | 37 extern const char kKeyDictionary[]; |
| 42 | 38 |
| 43 // Policy definition list that contains entries for the keys above. | 39 } // namespace test_keys |
| 44 extern const PolicyDefinitionList kList; | |
| 45 | |
| 46 } // namespace test_policy_definitions | |
| 47 | 40 |
| 48 class PolicyTestBase : public testing::Test { | 41 class PolicyTestBase : public testing::Test { |
| 49 public: | 42 public: |
| 50 PolicyTestBase(); | 43 PolicyTestBase(); |
| 51 virtual ~PolicyTestBase(); | 44 virtual ~PolicyTestBase(); |
| 52 | 45 |
| 53 // testing::Test: | 46 // testing::Test: |
| 54 virtual void SetUp() OVERRIDE; | 47 virtual void SetUp() OVERRIDE; |
| 55 virtual void TearDown() OVERRIDE; | 48 virtual void TearDown() OVERRIDE; |
| 56 | 49 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 74 // the providers from CreateProvider(). | 67 // the providers from CreateProvider(). |
| 75 PolicyProviderTestHarness(PolicyLevel level, PolicyScope scope); | 68 PolicyProviderTestHarness(PolicyLevel level, PolicyScope scope); |
| 76 virtual ~PolicyProviderTestHarness(); | 69 virtual ~PolicyProviderTestHarness(); |
| 77 | 70 |
| 78 // Actions to run at gtest SetUp() time. | 71 // Actions to run at gtest SetUp() time. |
| 79 virtual void SetUp() = 0; | 72 virtual void SetUp() = 0; |
| 80 | 73 |
| 81 // Create a new policy provider. | 74 // Create a new policy provider. |
| 82 virtual ConfigurationPolicyProvider* CreateProvider( | 75 virtual ConfigurationPolicyProvider* CreateProvider( |
| 83 SchemaRegistry* registry, | 76 SchemaRegistry* registry, |
| 84 scoped_refptr<base::SequencedTaskRunner> task_runner, | 77 scoped_refptr<base::SequencedTaskRunner> task_runner) = 0; |
| 85 const PolicyDefinitionList* policy_definition_list) = 0; | |
| 86 | 78 |
| 87 // Returns the policy level and scope set by the policy provider. | 79 // Returns the policy level and scope set by the policy provider. |
| 88 PolicyLevel policy_level() const; | 80 PolicyLevel policy_level() const; |
| 89 PolicyScope policy_scope() const; | 81 PolicyScope policy_scope() const; |
| 90 | 82 |
| 91 // Helpers to configure the environment the policy provider reads from. | 83 // Helpers to configure the environment the policy provider reads from. |
| 92 virtual void InstallEmptyPolicy() = 0; | 84 virtual void InstallEmptyPolicy() = 0; |
| 93 virtual void InstallStringPolicy(const std::string& policy_name, | 85 virtual void InstallStringPolicy(const std::string& policy_name, |
| 94 const std::string& policy_value) = 0; | 86 const std::string& policy_value) = 0; |
| 95 virtual void InstallIntegerPolicy(const std::string& policy_name, | 87 virtual void InstallIntegerPolicy(const std::string& policy_name, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 Configuration3rdPartyPolicyProviderTest(); | 143 Configuration3rdPartyPolicyProviderTest(); |
| 152 virtual ~Configuration3rdPartyPolicyProviderTest(); | 144 virtual ~Configuration3rdPartyPolicyProviderTest(); |
| 153 | 145 |
| 154 private: | 146 private: |
| 155 DISALLOW_COPY_AND_ASSIGN(Configuration3rdPartyPolicyProviderTest); | 147 DISALLOW_COPY_AND_ASSIGN(Configuration3rdPartyPolicyProviderTest); |
| 156 }; | 148 }; |
| 157 | 149 |
| 158 } // namespace policy | 150 } // namespace policy |
| 159 | 151 |
| 160 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ | 152 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_TEST_H_ |
| OLD | NEW |