Ignore title parameter for navigator.registerProtocolHandler
[chromium-blink-merge.git] / components / policy / core / common / mock_configuration_policy_provider.h
blobd891140d785b4e0262c2433c12d9f9a5747dda9f
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_MOCK_CONFIGURATION_POLICY_PROVIDER_H_
6 #define COMPONENTS_POLICY_CORE_COMMON_MOCK_CONFIGURATION_POLICY_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "components/policy/core/common/configuration_policy_provider.h"
10 #include "components/policy/core/common/policy_map.h"
11 #include "components/policy/core/common/schema_registry.h"
12 #include "testing/gmock/include/gmock/gmock.h"
14 namespace policy {
16 // Mock ConfigurationPolicyProvider implementation that supplies canned
17 // values for polices.
18 // TODO(joaodasilva, mnissler): introduce an implementation that non-policy
19 // code can use that doesn't require the usual boilerplate.
20 // http://crbug.com/242087
21 class MockConfigurationPolicyProvider : public ConfigurationPolicyProvider {
22 public:
23 MockConfigurationPolicyProvider();
24 virtual ~MockConfigurationPolicyProvider();
26 MOCK_CONST_METHOD1(IsInitializationComplete, bool(PolicyDomain domain));
27 MOCK_METHOD0(RefreshPolicies, void());
29 // Make public for tests.
30 using ConfigurationPolicyProvider::UpdatePolicy;
32 // Utility method that invokes UpdatePolicy() with a PolicyBundle that maps
33 // the Chrome namespace to a copy of |policy|.
34 void UpdateChromePolicy(const PolicyMap& policy);
36 // Convenience method so that tests don't need to create a registry to create
37 // this mock.
38 using ConfigurationPolicyProvider::Init;
39 void Init() {
40 ConfigurationPolicyProvider::Init(&registry_);
43 // Convenience method that installs an expectation on RefreshPolicies that
44 // just notifies the observers and serves the same policies.
45 void SetAutoRefresh();
47 private:
48 void RefreshWithSamePolicies();
50 SchemaRegistry registry_;
52 DISALLOW_COPY_AND_ASSIGN(MockConfigurationPolicyProvider);
55 class MockConfigurationPolicyObserver
56 : public ConfigurationPolicyProvider::Observer {
57 public:
58 MockConfigurationPolicyObserver();
59 virtual ~MockConfigurationPolicyObserver();
61 MOCK_METHOD1(OnUpdatePolicy, void(ConfigurationPolicyProvider*));
64 } // namespace policy
66 #endif // COMPONENTS_POLICY_CORE_COMMON_MOCK_CONFIGURATION_POLICY_PROVIDER_H_