cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / components / policy / core / common / policy_test_utils.h
blob9a9cfbfb5a296468980e738c9a57e6bafd83c624
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.
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_TEST_UTILS_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_TEST_UTILS_H_
8 #include <map>
9 #include <ostream>
10 #include <string>
12 #include "base/basictypes.h"
13 #include "components/policy/core/common/policy_details.h"
14 #include "components/policy/core/common/policy_map.h"
15 #include "components/policy/core/common/policy_service.h"
16 #include "components/policy/core/common/policy_types.h"
18 namespace policy {
20 class PolicyBundle;
21 struct PolicyNamespace;
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();
30 // The returned callback's lifetime is tied to |this| object.
31 GetChromePolicyDetailsCallback GetCallback() const;
33 // Does not take ownership of |details|.
34 void SetDetails(const std::string& policy, const PolicyDetails* details);
36 private:
37 typedef std::map<std::string, const PolicyDetails*> PolicyDetailsMapping;
39 const PolicyDetails* Lookup(const std::string& policy) const;
41 PolicyDetailsMapping map_;
43 DISALLOW_COPY_AND_ASSIGN(PolicyDetailsMap);
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);
50 #if defined(OS_IOS) || defined(OS_MACOSX)
52 // Converts a base::Value to the equivalent CFPropertyListRef.
53 // The returned value is owned by the caller.
54 CFPropertyListRef ValueToProperty(const base::Value* value);
56 #endif
58 } // namespace policy
60 std::ostream& operator<<(std::ostream& os, const policy::PolicyBundle& bundle);
61 std::ostream& operator<<(std::ostream& os, policy::PolicyScope scope);
62 std::ostream& operator<<(std::ostream& os, policy::PolicyLevel level);
63 std::ostream& operator<<(std::ostream& os, policy::PolicyDomain domain);
64 std::ostream& operator<<(std::ostream& os, const policy::PolicyMap& policies);
65 std::ostream& operator<<(std::ostream& os, const policy::PolicyMap::Entry& e);
66 std::ostream& operator<<(std::ostream& os, const policy::PolicyNamespace& ns);
68 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_TEST_UTILS_H_