| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_POLICY_TEST_POLICY_TEST_UTILS_H_ | |
| 6 #define CHROME_BROWSER_POLICY_TEST_POLICY_TEST_UTILS_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <ostream> | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "chrome/browser/policy/policy_service.h" | |
| 14 #include "components/policy/core/common/policy_map.h" | |
| 15 #include "components/policy/core/common/policy_types.h" | |
| 16 #include "policy/policy_constants.h" | |
| 17 | |
| 18 namespace policy { | |
| 19 | |
| 20 class PolicyBundle; | |
| 21 struct PolicyNamespace; | |
| 22 | |
| 23 // A mapping of policy names to PolicyDetails that can be used to set the | |
| 24 // PolicyDetails for test policies. | |
| 25 class PolicyDetailsMap { | |
| 26 public: | |
| 27 PolicyDetailsMap(); | |
| 28 ~PolicyDetailsMap(); | |
| 29 | |
| 30 // The returned callback's lifetime is tied to |this| object. | |
| 31 GetChromePolicyDetailsCallback GetCallback() const; | |
| 32 | |
| 33 // Does not take ownership of |details|. | |
| 34 void SetDetails(const std::string& policy, const PolicyDetails* details); | |
| 35 | |
| 36 private: | |
| 37 typedef std::map<std::string, const PolicyDetails*> PolicyDetailsMapping; | |
| 38 | |
| 39 const PolicyDetails* Lookup(const std::string& policy) const; | |
| 40 | |
| 41 PolicyDetailsMapping map_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(PolicyDetailsMap); | |
| 44 }; | |
| 45 | |
| 46 // Returns true if |service| is not serving any policies. Otherwise logs the | |
| 47 // current policies and returns false. | |
| 48 bool PolicyServiceIsEmpty(const PolicyService* service); | |
| 49 | |
| 50 } // namespace policy | |
| 51 | |
| 52 std::ostream& operator<<(std::ostream& os, const policy::PolicyBundle& bundle); | |
| 53 std::ostream& operator<<(std::ostream& os, policy::PolicyScope scope); | |
| 54 std::ostream& operator<<(std::ostream& os, policy::PolicyLevel level); | |
| 55 std::ostream& operator<<(std::ostream& os, policy::PolicyDomain domain); | |
| 56 std::ostream& operator<<(std::ostream& os, const policy::PolicyMap& policies); | |
| 57 std::ostream& operator<<(std::ostream& os, const policy::PolicyMap::Entry& e); | |
| 58 std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns); | |
| 59 | |
| 60 #endif // CHROME_BROWSER_POLICY_TEST_POLICY_TEST_UTILS_H_ | |
| OLD | NEW |