Home | History | Annotate | Download | only in policy
      1 // Copyright (c) 2010 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_MOCK_CONFIGURATION_POLICY_STORE_H_
      6 #define CHROME_BROWSER_POLICY_MOCK_CONFIGURATION_POLICY_STORE_H_
      7 #pragma once
      8 
      9 #include <map>
     10 #include <utility>
     11 
     12 #include "base/stl_util-inl.h"
     13 #include "base/values.h"
     14 #include "chrome/browser/policy/configuration_policy_store_interface.h"
     15 #include "chrome/browser/policy/policy_map.h"
     16 #include "testing/gmock/include/gmock/gmock.h"
     17 
     18 namespace policy {
     19 
     20 // Mock ConfigurationPolicyStore implementation that records values for policy
     21 // settings as they get set.
     22 class MockConfigurationPolicyStore : public ConfigurationPolicyStoreInterface {
     23  public:
     24   MockConfigurationPolicyStore();
     25   virtual ~MockConfigurationPolicyStore();
     26 
     27   const PolicyMap& policy_map() const { return policy_map_; }
     28 
     29   // Get a value for the given policy. Returns NULL if that key doesn't exist.
     30   const Value* Get(ConfigurationPolicyType type) const;
     31   // ConfigurationPolicyStore implementation.
     32   void ApplyToMap(ConfigurationPolicyType policy, Value* value);
     33 
     34   MOCK_METHOD2(Apply, void(ConfigurationPolicyType policy, Value* value));
     35 
     36  private:
     37   PolicyMap policy_map_;
     38 
     39   DISALLOW_COPY_AND_ASSIGN(MockConfigurationPolicyStore);
     40 };
     41 
     42 }  // namespace policy
     43 
     44 #endif  // CHROME_BROWSER_POLICY_MOCK_CONFIGURATION_POLICY_STORE_H_
     45