| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/policy/core/common/policy_service_impl.h" | 5 #include "components/policy/core/common/policy_service_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Observer class that changes the policy in the passed provider when the | 70 // Observer class that changes the policy in the passed provider when the |
| 71 // callback is invoked. | 71 // callback is invoked. |
| 72 class ChangePolicyObserver : public PolicyService::Observer { | 72 class ChangePolicyObserver : public PolicyService::Observer { |
| 73 public: | 73 public: |
| 74 explicit ChangePolicyObserver(MockConfigurationPolicyProvider* provider) | 74 explicit ChangePolicyObserver(MockConfigurationPolicyProvider* provider) |
| 75 : provider_(provider), | 75 : provider_(provider), |
| 76 observer_invoked_(false) {} | 76 observer_invoked_(false) {} |
| 77 | 77 |
| 78 virtual void OnPolicyUpdated(const PolicyNamespace&, | 78 void OnPolicyUpdated(const PolicyNamespace&, |
| 79 const PolicyMap& previous, | 79 const PolicyMap& previous, |
| 80 const PolicyMap& current) override { | 80 const PolicyMap& current) override { |
| 81 PolicyMap new_policy; | 81 PolicyMap new_policy; |
| 82 new_policy.Set("foo", | 82 new_policy.Set("foo", |
| 83 POLICY_LEVEL_MANDATORY, | 83 POLICY_LEVEL_MANDATORY, |
| 84 POLICY_SCOPE_USER, | 84 POLICY_SCOPE_USER, |
| 85 new base::FundamentalValue(14), | 85 new base::FundamentalValue(14), |
| 86 NULL); | 86 NULL); |
| 87 provider_->UpdateChromePolicy(new_policy); | 87 provider_->UpdateChromePolicy(new_policy); |
| 88 observer_invoked_ = true; | 88 observer_invoked_ = true; |
| 89 } | 89 } |
| 90 | 90 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 NULL); | 733 NULL); |
| 734 | 734 |
| 735 provider0_.UpdatePolicy(policy_bundle.Pass()); | 735 provider0_.UpdatePolicy(policy_bundle.Pass()); |
| 736 RunUntilIdle(); | 736 RunUntilIdle(); |
| 737 | 737 |
| 738 EXPECT_TRUE(VerifyPolicies(chrome_namespace, expected_chrome)); | 738 EXPECT_TRUE(VerifyPolicies(chrome_namespace, expected_chrome)); |
| 739 EXPECT_TRUE(VerifyPolicies(extension_namespace, expected_extension)); | 739 EXPECT_TRUE(VerifyPolicies(extension_namespace, expected_extension)); |
| 740 } | 740 } |
| 741 | 741 |
| 742 } // namespace policy | 742 } // namespace policy |
| OLD | NEW |