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

Side by Side Diff: components/policy/core/common/configuration_policy_provider_test.h

Issue 1350913006: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 #ifndef COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_TEST_H_ 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_TEST_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_TEST_H_ 6 #define COMPONENTS_POLICY_CORE_COMMON_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"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 private: 59 private:
60 DISALLOW_COPY_AND_ASSIGN(PolicyTestBase); 60 DISALLOW_COPY_AND_ASSIGN(PolicyTestBase);
61 }; 61 };
62 62
63 // An interface for creating a test policy provider and creating a policy 63 // An interface for creating a test policy provider and creating a policy
64 // provider instance for testing. Used as the parameter to the abstract 64 // provider instance for testing. Used as the parameter to the abstract
65 // ConfigurationPolicyProviderTest below. 65 // ConfigurationPolicyProviderTest below.
66 class PolicyProviderTestHarness { 66 class PolicyProviderTestHarness {
67 public: 67 public:
68 // |level|, |scope| and |source| are the level, scope and source of the 68 // |level| and |scope| are the level and scope of the policies returned by
69 // policies returned by the providers from CreateProvider(). 69 // the providers from CreateProvider().
70 PolicyProviderTestHarness(PolicyLevel level, 70 PolicyProviderTestHarness(PolicyLevel level, PolicyScope scope);
71 PolicyScope scope,
72 PolicySource source);
73 virtual ~PolicyProviderTestHarness(); 71 virtual ~PolicyProviderTestHarness();
74 72
75 // Actions to run at gtest SetUp() time. 73 // Actions to run at gtest SetUp() time.
76 virtual void SetUp() = 0; 74 virtual void SetUp() = 0;
77 75
78 // Create a new policy provider. 76 // Create a new policy provider.
79 virtual ConfigurationPolicyProvider* CreateProvider( 77 virtual ConfigurationPolicyProvider* CreateProvider(
80 SchemaRegistry* registry, 78 SchemaRegistry* registry,
81 scoped_refptr<base::SequencedTaskRunner> task_runner) = 0; 79 scoped_refptr<base::SequencedTaskRunner> task_runner) = 0;
82 80
83 // Returns the policy level, scope and source set by the policy provider. 81 // Returns the policy level and scope set by the policy provider.
84 PolicyLevel policy_level() const; 82 PolicyLevel policy_level() const;
85 PolicyScope policy_scope() const; 83 PolicyScope policy_scope() const;
86 PolicySource policy_source() const;
87 84
88 // Helpers to configure the environment the policy provider reads from. 85 // Helpers to configure the environment the policy provider reads from.
89 virtual void InstallEmptyPolicy() = 0; 86 virtual void InstallEmptyPolicy() = 0;
90 virtual void InstallStringPolicy(const std::string& policy_name, 87 virtual void InstallStringPolicy(const std::string& policy_name,
91 const std::string& policy_value) = 0; 88 const std::string& policy_value) = 0;
92 virtual void InstallIntegerPolicy(const std::string& policy_name, 89 virtual void InstallIntegerPolicy(const std::string& policy_name,
93 int policy_value) = 0; 90 int policy_value) = 0;
94 virtual void InstallBooleanPolicy(const std::string& policy_name, 91 virtual void InstallBooleanPolicy(const std::string& policy_name,
95 bool policy_value) = 0; 92 bool policy_value) = 0;
96 virtual void InstallStringListPolicy(const std::string& policy_name, 93 virtual void InstallStringListPolicy(const std::string& policy_name,
97 const base::ListValue* policy_value) = 0; 94 const base::ListValue* policy_value) = 0;
98 virtual void InstallDictionaryPolicy( 95 virtual void InstallDictionaryPolicy(
99 const std::string& policy_name, 96 const std::string& policy_name,
100 const base::DictionaryValue* policy_value) = 0; 97 const base::DictionaryValue* policy_value) = 0;
101 98
102 // Not every provider supports installing 3rd party policy. Those who do 99 // Not every provider supports installing 3rd party policy. Those who do
103 // should override this method; the default just makes the test fail. 100 // should override this method; the default just makes the test fail.
104 virtual void Install3rdPartyPolicy(const base::DictionaryValue* policies); 101 virtual void Install3rdPartyPolicy(const base::DictionaryValue* policies);
105 102
106 private: 103 private:
107 PolicyLevel level_; 104 PolicyLevel level_;
108 PolicyScope scope_; 105 PolicyScope scope_;
109 PolicySource source_;
110 106
111 DISALLOW_COPY_AND_ASSIGN(PolicyProviderTestHarness); 107 DISALLOW_COPY_AND_ASSIGN(PolicyProviderTestHarness);
112 }; 108 };
113 109
114 // A factory method for creating a test harness. 110 // A factory method for creating a test harness.
115 typedef PolicyProviderTestHarness* (*CreatePolicyProviderTestHarness)(); 111 typedef PolicyProviderTestHarness* (*CreatePolicyProviderTestHarness)();
116 112
117 // Abstract policy provider test. This is meant to be instantiated for each 113 // Abstract policy provider test. This is meant to be instantiated for each
118 // policy provider implementation, passing in a suitable harness factory 114 // policy provider implementation, passing in a suitable harness factory
119 // function as the test parameter. 115 // function as the test parameter.
(...skipping 29 matching lines...) Expand all
149 Configuration3rdPartyPolicyProviderTest(); 145 Configuration3rdPartyPolicyProviderTest();
150 virtual ~Configuration3rdPartyPolicyProviderTest(); 146 virtual ~Configuration3rdPartyPolicyProviderTest();
151 147
152 private: 148 private:
153 DISALLOW_COPY_AND_ASSIGN(Configuration3rdPartyPolicyProviderTest); 149 DISALLOW_COPY_AND_ASSIGN(Configuration3rdPartyPolicyProviderTest);
154 }; 150 };
155 151
156 } // namespace policy 152 } // namespace policy
157 153
158 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_TEST_H_ 154 #endif // COMPONENTS_POLICY_CORE_COMMON_CONFIGURATION_POLICY_PROVIDER_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698