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

Unified Diff: chrome/browser/policy/test/policy_test_utils.h

Issue 58313002: Removed the PolicyDefinitionList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-10-use-registry
Patch Set: rebase Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/policy/policy_test_utils.cc ('k') | chrome/browser/policy/test/policy_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/test/policy_test_utils.h
diff --git a/chrome/browser/policy/policy_test_utils.h b/chrome/browser/policy/test/policy_test_utils.h
similarity index 54%
rename from chrome/browser/policy/policy_test_utils.h
rename to chrome/browser/policy/test/policy_test_utils.h
index b412e9f6727d82805281debd445257c5aa600302..d59b66274fc6afcd0ec804335782ec29b0cb0fe7 100644
--- a/chrome/browser/policy/policy_test_utils.h
+++ b/chrome/browser/policy/test/policy_test_utils.h
@@ -2,20 +2,47 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_POLICY_POLICY_TEST_UTILS_H_
-#define CHROME_BROWSER_POLICY_POLICY_TEST_UTILS_H_
+#ifndef CHROME_BROWSER_POLICY_TEST_POLICY_TEST_UTILS_H_
+#define CHROME_BROWSER_POLICY_TEST_POLICY_TEST_UTILS_H_
+#include <map>
#include <ostream>
+#include <string>
+#include "base/basictypes.h"
#include "chrome/browser/policy/policy_map.h"
#include "chrome/browser/policy/policy_service.h"
#include "chrome/browser/policy/policy_types.h"
+#include "policy/policy_constants.h"
namespace policy {
class PolicyBundle;
struct PolicyNamespace;
+// A mapping of policy names to PolicyDetails that can be used to set the
+// PolicyDetails for test policies.
+class PolicyDetailsMap {
+ public:
+ PolicyDetailsMap();
+ ~PolicyDetailsMap();
+
+ // The returned callback's lifetime is tied to |this| object.
+ GetChromePolicyDetailsCallback GetCallback() const;
+
+ // Does not take ownership of |details|.
+ void SetDetails(const std::string& policy, const PolicyDetails* details);
+
+ private:
+ typedef std::map<std::string, const PolicyDetails*> PolicyDetailsMapping;
+
+ const PolicyDetails* Lookup(const std::string& policy) const;
+
+ PolicyDetailsMapping map_;
+
+ DISALLOW_COPY_AND_ASSIGN(PolicyDetailsMap);
+};
+
// Returns true if |service| is not serving any policies. Otherwise logs the
// current policies and returns false.
bool PolicyServiceIsEmpty(const PolicyService* service);
@@ -30,4 +57,4 @@ std::ostream& operator<<(std::ostream& os, const policy::PolicyMap& policies);
std::ostream& operator<<(std::ostream& os, const policy::PolicyMap::Entry& e);
std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns);
-#endif // CHROME_BROWSER_POLICY_POLICY_TEST_UTILS_H_
+#endif // CHROME_BROWSER_POLICY_TEST_POLICY_TEST_UTILS_H_
« no previous file with comments | « chrome/browser/policy/policy_test_utils.cc ('k') | chrome/browser/policy/test/policy_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698